Skip to content

Commit 4af6759

Browse files
committed
create button ✨
1 parent c9c9ace commit 4af6759

File tree

2 files changed

+72
-4
lines changed

2 files changed

+72
-4
lines changed

lib/page/navigation/navigation1/coordinator.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_ui_nice/page/navigation/navigation1/widgets/button.dart';
23
import 'package:flutter_ui_nice/page/navigation/widgets/background_common.dart';
34

45
class NavigationOneCoordinator extends StatefulWidget {
@@ -14,11 +15,13 @@ class _Coordinator extends State<NavigationOneCoordinator> {
1415
}
1516

1617
@override
17-
Widget build(BuildContext context) => BackgroundCommon(
18-
child: Stack(
19-
children: <Widget>[
18+
Widget build(BuildContext context) => Material(
19+
child: BackgroundCommon(
20+
child: Stack(
21+
children: <Widget>[
2022

21-
],
23+
],
24+
),
2225
),
2326
);
2427

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)