fix: remove keyboard when tap outside text field (#4235)

This commit is contained in:
Yijing Huang 2023-12-28 18:46:10 -07:00 committed by GitHub
parent 54fcc4ac5b
commit 5cede74c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -85,6 +85,11 @@ class _GroupCardHeaderState extends State<GroupCardHeader> {
),
maxLines: 1,
style: titleTextStyle,
onTapOutside: (_) => context.read<BoardBloc>().add(
// group header switch from TextField to Text
// group name won't be changed
BoardEvent.endEditingHeader(widget.groupData.id, null),
),
);
}

View File

@ -211,7 +211,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
state.copyWith(isEditingHeader: true, editingHeaderId: groupId),
);
},
endEditingHeader: (String groupId, String groupName) async {
endEditingHeader: (String groupId, String? groupName) async {
await groupBackendSvc.updateGroup(
fieldId: groupControllers.values.first.group.fieldId,
groupId: groupId,
@ -505,7 +505,7 @@ class BoardEvent with _$BoardEvent {
const factory BoardEvent.createGroup(String name) = _CreateGroup;
const factory BoardEvent.startEditingHeader(String groupId) =
_StartEditingHeader;
const factory BoardEvent.endEditingHeader(String groupId, String groupName) =
const factory BoardEvent.endEditingHeader(String groupId, String? groupName) =
_EndEditingHeader;
const factory BoardEvent.didCreateRow(
GroupPB group,