From e734b5cec74a4525d122c0fefff3b464525689ec Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 7 Oct 2022 11:53:52 -0600 Subject: [PATCH] Center align home menu, cap width of btns according to vertical space --- lib/ui/screens/home_menu/home_menu.dart | 32 +++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/ui/screens/home_menu/home_menu.dart b/lib/ui/screens/home_menu/home_menu.dart index 138e0694..46558965 100644 --- a/lib/ui/screens/home_menu/home_menu.dart +++ b/lib/ui/screens/home_menu/home_menu.dart @@ -40,6 +40,7 @@ class HomeMenu extends StatelessWidget { @override Widget build(BuildContext context) { + final double gridWidth = (context.heightPx / 2).clamp(200, 450); return Stack( children: [ /// Backdrop / Underlay @@ -73,18 +74,25 @@ class HomeMenu extends StatelessWidget { child: SafeArea( child: Padding( padding: EdgeInsets.symmetric(horizontal: $styles.insets.lg), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Spacer(flex: 3), - _buildIconGrid(context) - .animate() - .fade(duration: $styles.times.fast) - .scale(begin: .8, curve: Curves.easeOut), - Spacer(flex: 2), - _buildBottomBtns(context), - Gap($styles.insets.xl), - ], + child: Center( + child: SizedBox( + width: gridWidth, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Gap($styles.insets.md), + Spacer(), + _buildIconGrid(context) + .animate() + .fade(duration: $styles.times.fast) + .scale(begin: .8, curve: Curves.easeOut), + Gap($styles.insets.lg), + _buildBottomBtns(context), + Spacer(), + Gap($styles.insets.md), + ], + ), + ), ), ), ),