Hide top-left home btn when using navrail on editorial view

This commit is contained in:
Shawn 2023-04-27 11:22:16 -06:00
parent c819bcfdef
commit f1be3a4a37
4 changed files with 27 additions and 24 deletions

View File

@ -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.

View File

@ -72,7 +72,7 @@ class _WonderEditorialScreenState extends State<WonderEditorialScreen> {
/// 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<WonderEditorialScreen> {
),
/// 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))
],
],
),
),

View File

@ -47,7 +47,7 @@ class _WonderDetailsScreenState extends State<WonderDetailsScreen>
@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;

View File

@ -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"