-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
117 lines (113 loc) · 3.43 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primaryColor: Color(0xFFC41A3B),
primaryColorLight: Color(0xFFFBE0E6),
accentColor: Color(0xFF1B1F32),
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String title = 'Navigation Rail';
int _selectedIndex = 1;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
centerTitle: true,
elevation: 0.0,
),
body: Row(
children: <Widget>[
NavigationRail(
leading: FlutterLogo(),
trailing: IconButton(
onPressed: () {},
icon: Icon(Icons.lock),
),
elevation: 10.0,
backgroundColor: Color(0xFFC41A3B),
// minWidth: 100.0,
minExtendedWidth: 150.0,
extended: true,
selectedIconTheme: IconThemeData(
color: Color(0xFFFBE0E6),
),
unselectedIconTheme: IconThemeData(
color: Color(0xFF1B1F32),
),
selectedLabelTextStyle: TextStyle(
color: Color(0xFFFBE0E6),
),
unselectedLabelTextStyle: TextStyle(
color: Color(0xFF1B1F32),
),
selectedIndex: _selectedIndex,
onDestinationSelected: (int index) {
setState(() {
_selectedIndex = index;
});
},
labelType: NavigationRailLabelType.none, //by default none
// groupAlignment: 0.0, // by default -1.0
destinations: [
NavigationRailDestination(
icon: Icon(Icons.home),
selectedIcon: Icon(Icons.home),
label: Text('Home'),
),
NavigationRailDestination(
icon: Icon(Icons.category),
selectedIcon: Icon(Icons.category),
label: Text('Category'),
),
NavigationRailDestination(
icon: Icon(Icons.search),
selectedIcon: Icon(Icons.search),
label: Text('Search'),
),
NavigationRailDestination(
icon: Icon(Icons.shopping_cart),
selectedIcon: Icon(Icons.add_shopping_cart),
label: Text('Cart'),
),
NavigationRailDestination(
icon: Icon(Icons.person_outline),
selectedIcon: Icon(Icons.person),
label: Text('Profile'),
),
],
),
VerticalDivider(
width: 2.0,
thickness: 2.0,
color: Color(0xFFC41A3B),
),
Expanded(
child: Center(
child: Text(
'Page ${_selectedIndex + 1}',
style: TextStyle(fontSize: 42.0),
),
),
),
],
),
);
}
}