diff --git a/lib/logic/app_logic.dart b/lib/logic/app_logic.dart index 35e773d4..ca7349b3 100644 --- a/lib/logic/app_logic.dart +++ b/lib/logic/app_logic.dart @@ -84,6 +84,8 @@ class AppLogic { _updateSystemOrientation(); } + bool shouldUseNavRail(Size size) => size.width > size.height && size.height > 250; + /// Enable landscape, portrait or both. Views can call this method to override the default settings. /// For example, the [FullscreenVideoViewer] always wants to enable both landscape and portrait. /// If a view overrides this, it is responsible for setting it back to [supportedOrientations] when disposed. diff --git a/lib/ui/screens/editorial/editorial_screen.dart b/lib/ui/screens/editorial/editorial_screen.dart index 20f0163c..c3ce16b1 100644 --- a/lib/ui/screens/editorial/editorial_screen.dart +++ b/lib/ui/screens/editorial/editorial_screen.dart @@ -72,7 +72,7 @@ class _WonderEditorialScreenState extends State { /// Attempt to maintain a similar aspect ratio for the image within the app-bar double maxAppBarHeight = min(context.widthPx, $styles.sizes.maxContentWidth1) * 1.2; - + bool showBackBtn = appLogic.shouldUseNavRail(context.mq.size) == false; return PopRouterOnOverScroll( controller: _scroller, child: ColoredBox( @@ -166,17 +166,18 @@ class _WonderEditorialScreenState extends State { ), /// Home Btn - /// TODO: Decide when to show the back btn, probably whenever in tab view? This should be passed down from above somewhere... - // AnimatedBuilder( - // animation: _scroller, - // builder: (_, child) { - // return AnimatedOpacity( - // opacity: _scrollPos.value > 0 ? 0 : 1, - // duration: $styles.times.med, - // child: child, - // ); - // }, - // child: AppHeader(backIcon: AppIcons.north, isTransparent: true)), + if (showBackBtn) ...[ + AnimatedBuilder( + animation: _scroller, + builder: (_, child) { + return AnimatedOpacity( + opacity: _scrollPos.value > 0 ? 0 : 1, + duration: $styles.times.med, + child: child, + ); + }, + child: AppHeader(backIcon: AppIcons.north, isTransparent: true)) + ], ], ), ), diff --git a/lib/ui/screens/wonder_details/wonders_details_screen.dart b/lib/ui/screens/wonder_details/wonders_details_screen.dart index e8863743..b9ce67c8 100644 --- a/lib/ui/screens/wonder_details/wonders_details_screen.dart +++ b/lib/ui/screens/wonder_details/wonders_details_screen.dart @@ -47,7 +47,7 @@ class _WonderDetailsScreenState extends State @override Widget build(BuildContext context) { - _useNavRail = context.isLandscape && context.heightPx > 250; + _useNavRail = appLogic.shouldUseNavRail(context.mq.size); final wonder = wondersLogic.getData(widget.type); int tabIndex = _tabController.index; diff --git a/pubspec.lock b/pubspec.lock index 59970879..b01b33e2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" checked_yaml: dependency: transitive description: @@ -157,10 +157,10 @@ packages: dependency: "direct main" description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.0" convert: dependency: transitive description: @@ -580,10 +580,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.6.5" js_wrapping: dependency: transitive description: @@ -644,10 +644,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.8.0" mime: dependency: transitive description: @@ -700,10 +700,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.8.2" path_parsing: dependency: transitive description: @@ -1270,5 +1270,5 @@ packages: source: hosted version: "2.0.2" sdks: - dart: ">=3.0.0-0 <4.0.0" + dart: ">=2.19.0-0 <3.0.0" flutter: ">=3.7.0-0"