diff --git a/lib/pages/editor/editor_page.dart b/lib/pages/editor/editor_page.dart index 21b9959d..ed053f80 100644 --- a/lib/pages/editor/editor_page.dart +++ b/lib/pages/editor/editor_page.dart @@ -182,6 +182,10 @@ class _EditorState extends ConsumerState { note: note, isNewNote: widget.isNewNote, readOnly: readOnly, + // Checking and moving the items is not editing their texts: allow it in the reading mode, but never in + // the bin + toggleable: !currentNote.deleted, + reorderable: !currentNote.deleted, onChanged: scheduleSave, ); } diff --git a/lib/pages/editor/widgets/editors/checklist_editor.dart b/lib/pages/editor/widgets/editors/checklist_editor.dart index 200b8dab..fce185a5 100644 --- a/lib/pages/editor/widgets/editors/checklist_editor.dart +++ b/lib/pages/editor/widgets/editors/checklist_editor.dart @@ -12,6 +12,8 @@ class ChecklistEditor extends ConsumerStatefulWidget { required this.note, required this.isNewNote, required this.readOnly, + required this.toggleable, + required this.reorderable, required this.onChanged, }); @@ -24,6 +26,12 @@ class ChecklistEditor extends ConsumerStatefulWidget { /// Whether the text fields are read only. final bool readOnly; + /// Whether the checkboxes can be toggled even when the editor is [readOnly] (in the reading mode). + final bool toggleable; + + /// Whether the items can be reordered even when the editor is [readOnly] (in the reading mode). + final bool reorderable; + /// Called when the note has changed. final ValueChanged onChanged; @@ -50,6 +58,8 @@ class _ChecklistEditorState extends ConsumerState { child: Checklist( lines: widget.note.checklistLines, enabled: !widget.readOnly, + toggleable: widget.toggleable, + reorderable: widget.reorderable, autofocusFirstLine: widget.isNewNote, textInputAction: TextInputAction.newline, textCapitalization: TextCapitalization.sentences, diff --git a/pubspec.lock b/pubspec.lock index 275ddafe..3451bdfb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -426,10 +426,10 @@ packages: dependency: "direct main" description: name: flutter_checklist - sha256: "05535250455c0810db377ee86e34b0065bd039ededf198b726366bf70a8ccee6" + sha256: f3b836bfe8eeefd8222aa8f6170e2f7b57eb004439d22e95e896a627b334e0d9 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" flutter_displaymode: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index a3bb35b9..e0a0ec65 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: flex_color_picker: ^3.8.0 flutter: sdk: flutter - flutter_checklist: ^2.0.0 + flutter_checklist: ^2.1.0 flutter_displaymode: ^0.7.0 flutter_expandable_fab: ^2.5.2 flutter_fgbg: ^0.8.0