This commit is contained in:
Simon Ding
2024-07-16 22:50:53 +08:00
parent fd8a74ce96
commit 42dc3d06eb

View File

@@ -20,56 +20,48 @@ class _NavDrawerState extends State<NavDrawer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return NavigationRail(
mainAxisAlignment: MainAxisAlignment.start, selectedIndex: _counter,
crossAxisAlignment: CrossAxisAlignment.start, onDestinationSelected: (value) {
children: [ setState(() {
Flexible( _counter = value;
child: NavigationRail( });
selectedIndex: _counter, if (value == 0) {
onDestinationSelected: (value) { context.go(MovieWatchlistPage.route);
setState(() { } else if (value == 1) {
_counter = value; context.go(TvWatchlistPage.route);
}); } else if (value == 2) {
if (value == 0) { context.go(SearchPage.route);
context.go(MovieWatchlistPage.route); } else if (value == 3) {
} else if (value == 1) { context.go(ActivityPage.route);
context.go(TvWatchlistPage.route); } else if (value == 4) {
} else if (value == 2) { context.go(SystemSettingsPage.route);
context.go(SearchPage.route); }
} else if (value == 3) { },
context.go(ActivityPage.route); extended: MediaQuery.of(context).size.width >= 850,
} else if (value == 4) { unselectedIconTheme: const IconThemeData(color: Colors.grey),
context.go(SystemSettingsPage.route); destinations: const <NavigationRailDestination>[
} NavigationRailDestination(
}, icon: Icon(Icons.movie),
extended: MediaQuery.of(context).size.width >= 850, label: Text('电影'),
unselectedIconTheme: const IconThemeData(color: Colors.grey), ),
destinations: const <NavigationRailDestination>[ NavigationRailDestination(
NavigationRailDestination( icon: Icon(Icons.live_tv),
icon: Icon(Icons.movie), label: Text('电视剧'),
label: Text('电影'), ),
), NavigationRailDestination(
NavigationRailDestination( icon: Icon(Icons.search),
icon: Icon(Icons.live_tv), label: Text('搜索'),
label: Text('电视剧'), ),
), NavigationRailDestination(
NavigationRailDestination( icon: Icon(Icons.download),
icon: Icon(Icons.search), label: Text('活动'),
label: Text('搜索'), ),
), NavigationRailDestination(
NavigationRailDestination( icon: Icon(Icons.settings),
icon: Icon(Icons.download), label: Text('设置'),
label: Text('活动'), ),
), ],
NavigationRailDestination( );
icon: Icon(Icons.settings),
label: Text('设置'),
),
],
//groupAlignment: -1,
minWidth: 56,
))
]);
} }
} }