Skip to content

Commit de2d20c

Browse files
committed
Tambahkan label pada menu bottom navigation bar
1 parent 1ce4eb9 commit de2d20c

File tree

2 files changed

+52
-44
lines changed

2 files changed

+52
-44
lines changed

lib/main.dart

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,51 +71,29 @@ class MyHomePage extends StatelessWidget {
7171
Align(
7272
alignment: Alignment.bottomCenter,
7373
child: Padding(
74-
padding: EdgeInsets.only(bottom: 100.w),
74+
padding: EdgeInsets.only(bottom: 100.w + ScreenUtil.bottomBarHeight),
7575
child: Row(
7676
mainAxisAlignment: MainAxisAlignment.spaceAround,
7777
children: <Widget>[
78-
Container(
79-
decoration: BoxDecoration(
80-
color: Colors.white.withOpacity(0.1),
81-
shape: BoxShape.circle,
82-
),
83-
width: 150.w,
84-
height: 150.w,
85-
child: Icon(
86-
Icons.bubble_chart,
87-
color: Colors.white.withOpacity(0.5),
88-
size: ScreenUtil().setWidth(96),
89-
),
90-
),
91-
Container(
92-
decoration: BoxDecoration(
93-
color: Colors.white,
94-
shape: BoxShape.circle,
95-
border: Border.all(
96-
color: Colors.grey[800],
97-
width: 2,
98-
),
99-
),
100-
width: 150.w,
101-
height: 150.w,
102-
child: Icon(
103-
Icons.image,
104-
color: Colors.grey[900],
105-
),
106-
),
107-
Container(
108-
decoration: BoxDecoration(
109-
color: Colors.white.withOpacity(0.1),
110-
shape: BoxShape.circle,
111-
),
112-
width: 150.w,
113-
height: 150.w,
114-
child: Icon(
115-
Icons.brightness_3,
116-
color: Colors.white.withOpacity(0.5),
117-
),
118-
),
78+
_buildWidgetCircleMenu(Icons.bubble_chart, false),
79+
_buildWidgetCircleMenu(Icons.accessibility_new, true),
80+
_buildWidgetCircleMenu(Icons.brightness_3, false),
81+
],
82+
),
83+
),
84+
),
85+
Align(
86+
alignment: Alignment.bottomCenter,
87+
child: Padding(
88+
padding: EdgeInsets.only(
89+
bottom: ScreenUtil.bottomBarHeight > 0 ? ScreenUtil.bottomBarHeight : 24.w,
90+
),
91+
child: Row(
92+
mainAxisAlignment: MainAxisAlignment.spaceAround,
93+
children: <Widget>[
94+
_buildWidgetTextMenuCircle('Focus', false),
95+
_buildWidgetTextMenuCircle('Relax', true),
96+
_buildWidgetTextMenuCircle('Sleep', false),
11997
],
12098
),
12199
),
@@ -126,6 +104,36 @@ class MyHomePage extends StatelessWidget {
126104
);
127105
}
128106

107+
Widget _buildWidgetTextMenuCircle(String text, bool isActive) {
108+
return Text(
109+
text,
110+
style: TextStyle(
111+
color: isActive ? Colors.white : Colors.grey[800],
112+
),
113+
);
114+
}
115+
116+
Widget _buildWidgetCircleMenu(IconData iconData, bool isActive) {
117+
return Container(
118+
decoration: BoxDecoration(
119+
color: isActive ? Colors.white : Colors.white.withOpacity(0.1),
120+
shape: BoxShape.circle,
121+
border: isActive
122+
? Border.all(
123+
color: Colors.grey[800],
124+
width: 2,
125+
)
126+
: null,
127+
),
128+
width: 150.w,
129+
height: 150.w,
130+
child: Icon(
131+
iconData,
132+
color: isActive ? Colors.grey[900] : Colors.white.withOpacity(0.5),
133+
),
134+
);
135+
}
136+
129137
Widget _buildWidgetColumnText() {
130138
return Center(
131139
child: Column(

lib/wavy/wavy_bottom_navigation_bar.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class WavyBottomNavigationBar extends StatelessWidget {
88
ScreenUtil.init(context);
99
return ClipPath(
1010
child: Container(
11-
color: Colors.white,
12-
height: 180.w,
11+
color: Colors.black.withOpacity(0.5),
12+
height: 180.w + ScreenUtil.bottomBarHeight,
1313
),
1414
clipper: WavyBottomNavigationBarClipper(),
1515
);

0 commit comments

Comments
 (0)