From 825f3917c9d890c4a7b4735ce9d99a9a20959f05 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 14 Jul 2021 09:57:12 +0200 Subject: [PATCH] FolderView: Pass correct context --- lib/folder_views/folder_view.dart | 52 +++++++++++++++++-------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/lib/folder_views/folder_view.dart b/lib/folder_views/folder_view.dart index 50937e97..2fcb77b5 100644 --- a/lib/folder_views/folder_view.dart +++ b/lib/folder_views/folder_view.dart @@ -81,20 +81,12 @@ class _FolderViewState extends State { } } - @override - Widget build(BuildContext context) { - var createButton = FloatingActionButton( - key: const ValueKey("FAB"), - onPressed: () => _newPost(widget.notesFolder.config.defaultEditor), - child: const Icon(Icons.add), - ); - + Widget _buildBody(BuildContext context) { var title = widget.notesFolder.publicName; if (inSelectionMode) { title = NumberFormat.compact().format(1); } - // vHanda: Fixme the openNoteEditor will fail! Wrong context! var folderView = buildFolderView( viewType: _viewType, folder: sortedNotesFolder, @@ -135,21 +127,35 @@ class _FolderViewState extends State { onPressed: _resetSelection, ); + return CustomScrollView( + slivers: [ + SliverAppBar( + title: Text(title), + leading: inSelectionMode ? backButton : GJAppBarMenuButton(), + actions: inSelectionMode + ? _buildInSelectionNoteActions() + : _buildNoteActions(), + floating: true, + forceElevated: true, + ), + folderView, + ], + ); + } + + @override + Widget build(BuildContext context) { + var createButton = FloatingActionButton( + key: const ValueKey("FAB"), + onPressed: () => _newPost(widget.notesFolder.config.defaultEditor), + child: const Icon(Icons.add), + ); + + var settings = Provider.of(context); + final showButtomMenuBar = settings.bottomMenuBar; + return Scaffold( - body: CustomScrollView( - slivers: [ - SliverAppBar( - title: Text(title), - leading: inSelectionMode ? backButton : GJAppBarMenuButton(), - actions: inSelectionMode - ? _buildInSelectionNoteActions() - : _buildNoteActions(), - floating: true, - forceElevated: true, - ), - folderView, - ], - ), + body: Builder(builder: _buildBody), /* Center( child: Builder(