diff --git a/lib/pages/home/home.dart b/lib/pages/home/home.dart index dbec0564..312ca7f9 100644 --- a/lib/pages/home/home.dart +++ b/lib/pages/home/home.dart @@ -1,6 +1,4 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_desktop_tools/flutter_desktop_tools.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:gap/gap.dart'; diff --git a/lib/pages/root/root_app.dart b/lib/pages/root/root_app.dart index 2ff49737..aaf3e30a 100644 --- a/lib/pages/root/root_app.dart +++ b/lib/pages/root/root_app.dart @@ -162,38 +162,47 @@ class RootApp extends HookConsumerWidget { } } - return Scaffold( - body: Sidebar( - selectedIndex: rootPaths[location], - onSelectedIndexChanged: onSelectIndexChanged, - child: child, - ), - extendBody: true, - drawerScrimColor: Colors.transparent, - endDrawer: DesktopTools.platform.isDesktop - ? Container( - constraints: const BoxConstraints(maxWidth: 800), - decoration: BoxDecoration( - boxShadow: theme.brightness == Brightness.light - ? null - : kElevationToShadow[8], - ), - margin: const EdgeInsets.only( - top: 40, - bottom: 100, - ), - child: const PlayerQueue(floating: true), - ) - : null, - bottomNavigationBar: Column( - mainAxisSize: MainAxisSize.min, - children: [ - BottomPlayer(), - SpotubeNavigationBar( - selectedIndex: rootPaths[location], - onSelectedIndexChanged: onSelectIndexChanged, - ), - ], + return WillPopScope( + onWillPop: () async { + if (rootPaths[location] != 0) { + onSelectIndexChanged(0); + return false; + } + return true; + }, + child: Scaffold( + body: Sidebar( + selectedIndex: rootPaths[location], + onSelectedIndexChanged: onSelectIndexChanged, + child: child, + ), + extendBody: true, + drawerScrimColor: Colors.transparent, + endDrawer: DesktopTools.platform.isDesktop + ? Container( + constraints: const BoxConstraints(maxWidth: 800), + decoration: BoxDecoration( + boxShadow: theme.brightness == Brightness.light + ? null + : kElevationToShadow[8], + ), + margin: const EdgeInsets.only( + top: 40, + bottom: 100, + ), + child: const PlayerQueue(floating: true), + ) + : null, + bottomNavigationBar: Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomPlayer(), + SpotubeNavigationBar( + selectedIndex: rootPaths[location], + onSelectedIndexChanged: onSelectIndexChanged, + ), + ], + ), ), ); } diff --git a/pubspec.lock b/pubspec.lock index 03ea66a1..b9268b56 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1014,10 +1014,10 @@ packages: dependency: "direct main" description: name: go_router - sha256: "3b40e751eaaa855179b416974d59d29669e750d2e50fcdb2b37f1cb0ca8c803a" + sha256: c5fa45fa502ee880839e3b2152d987c44abae26d064a2376d4aad434cf0f7b15 url: "https://pub.dev" source: hosted - version: "13.0.1" + version: "12.1.3" google_fonts: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index a9144845..82377d08 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -55,7 +55,7 @@ dependencies: flutter_svg: ^1.1.6 form_validator: ^2.1.1 fuzzywuzzy: ^1.1.6 - go_router: ^13.0.1 + go_router: 12.1.3 # Stuck on this https://github.com/flutter/flutter/issues/140869 google_fonts: ^6.1.0 hive: ^2.2.3 hive_flutter: ^1.1.0