2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-14 11:15:26 +00:00

Refactor "drawer"

- Reduce number of items
- Long-pressing the "back" button opens the drawer

Ref: https://stackoverflow.com/questions/58095547/flutter-scaffold-ofcontext-opendrawer-doesnt-work
This commit is contained in:
Oliver
2021-10-03 12:11:22 +11:00
parent 4f8794e652
commit 18479b88e3
3 changed files with 18 additions and 99 deletions

View File

@ -62,15 +62,6 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
});
}
// Function to construct an appbar (override if needed)
AppBar getAppBar(BuildContext context) {
return AppBar(
title: Text(getAppBarTitle(context)),
actions: getAppBarActions(context),
leading: backButton(context),
);
}
// Function to construct a drawer (override if needed)
Widget getDrawer(BuildContext context) {
return InvenTreeDrawer(context);
@ -96,11 +87,15 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
// Save the context for future use
_context = context;
return Scaffold(
key: refreshableKey,
appBar: getAppBar(context),
drawer: null,
appBar: AppBar(
title: Text(getAppBarTitle(context)),
actions: getAppBarActions(context),
leading: backButton(context, refreshableKey),
),
drawer: getDrawer(context),
floatingActionButton: getFab(context),
body: Builder(
builder: (BuildContext context) {