-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
173 lines (163 loc) · 4.55 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import 'package:flutter/material.dart';
import 'package:kuburazizam/home.dart';
import 'package:kuburazizam/icons.dart';
import 'package:kuburazizam/wallpapers.dart';
import 'package:kuburazizam/apply.dart';
import 'package:kuburazizam/request.dart';
var h="Icon Pack Name";
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: MyNavigationBar (),
);
}
}
class MyNavigationBar extends StatefulWidget {
MyNavigationBar ({Key key}) : super(key: key);
@override
_MyNavigationBarState createState() => _MyNavigationBarState();
}
class _MyNavigationBarState extends State<MyNavigationBar > {
int _selectedIndex = 0;
final List<Widget> _widgetOptions = <Widget>[
Home(),
IconsX(),
Wallpapers(),
Apply(),
Request(),
];
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
switch (index) {
case 0:
h = "Icon Pack Name";
break;
case 1:
h = "Icons";
break;
case 2:
h = "Wallpapers";
break;
case 3:
h = "Apply";
break;
case 4:
h = "Request";
break;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text('$h', style: TextStyle(color:Colors.white, fontFamily: 'Poppins', fontWeight: FontWeight.bold)),
backgroundColor: Colors.black,
centerTitle: true,
actions:
[
PopupMenuButton<MenuItem>(
color: Colors.grey[900],
onSelected: (item) => onSelected(context, item),
itemBuilder: (context) => [
...MenuItems.itemsFirst.map(buildItem).toList(),
],
),
],
),
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Colors.grey[900],
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home,
),
title: Text(
'Home',
style: TextStyle(
fontFamily: 'Poppins',
)),),
BottomNavigationBarItem(
icon: Icon(Icons.square_foot_sharp),
title: Text(
'Icons',
style: TextStyle(
fontFamily: 'Poppins',
)),
),
BottomNavigationBarItem(
icon: Icon(Icons.wallpaper),
title: Text(
'Wallpapers',
style: TextStyle(
fontFamily: 'Poppins',
)), ),
BottomNavigationBarItem(
icon: Icon(Icons.arrow_circle_up,
),
title: Text(
'Apply',
style: TextStyle(
fontFamily: 'Poppins',
)), ),
BottomNavigationBarItem(
icon: Icon(Icons.feedback),
title: Text(
'Request',
style: TextStyle(
fontFamily: 'Poppins',
)), ),
],
type: BottomNavigationBarType.fixed,
currentIndex: _selectedIndex,
selectedItemColor : Colors.greenAccent,
unselectedItemColor: Colors.white,
iconSize: 30,
onTap: _onItemTapped,
elevation: 13
),
);
}
}
class MenuItem {
final String text;
const MenuItem({
this.text,
});
}
class MenuItems {
static const List<MenuItem> itemsFirst = [
itemSettings,
itemContact,
];
static const itemSettings = MenuItem(
text: "Settings",);
static const itemContact=MenuItem(
text: 'Contact us',
);
}
PopupMenuItem<MenuItem> buildItem(MenuItem item) =>
PopupMenuItem<MenuItem>(
value: item,
child: Row(
children: [
const SizedBox(width: 12),
Text(item.text),
],
),
);
void onSelected(BuildContext context, MenuItem item) {
switch (item) {
case MenuItems.itemSettings:
Navigator.of(context).push(
MaterialPageRoute(builder: (context)=>Settings()),
);
break;
}
}