Skip to content

Commit

Permalink
Make sure home is not pushed before the intro slides
Browse files Browse the repository at this point in the history
  • Loading branch information
maxammann committed Jan 25, 2022
1 parent 3ee33c4 commit 8edd4f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions frontend/lib/entry_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ class EntryWidget extends StatelessWidget {

if (settings.firstStart) {
routes.addAll(<String, WidgetBuilder>{
'/intro': (context) => IntroScreen(
'intro': (context) => IntroScreen(
onFinishedCallback: () => settings.setFirstStart(enabled: false),
),
'/': (context) => HomePage(
showVerification: configuration.showVerification,
)
});
initialRoute = '/intro';
initialRoute = 'intro';
}

return MaterialApp(
title: 'Ehrenamtskarte',
theme: lightTheme,
darkTheme: darkTheme,
themeMode: ThemeMode.system,
initialRoute: initialRoute,
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/intro_slides/intro_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class IntroScreenState extends State<IntroScreen> {
if (onFinishedCallback != null) {
onFinishedCallback();
}
Navigator.of(context).pop();
Navigator.of(context).pushReplacementNamed("/");
}

@override
Expand Down
7 changes: 5 additions & 2 deletions frontend/lib/map/map/screen_parent_resizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class _ScreenParentResizer extends State<ScreenParentResizer> {

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(
Expand All @@ -42,13 +43,15 @@ class _ScreenParentResizer extends State<ScreenParentResizer> {
);
}

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,
);
}
Expand Down

0 comments on commit 8edd4f9

Please sign in to comment.