From 6c940b27df2a7808ef3125dcd42fce105b80562b Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 16 Nov 2023 08:25:05 +0100 Subject: [PATCH] refactor(neon): Remove deprecated WillPopScope Signed-off-by: jld3103 --- packages/neon/neon/lib/src/pages/home.dart | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index c82cd0eb..04df3e20 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -8,7 +8,6 @@ import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/apps.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/app_implementation.dart'; -import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/global_options.dart' as global_options; import 'package:neon/src/utils/global_popups.dart'; import 'package:neon/src/utils/provider.dart'; @@ -32,10 +31,8 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - final _scaffoldKey = GlobalKey(); - late Account _account; - late GlobalOptions _globalOptions; + late global_options.GlobalOptions _globalOptions; late AccountsBloc _accountsBloc; late AppsBloc _appsBloc; late StreamSubscription> _versionCheckSubscription; @@ -43,7 +40,7 @@ class _HomePageState extends State { @override void initState() { super.initState(); - _globalOptions = NeonProvider.of(context); + _globalOptions = NeonProvider.of(context); _accountsBloc = NeonProvider.of(context); _account = _accountsBloc.activeAccount.value!; _appsBloc = _accountsBloc.activeAppsBloc; @@ -173,7 +170,6 @@ class _HomePageState extends State { final drawerAlwaysVisible = navigationMode == global_options.NavigationMode.drawerAlwaysVisible; final body = Scaffold( - key: _scaffoldKey, resizeToAvoidBottomInset: false, drawer: !drawerAlwaysVisible ? drawer : null, appBar: appBar, @@ -198,20 +194,9 @@ class _HomePageState extends State { }, ); - return WillPopScope( - onWillPop: () async { - if (_scaffoldKey.currentState!.isDrawerOpen) { - Navigator.pop(context); - return true; - } - - _scaffoldKey.currentState!.openDrawer(); - return false; - }, - child: MultiProvider( - providers: _appsBloc.appBlocProviders, - child: body, - ), + return MultiProvider( + providers: _appsBloc.appBlocProviders, + child: body, ); } }