From 8edd4f9a1e90bee758fc492439780438b4fd5596 Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Tue, 25 Jan 2022 18:18:44 +0100 Subject: [PATCH] Make sure home is not pushed before the intro slides --- frontend/lib/entry_widget.dart | 12 ++++++------ frontend/lib/intro_slides/intro_screen.dart | 2 +- frontend/lib/map/map/screen_parent_resizer.dart | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/frontend/lib/entry_widget.dart b/frontend/lib/entry_widget.dart index 3d33a9162..a54d59790 100644 --- a/frontend/lib/entry_widget.dart +++ b/frontend/lib/entry_widget.dart @@ -31,11 +31,14 @@ class EntryWidget extends StatelessWidget { if (settings.firstStart) { routes.addAll({ - '/intro': (context) => IntroScreen( + 'intro': (context) => IntroScreen( onFinishedCallback: () => settings.setFirstStart(enabled: false), ), + '/': (context) => HomePage( + showVerification: configuration.showVerification, + ) }); - initialRoute = '/intro'; + initialRoute = 'intro'; } return MaterialApp( @@ -43,7 +46,6 @@ class EntryWidget extends StatelessWidget { theme: lightTheme, darkTheme: darkTheme, themeMode: ThemeMode.system, - initialRoute: initialRoute, debugShowCheckedModeBanner: false, localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, @@ -53,9 +55,7 @@ class EntryWidget extends StatelessWidget { ], supportedLocales: const [Locale('de')], locale: const Locale('de'), - home: HomePage( - showVerification: configuration.showVerification, - ), + initialRoute: initialRoute, routes: routes, ); } else { diff --git a/frontend/lib/intro_slides/intro_screen.dart b/frontend/lib/intro_slides/intro_screen.dart index dad93cab0..2d5aa239c 100644 --- a/frontend/lib/intro_slides/intro_screen.dart +++ b/frontend/lib/intro_slides/intro_screen.dart @@ -82,7 +82,7 @@ class IntroScreenState extends State { if (onFinishedCallback != null) { onFinishedCallback(); } - Navigator.of(context).pop(); + Navigator.of(context).pushReplacementNamed("/"); } @override diff --git a/frontend/lib/map/map/screen_parent_resizer.dart b/frontend/lib/map/map/screen_parent_resizer.dart index 13db1f989..1f7505741 100644 --- a/frontend/lib/map/map/screen_parent_resizer.dart +++ b/frontend/lib/map/map/screen_parent_resizer.dart @@ -31,6 +31,7 @@ class _ScreenParentResizer extends State { final currentOrientation = MediaQuery.of(context).orientation; final isOverDrawingSquare = currentOrientation != _lastBuildOrientation; + if (isOverDrawingSquare) { // Delay setState by 2 frames. If we delay only by one frame, then Flutter is able to optimize this away. WidgetsBinding.instance!.addPostFrameCallback( @@ -42,13 +43,15 @@ class _ScreenParentResizer extends State { ); } - final width = isOverDrawingSquare ? maximum : null; - final height = isOverDrawingSquare ? maximum : null; + final width = isOverDrawingSquare ? maximum : MediaQuery.of(context).size.width; + final height = isOverDrawingSquare ? maximum : MediaQuery.of(context).size.height; return OverflowBox( alignment: Alignment.topLeft, maxHeight: height, maxWidth: width, + minWidth: width, + minHeight: height, child: widget.child, ); }