From 6ebd44505ce0fde64dfb26e885daf327721dfb9c Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 8 May 2020 10:29:16 +0200 Subject: [PATCH] FolderView: Hide the scaffold of a previously deleted note When moving to create a new note, it's confusing if when we return to the FolderView there is still the scaffold of undo-ing the last deleted note. --- lib/screens/folder_view.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/screens/folder_view.dart b/lib/screens/folder_view.dart index e3bab1db..a9edb768 100644 --- a/lib/screens/folder_view.dart +++ b/lib/screens/folder_view.dart @@ -42,6 +42,8 @@ class _FolderViewState extends State { StandardViewHeader _headerType = StandardViewHeader.TitleGenerated; bool _showSummary = true; + var _scaffoldKey = GlobalKey(); + @override void initState() { super.initState(); @@ -123,6 +125,7 @@ class _FolderViewState extends State { ); return Scaffold( + key: _scaffoldKey, appBar: AppBar( title: Text(title), leading: GJAppBarMenuButton(), @@ -205,7 +208,7 @@ class _FolderViewState extends State { } } - void _newPost(BuildContext context, EditorType editorType) { + void _newPost(BuildContext context, EditorType editorType) async { NotesFolderFS fsFolder = widget.notesFolder.fsFolder; if (widget.notesFolder.name != fsFolder.name) { var spec = Settings.instance.defaultNewNoteFolderSpec; @@ -224,7 +227,8 @@ class _FolderViewState extends State { var route = MaterialPageRoute( builder: (context) => NoteEditor.newNote(fsFolder, editorType), ); - Navigator.of(context).push(route); + await Navigator.of(context).push(route); + _scaffoldKey.currentState.removeCurrentSnackBar(); } RadioListTile _buildSortingTile(SortingMode sm) {