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.
This commit is contained in:
Vishesh Handa
2020-05-08 10:29:16 +02:00
parent 55ea402899
commit 6ebd44505c

View File

@ -42,6 +42,8 @@ class _FolderViewState extends State<FolderView> {
StandardViewHeader _headerType = StandardViewHeader.TitleGenerated;
bool _showSummary = true;
var _scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
@ -123,6 +125,7 @@ class _FolderViewState extends State<FolderView> {
);
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(title),
leading: GJAppBarMenuButton(),
@ -205,7 +208,7 @@ class _FolderViewState extends State<FolderView> {
}
}
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<FolderView> {
var route = MaterialPageRoute(
builder: (context) => NoteEditor.newNote(fsFolder, editorType),
);
Navigator.of(context).push(route);
await Navigator.of(context).push(route);
_scaffoldKey.currentState.removeCurrentSnackBar();
}
RadioListTile<SortingMode> _buildSortingTile(SortingMode sm) {