diff --git a/lib/editors/checklist_editor.dart b/lib/editors/checklist_editor.dart index e40ced4d..a61580bb 100644 --- a/lib/editors/checklist_editor.dart +++ b/lib/editors/checklist_editor.dart @@ -159,6 +159,8 @@ class ChecklistEditorState extends State Expanded(child: FocusScope(child: checklistWidget)), ], ), + bottomNavigationBar: + buildEditorBottonBar(context, widget, this, checklist.note), ); } diff --git a/lib/editors/common.dart b/lib/editors/common.dart index dcc737f6..51f27b24 100644 --- a/lib/editors/common.dart +++ b/lib/editors/common.dart @@ -17,7 +17,7 @@ abstract class EditorState { Note getNote(); } -enum DropDownChoices { Rename, MoveToFolder, DiscardChanges, Share } +enum DropDownChoices { Rename, DiscardChanges, Share } AppBar buildEditorAppBar( Editor editor, @@ -58,11 +58,6 @@ AppBar buildEditorAppBar( editor.renameNoteSelected(note); return; - case DropDownChoices.MoveToFolder: - var note = editorState.getNote(); - editor.moveNoteToFolderSelected(note); - return; - case DropDownChoices.DiscardChanges: var note = editorState.getNote(); editor.discardChangesSelected(note); @@ -80,10 +75,6 @@ AppBar buildEditorAppBar( value: DropDownChoices.Rename, child: Text('Edit File Name'), ), - const PopupMenuItem( - value: DropDownChoices.MoveToFolder, - child: Text('Move to Folder'), - ), const PopupMenuItem( value: DropDownChoices.DiscardChanges, child: Text('Discard Changes'), @@ -97,3 +88,33 @@ AppBar buildEditorAppBar( ], ); } + +BottomAppBar buildEditorBottonBar( + BuildContext context, + Editor editor, + EditorState editorState, + Note note, +) { + var folderName = note.parent.pathSpec(); + if (folderName.isEmpty) { + folderName = "Root Folder"; + } + + return BottomAppBar( + elevation: 0.0, + color: Theme.of(context).scaffoldBackgroundColor, + child: Row( + children: [ + FlatButton.icon( + icon: Icon(Icons.folder), + label: Text(folderName), + onPressed: () { + var note = editorState.getNote(); + editor.moveNoteToFolderSelected(note); + }, + ) + ], + mainAxisAlignment: MainAxisAlignment.center, + ), + ); +} diff --git a/lib/editors/journal_editor.dart b/lib/editors/journal_editor.dart index 1abfcb7e..952652b1 100644 --- a/lib/editors/journal_editor.dart +++ b/lib/editors/journal_editor.dart @@ -84,6 +84,7 @@ class JournalEditorState extends State implements EditorState { return Scaffold( appBar: buildEditorAppBar(widget, this, noteModified: _noteModified), body: editor, + bottomNavigationBar: buildEditorBottonBar(context, widget, this, note), ); } diff --git a/lib/editors/markdown_editor.dart b/lib/editors/markdown_editor.dart index 94fd7718..09d06ee6 100644 --- a/lib/editors/markdown_editor.dart +++ b/lib/editors/markdown_editor.dart @@ -115,6 +115,7 @@ class MarkdownEditorState extends State implements EditorState { extraButtons: [extraButton], ), body: body, + bottomNavigationBar: buildEditorBottonBar(context, widget, this, note), ); } diff --git a/lib/editors/raw_editor.dart b/lib/editors/raw_editor.dart index 723c022e..824ed0ef 100644 --- a/lib/editors/raw_editor.dart +++ b/lib/editors/raw_editor.dart @@ -81,6 +81,7 @@ class RawEditorState extends State implements EditorState { return Scaffold( appBar: buildEditorAppBar(widget, this, noteModified: _noteModified), body: editor, + bottomNavigationBar: buildEditorBottonBar(context, widget, this, note), ); } diff --git a/lib/screens/note_editor.dart b/lib/screens/note_editor.dart index 835a6979..4ee4f36a 100644 --- a/lib/screens/note_editor.dart +++ b/lib/screens/note_editor.dart @@ -287,8 +287,14 @@ class NoteEditorState extends State { builder: (context) => FolderSelectionDialog(), ); if (destFolder != null) { - var stateContainer = Provider.of(context, listen: false); - stateContainer.moveNote(note, destFolder); + if (_isNewNote) { + note.parent = destFolder; + setState(() {}); + } else { + var stateContainer = + Provider.of(context, listen: false); + stateContainer.moveNote(note, destFolder); + } } }