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: more checklist multiline issues (#6229)
Richard Shiueec799afb7d36
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dartindex e86a2c47c7..4d18862223 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart@@ -138,6 +138,10 @@ class _EndEditingTaskIntent extends Intent {const _EndEditingTaskIntent();}+class _UpdateTaskDescriptionIntent extends Intent {+ const _UpdateTaskDescriptionIntent();+}+/// Represents an existing task@visibleForTestingclass ChecklistItem extends StatefulWidget {@@ -175,7 +179,7 @@ class _ChecklistItemState extends State<ChecklistItem> {control: !Platform.isMacOS,): const _SelectTaskIntent(),const SingleActivator(LogicalKeyboardKey.enter):- const _EndEditingTaskIntent(),+ const _UpdateTaskDescriptionIntent(),const SingleActivator(LogicalKeyboardKey.escape):const _EndEditingTaskIntent(),};@@ -282,6 +286,14 @@ class _ChecklistItemState extends State<ChecklistItem> {return;},),+ _UpdateTaskDescriptionIntent:+ CallbackAction<_UpdateTaskDescriptionIntent>(+ onInvoke: (_UpdateTaskDescriptionIntent intent) {+ textFieldFocusNode.unfocus();+ widget.onSubmitted?.call();+ return;+ },+ ),_EndEditingTaskIntent: CallbackAction<_EndEditingTaskIntent>(onInvoke: (_EndEditingTaskIntent intent) {textFieldFocusNode.unfocus();@@ -315,6 +327,7 @@ class NewTaskItem extends StatefulWidget {class _NewTaskItemState extends State<NewTaskItem> {final _textEditingController = TextEditingController();+ bool _isCreateButtonEnabled = false;@overridevoid initState() {@@ -339,45 +352,46 @@ class _NewTaskItemState extends State<NewTaskItem> {children: [const HSpace(8),Expanded(- child: TextField(- focusNode: widget.focusNode,- controller: _textEditingController,- style: Theme.of(context).textTheme.bodyMedium,- decoration: InputDecoration(- border: InputBorder.none,- isCollapsed: true,- contentPadding: const EdgeInsets.symmetric(- vertical: 6.0,- horizontal: 2.0,+ child: CallbackShortcuts(+ bindings: {+ const SingleActivator(LogicalKeyboardKey.enter): () =>+ _createNewTask(context),+ },+ child: TextField(+ focusNode: widget.focusNode,+ controller: _textEditingController,+ style: Theme.of(context).textTheme.bodyMedium,+ maxLines: null,+ decoration: InputDecoration(+ border: InputBorder.none,+ isCollapsed: true,+ contentPadding: const EdgeInsets.symmetric(+ vertical: 6.0,+ horizontal: 2.0,+ ),+ hintText: LocaleKeys.grid_checklist_addNew.tr(),+ ),+ onSubmitted: (_) => _createNewTask(context),+ onChanged: (value) => setState(+ () => _isCreateButtonEnabled =+ _textEditingController.text.isNotEmpty,),- hintText: LocaleKeys.grid_checklist_addNew.tr(),),- onSubmitted: (taskDescription) {- if (taskDescription.isNotEmpty) {- context- .read<ChecklistCellBloc>()- .add(ChecklistCellEvent.createNewTask(taskDescription));- _textEditingController.clear();- }- widget.focusNode.requestFocus();- },- onChanged: (value) => setState(() {}),),),FlowyTextButton(LocaleKeys.grid_checklist_submitNewTask.tr(),fontSize: 11,- fillColor: _textEditingController.text.isEmpty- ? Theme.of(context).disabledColor- : Theme.of(context).colorScheme.primary,- hoverColor: _textEditingController.text.isEmpty- ? Theme.of(context).disabledColor- : Theme.of(context).colorScheme.primaryContainer,+ fillColor: _isCreateButtonEnabled+ ? Theme.of(context).colorScheme.primary+ : Theme.of(context).disabledColor,+ hoverColor: _isCreateButtonEnabled+ ? Theme.of(context).colorScheme.primaryContainer+ : Theme.of(context).disabledColor,fontColor: Theme.of(context).colorScheme.onPrimary,padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),- onPressed: _textEditingController.text.isEmpty- ? null- : () {+ onPressed: _isCreateButtonEnabled+ ? () {context.read<ChecklistCellBloc>().add(ChecklistCellEvent.createNewTask(_textEditingController.text,@@ -385,10 +399,22 @@ class _NewTaskItemState extends State<NewTaskItem> {);widget.focusNode.requestFocus();_textEditingController.clear();- },+ }+ : null,),],),);}++ void _createNewTask(BuildContext context) {+ final taskDescription = _textEditingController.text;+ if (taskDescription.isNotEmpty) {+ context+ .read<ChecklistCellBloc>()+ .add(ChecklistCellEvent.createNewTask(taskDescription));+ _textEditingController.clear();+ }+ widget.focusNode.requestFocus();+ }}diff --git a/frontend/appflowy_flutter/macos/Podfile.lock b/frontend/appflowy_flutter/macos/Podfile.lockindex 0fc6b09590..615bfca955 100644--- a/frontend/appflowy_flutter/macos/Podfile.lock+++ b/frontend/appflowy_flutter/macos/Podfile.lock@@ -142,7 +142,7 @@ SPEC CHECKSUMS:HotKey: e96d8a2ddbf4591131e2bb3f54e69554d90cdca6hotkey_manager: c32bf0bfe8f934b7bc17ab4ad5c4c142960b023cirondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478- local_notifier: c6c371695f914641ab7bc8601944f7e358632d0b+ local_notifier: e9506bc66fc70311e8bc7291fb70f743c081e4ffpackage_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0cpath_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147cReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979