-
-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy pathmobile_dashboard.dart
224 lines (202 loc) · 5.2 KB
/
mobile_dashboard.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp( MobileApp());
class MobileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Mobile Dashboard",
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final Color accentColor = Color(0XFFFA2B0F);
List<ItemModel> items = [
ItemModel("Tasks", 12, 1830),
ItemModel("Analytics", 4, 883),
ItemModel("Works", 2, 326),
];
@override
void initState(){
super.initState();
SystemChrome.setEnabledSystemUIOverlays([]);
}
Widget _buildTitle() {
return Text("Home",
style: TextStyle(
fontSize: 40,
color: Colors.black,
fontWeight: FontWeight.bold
),
);
}
Text _buildText(String title){
return Text(title,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold
),
);
}
IconButton _buildButton(IconData icon){
return IconButton(
onPressed: (){},
icon: Icon(icon, color: Colors.white,),
);
}
Widget _buildBottomCardChildren(){
return Column(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
_buildText("All"),
Spacer(),
_buildText("Done")
],
),
Container(height: 24,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
_buildButton(Icons.radio_button_checked),
_buildButton(Icons.home),
_buildButton(Icons.settings),
],
)
],
);
}
Widget _buildBottomCard(double width, double height){
return Container(
width: width,
height: height/3,
padding: EdgeInsets.fromLTRB(16, 0, 16, 16),
decoration: BoxDecoration(
color: accentColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(16),
topLeft: Radius.circular(16)
)
),
child: _buildBottomCardChildren(),
);
}
Widget _buildItemCardChild(ItemModel item){
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(item.title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold
),
),
Text(item.numOne.toString(), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold
),
)
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.pie_chart, color: accentColor,)
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
onPressed: () {},
icon: Icon(Icons.menu, color: Colors.grey,),
),
Text(item.numTwo.toString(), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
],
)
],
);
}
Widget _buildItemCard(ItemModel item){
return Container(
width: 120,
height: 145,
padding: EdgeInsets.fromLTRB(16, 16, 16, 16),
margin: EdgeInsets.only(left: 32, right: 32, top: 2, bottom: 2),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(16)),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 1
)
]
),
child: _buildItemCardChild( item),
);
}
Widget _buildCardsList(){
return ListView.builder(
itemCount: items.length,
itemBuilder: (context, index){
var item = items.elementAt(index);
return _buildItemCard( item);
},
);
}
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
final height = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.grey[300],
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.grey[300],
title: _buildTitle(),
actions: <Widget>[
IconButton(
onPressed: (){},
icon: Icon(Icons.notifications,
color: Colors.blueGrey,
),
)
],
),
body: Container(
margin: EdgeInsets.only(top: 16),
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: _buildBottomCard(width, height)
),
_buildCardsList(),
],
),
),
);
}
}
class ItemModel{
final String title;
final int numOne;
final int numTwo;
ItemModel(this.title, this.numOne, this.numTwo);
}