1
+ import 'package:flutter/material.dart' ;
2
+ import 'package:flutter_ui_nice/const/color_const.dart' ;
3
+
4
+ class Button {
5
+
6
+ static Widget home () => _buildButton ("HOME" , Icons .home);
7
+
8
+ static Widget chat ({int notification}) => _buildButton ("CHAT" , Icons .chat, notification: notification);
9
+
10
+ static Widget feed () => _buildButton ("FEED" , Icons .rss_feed);
11
+
12
+ static Widget profile () => _buildButton ("PROFILE" , Icons .person);
13
+
14
+ static Widget settings () => _buildButton ("SETTINGS" , Icons .settings);
15
+
16
+ static Widget _buildButton (String title, IconData icon, {int notification}) {
17
+ if (notification != null ) {
18
+ return Container (
19
+ child: Stack (
20
+ children: < Widget > [
21
+ Container (
22
+ decoration: BoxDecoration (
23
+ borderRadius: BorderRadius .circular (50.0 ),
24
+ color: RED
25
+ ),
26
+ ),
27
+ _button (title, icon)
28
+ ],
29
+ ),
30
+ );
31
+ } else {
32
+ return _button (title, icon);
33
+ }
34
+ }
35
+
36
+ static Widget _button (String title, IconData icon) => Container (
37
+ height: 50.0 ,
38
+ width: 180.0 ,
39
+ decoration: BoxDecoration (
40
+ borderRadius: BorderRadius .circular (20.0 ),
41
+ color: GREEN
42
+ ),
43
+ child: InkResponse (
44
+ onTap: () => debugPrint ('Pressed' ),
45
+ splashColor: BLUE_LIGHT ,
46
+ borderRadius: BorderRadius .circular (100.0 ),
47
+ child: Center (
48
+ child: Row (
49
+ mainAxisAlignment: MainAxisAlignment .center,
50
+ children: < Widget > [
51
+ Text (
52
+ title,
53
+ style: TextStyle (
54
+ fontSize: 18.0 ,
55
+ color: TEXT_BLACK ,
56
+ ),
57
+ ),
58
+ SizedBox (width: 5.0 ,),
59
+ Icon (icon)
60
+ ],
61
+ ),
62
+ ),
63
+ ),
64
+ );
65
+ }
0 commit comments