Disable undo/redo for editors where it hasn't been implemented

This commit is contained in:
Vishesh Handa
2021-02-03 16:06:28 +01:00
parent ebff34b753
commit 2c071fb792
4 changed files with 16 additions and 14 deletions

View File

@ -90,10 +90,11 @@ class EditorBottomBar extends StatelessWidget {
maintainInteractivity: false,
),
const Spacer(),
IconButton(
icon: const Icon(Icons.undo),
onPressed: undoAllowed ? onUndoSelected : null,
),
if (undoAllowed != null)
IconButton(
icon: const Icon(Icons.undo),
onPressed: undoAllowed ? onUndoSelected : null,
),
FlatButton.icon(
icon: const Icon(Icons.folder),
label: Text(parentFolder.publicName),
@ -102,10 +103,11 @@ class EditorBottomBar extends StatelessWidget {
editor.moveNoteToFolderSelected(note);
},
),
IconButton(
icon: const Icon(Icons.redo),
onPressed: redoAllowed ? onRedoSelected : null,
),
if (redoAllowed != null)
IconButton(
icon: const Icon(Icons.redo),
onPressed: redoAllowed ? onRedoSelected : null,
),
const Spacer(),
menuIcon,
],

View File

@ -185,8 +185,8 @@ class ChecklistEditorState extends State<ChecklistEditor>
),
onUndoSelected: _undo,
onRedoSelected: _redo,
undoAllowed: false,
redoAllowed: false,
undoAllowed: null,
redoAllowed: null,
);
}

View File

@ -108,8 +108,8 @@ class JournalEditorState extends State<JournalEditor>
body: editor,
onUndoSelected: _undo,
onRedoSelected: _redo,
undoAllowed: false,
redoAllowed: false,
undoAllowed: null,
redoAllowed: null,
);
}

View File

@ -142,8 +142,8 @@ class MarkdownEditorState extends State<MarkdownEditor>
body: editor,
onUndoSelected: _undo,
onRedoSelected: _redo,
undoAllowed: false,
redoAllowed: false,
undoAllowed: null,
redoAllowed: null,
);
}