mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
add router and welcome page
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class NavDrawer extends StatelessWidget {
|
||||
class NavDrawer extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _NavDrawerState();
|
||||
}
|
||||
}
|
||||
|
||||
class _NavDrawerState extends State<NavDrawer> {
|
||||
var _counter = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 300),
|
||||
constraints: const BoxConstraints(maxWidth: 220),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -14,40 +22,37 @@ class NavDrawer extends StatelessWidget {
|
||||
Flexible(
|
||||
child: NavigationRail(
|
||||
selectedIndex: _counter,
|
||||
onDestinationSelected: (value) {},
|
||||
onDestinationSelected: (value) {
|
||||
setState(() {
|
||||
_counter = value;
|
||||
});
|
||||
if (value == 0) {
|
||||
context.go('/');
|
||||
} else if (value == 1) {
|
||||
context.go("/search");
|
||||
}
|
||||
},
|
||||
extended: MediaQuery.of(context).size.width >= 850,
|
||||
unselectedIconTheme: const IconThemeData(color: Colors.grey),
|
||||
destinations: const <NavigationRailDestination>[
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.search),
|
||||
label: Text('Buscar '),
|
||||
icon: Icon(Icons.live_tv),
|
||||
label: Text(' 电视剧'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.engineering),
|
||||
label: Text('Ingeniería '),
|
||||
icon: Icon(Icons.download),
|
||||
label: Text('活动'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.business),
|
||||
label: Text('Sociales '),
|
||||
icon: Icon(Icons.settings),
|
||||
label: Text('设置'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.local_hospital),
|
||||
label: Text('Salud'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.school),
|
||||
label: Text('Iniciales'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.design_services),
|
||||
label: Text('Talleres y Extracurriculares'),
|
||||
icon: Icon(Icons.computer),
|
||||
label: Text('系统'),
|
||||
),
|
||||
],
|
||||
selectedLabelTextStyle:
|
||||
TextStyle(color: Colors.lightBlue, fontSize: 20),
|
||||
unselectedLabelTextStyle:
|
||||
TextStyle(color: Colors.grey, fontSize: 18),
|
||||
groupAlignment: -1,
|
||||
//groupAlignment: -1,
|
||||
minWidth: 56,
|
||||
))
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user