From cf77d2bf260273862d793639303b21e802b1be1b Mon Sep 17 00:00:00 2001 From: Simon Ding Date: Tue, 16 Jul 2024 15:35:42 +0800 Subject: [PATCH] feat: main screen use flex layouy --- ui/lib/main.dart | 9 ++++++--- ui/lib/navdrawer.dart | 10 ++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ui/lib/main.dart b/ui/lib/main.dart index d8ecc20..a0a7818 100644 --- a/ui/lib/main.dart +++ b/ui/lib/main.dart @@ -67,10 +67,13 @@ class MyApp extends StatelessWidget { body: Center( // Center is a layout widget. It takes a single child and positions it // in the middle of the parent. - child: Row(children: [ - const NavDrawer(), + child: Flex(direction: Axis.horizontal, children: [ + const Flexible( + flex: 1, + child: NavDrawer(), + ), const VerticalDivider(thickness: 1, width: 1), - Expanded(child: child) + Flexible(flex: 7, child: child) ]))), ); }, diff --git a/ui/lib/navdrawer.dart b/ui/lib/navdrawer.dart index de95b35..cedabf0 100644 --- a/ui/lib/navdrawer.dart +++ b/ui/lib/navdrawer.dart @@ -20,9 +20,7 @@ class _NavDrawerState extends State { @override Widget build(BuildContext context) { - return ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 220), - child: Row( + return Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -68,14 +66,10 @@ class _NavDrawerState extends State { icon: Icon(Icons.settings), label: Text('设置'), ), - NavigationRailDestination( - icon: Icon(Icons.computer), - label: Text('系统'), - ), ], //groupAlignment: -1, minWidth: 56, )) - ])); + ]); } }