-
Notifications
You must be signed in to change notification settings - Fork 6
/
drawer.dart
59 lines (56 loc) · 1.71 KB
/
drawer.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
//It will navigate to the page and have the focused color in the tab where it is present......for flutter web...
import 'package:flutter/material.dart';
import 'package:practise_widgets/drawerItems/Dart.dart';
import 'package:practise_widgets/drawerItems/flutter.dart';
import 'package:practise_widgets/drawerItems/ios.dart';
class CustomDrawer extends StatefulWidget {
static final List<String> _listViewData = [
"Flutter",
"Ios",
"Dart",
"Android",
"Laravel",
"Php",
"Html",
];
final List<Widget> _children = [
Flutter(),
IOS(),
Dart(),
];
static int _currentSelected = 0;
@override
_CustomDrawerState createState() => _CustomDrawerState();
}
class _CustomDrawerState extends State<CustomDrawer> {
@override
Widget build(BuildContext context) {
return Drawer(
child: Container(
child: ListView.builder(
padding: EdgeInsets.all(10.0),
itemCount: CustomDrawer._listViewData.length,
itemBuilder: (context, index) {
return Container(
color: CustomDrawer._currentSelected == index
? Colors.deepPurple
: Colors.white,
child: ListTile(
title: Text(CustomDrawer._listViewData[index]),
onTap: () {
setState(() {
CustomDrawer._currentSelected = index;
});
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => widget._children[index]));
},
),
);
},
),
),
);
}
}