Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: autofocus after creating a new option
appflowyc7db59c99b5e
diff --git a/frontend/app_flowy/lib/plugins/grid/application/cell/select_option_editor_bloc.dart b/frontend/app_flowy/lib/plugins/grid/application/cell/select_option_editor_bloc.dartindex 349d95d13f..03abe5f9c9 100644--- a/frontend/app_flowy/lib/plugins/grid/application/cell/select_option_editor_bloc.dart+++ b/frontend/app_flowy/lib/plugins/grid/application/cell/select_option_editor_bloc.dart@@ -103,11 +103,19 @@ class SelectOptionCellEditorBlocvoid _filterOption(String optionName, Emitter<SelectOptionEditorState> emit) {final _MakeOptionResult result =_makeOptions(Some(optionName), state.allOptions);- emit(state.copyWith(- filter: Some(optionName),- options: result.options,- createOption: result.createOption,- ));+ if (optionName.isEmpty) {+ emit(state.copyWith(+ filter: Some(optionName),+ options: result.options,+ createOption: none(),+ ));+ } else {+ emit(state.copyWith(+ filter: Some(optionName),+ options: result.options,+ createOption: result.createOption,+ ));+ }}void _loadOptions() {diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dartindex f045984e66..93b0699462 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dart@@ -100,11 +100,7 @@ class SelectOptionTag extends StatelessWidget {backgroundColor: color,labelPadding: const EdgeInsets.symmetric(horizontal: 6),selected: true,- onSelected: (_) {- if (onSelected != null) {- onSelected!();- }- },+ onSelected: (_) => onSelected?.call(),);}}diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dartindex 024d5ff356..897b6f81c3 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dart@@ -23,7 +23,7 @@ import '../../header/type_option/select_option_editor.dart';import 'extension.dart';import 'text_field.dart';-const double _editorPannelWidth = 300;+const double _editorPanelWidth = 300;class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {final GridSelectOptionCellController cellController;@@ -75,8 +75,8 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {//FlowyOverlay.of(context).insertWithAnchor(widget: OverlayContainer(- constraints: BoxConstraints.loose(const Size(_editorPannelWidth, 300)),- child: SizedBox(width: _editorPannelWidth, child: editor),+ constraints: BoxConstraints.loose(const Size(_editorPanelWidth, 300)),+ child: SizedBox(width: _editorPanelWidth, child: editor),),identifier: SelectOptionCellEditor.identifier(),anchorContext: context,@@ -161,7 +161,7 @@ class _TextField extends StatelessWidget {child: SelectOptionTextField(options: state.options,selectedOptionMap: optionMap,- distanceToText: _editorPannelWidth * 0.7,+ distanceToText: _editorPanelWidth * 0.7,tagController: _tagController,onClick: () => FlowyOverlay.of(context).remove(SelectOptionTypeOptionEditor.identifier),diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dartindex 022d411f2b..8149783d47 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart@@ -32,10 +32,10 @@ class SelectOptionTextField extends StatelessWidget {required this.onNewTag,required this.newText,this.onClick,- TextEditingController? controller,+ TextEditingController? textController,FocusNode? focusNode,Key? key,- }) : _controller = controller ?? TextEditingController(),+ }) : _controller = textController ?? TextEditingController(),_focusNode = focusNode ?? FocusNode(),super(key: key);@@ -48,7 +48,7 @@ class SelectOptionTextField extends StatelessWidget {textfieldTagsController: tagController,initialTags: selectedOptionMap.keys.toList(),focusNode: _focusNode,- textSeparators: const [' ', ','],+ textSeparators: const [','],inputfieldBuilder: (BuildContext context, editController, focusNode,error, onChanged, onSubmitted) {return ((context, sc, tags, onTagDelegate) {@@ -70,6 +70,7 @@ class SelectOptionTextField extends StatelessWidget {if (text.isNotEmpty) {onNewTag(text);+ focusNode.requestFocus();}},maxLines: 1,