mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00
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:
@ -42,6 +42,8 @@ class _FolderViewState extends State<FolderView> {
|
|||||||
StandardViewHeader _headerType = StandardViewHeader.TitleGenerated;
|
StandardViewHeader _headerType = StandardViewHeader.TitleGenerated;
|
||||||
bool _showSummary = true;
|
bool _showSummary = true;
|
||||||
|
|
||||||
|
var _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -123,6 +125,7 @@ class _FolderViewState extends State<FolderView> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
key: _scaffoldKey,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
leading: GJAppBarMenuButton(),
|
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;
|
NotesFolderFS fsFolder = widget.notesFolder.fsFolder;
|
||||||
if (widget.notesFolder.name != fsFolder.name) {
|
if (widget.notesFolder.name != fsFolder.name) {
|
||||||
var spec = Settings.instance.defaultNewNoteFolderSpec;
|
var spec = Settings.instance.defaultNewNoteFolderSpec;
|
||||||
@ -224,7 +227,8 @@ class _FolderViewState extends State<FolderView> {
|
|||||||
var route = MaterialPageRoute(
|
var route = MaterialPageRoute(
|
||||||
builder: (context) => NoteEditor.newNote(fsFolder, editorType),
|
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) {
|
RadioListTile<SortingMode> _buildSortingTile(SortingMode sm) {
|
||||||
|
Reference in New Issue
Block a user