@@ -86,35 +86,43 @@ class _HomePageState extends State<HomePage> {
86
86
87
87
@override
88
88
Widget build (BuildContext context) {
89
+ final zulipLocalizations = ZulipLocalizations .of (context);
90
+
89
91
const pageBodies = [
90
92
(_HomePageTab .inbox, InboxPageBody ()),
91
93
(_HomePageTab .channels, SubscriptionListPageBody ()),
92
94
// TODO(#1094): Users
93
95
(_HomePageTab .directMessages, RecentDmConversationsPageBody ()),
94
96
];
95
97
96
- _NavigationBarButton button (_HomePageTab tab, IconData icon) {
98
+ _NavigationBarButton button (_HomePageTab tab, IconData icon, String label ) {
97
99
return _NavigationBarButton (icon: icon,
98
100
selected: _tab.value == tab,
99
101
onPressed: () {
100
102
_tab.value = tab;
101
- });
103
+ },
104
+ label: label);
102
105
}
103
106
104
107
// TODO(a11y): add tooltips for these buttons
105
108
final navigationBarButtons = [
106
- button (_HomePageTab .inbox, ZulipIcons .inbox),
109
+ button (_HomePageTab .inbox, ZulipIcons .inbox,
110
+ zulipLocalizations.inboxPageTitle),
107
111
_NavigationBarButton ( icon: ZulipIcons .message_feed,
108
112
selected: false ,
109
113
onPressed: () => Navigator .push (context,
110
114
MessageListPage .buildRoute (context: context,
111
- narrow: const CombinedFeedNarrow ()))),
112
- button (_HomePageTab .channels, ZulipIcons .hash_italic),
115
+ narrow: const CombinedFeedNarrow ())),
116
+ label: zulipLocalizations.navBarFeedLabel),
117
+ button (_HomePageTab .channels, ZulipIcons .hash_italic,
118
+ zulipLocalizations.channelsPageTitle),
113
119
// TODO(#1094): Users
114
- button (_HomePageTab .directMessages, ZulipIcons .two_person),
120
+ button (_HomePageTab .directMessages, ZulipIcons .two_person,
121
+ zulipLocalizations.navBarDmLabel),
115
122
_NavigationBarButton ( icon: ZulipIcons .menu,
116
123
selected: false ,
117
- onPressed: () => _showMainMenu (context, tabNotifier: _tab)),
124
+ onPressed: () => _showMainMenu (context, tabNotifier: _tab),
125
+ label: zulipLocalizations.navBarMenuLabel),
118
126
];
119
127
120
128
final designVariables = DesignVariables .of (context);
@@ -134,7 +142,8 @@ class _HomePageState extends State<HomePage> {
134
142
border: Border (top: BorderSide (color: designVariables.borderBar)),
135
143
color: designVariables.bgBotBar),
136
144
child: SafeArea (
137
- child: SizedBox (height: 48 ,
145
+ child: SizedBox (
146
+ height: 62 ,
138
147
child: Center (
139
148
child: ConstrainedBox (
140
149
// TODO(design): determine a suitable max width for bottom nav bar
@@ -231,35 +240,46 @@ class _NavigationBarButton extends StatelessWidget {
231
240
required this .icon,
232
241
required this .selected,
233
242
required this .onPressed,
243
+ required this .label,
234
244
});
235
245
236
246
final IconData icon;
237
247
final bool selected;
238
248
final void Function () onPressed;
249
+ final String label;
239
250
240
251
@override
241
252
Widget build (BuildContext context) {
242
253
final designVariables = DesignVariables .of (context);
243
254
244
- final iconColor = WidgetStateColor .fromMap ({
245
- WidgetState .pressed: designVariables.iconSelected,
246
- ~ WidgetState .pressed: selected ? designVariables.iconSelected
247
- : designVariables.icon,
248
- });
255
+ final color = selected ? designVariables.iconSelected : designVariables.icon;
249
256
250
257
return AnimatedScaleOnTap (
251
258
scaleEnd: 0.875 ,
252
259
duration: const Duration (milliseconds: 100 ),
253
- child: IconButton (
254
- icon: Icon (icon, size: 24 ),
255
- onPressed: onPressed,
256
- style: IconButton .styleFrom (
257
- // TODO(#417): Disable splash effects for all buttons globally.
258
- splashFactory: NoSplash .splashFactory,
259
- highlightColor: designVariables.navigationButtonBg,
260
- shape: const RoundedRectangleBorder (
261
- borderRadius: BorderRadius .all (Radius .circular (4 ))),
262
- ).copyWith (foregroundColor: iconColor)));
260
+ child: GestureDetector (
261
+ behavior: HitTestBehavior .opaque,
262
+ onTap: onPressed,
263
+ child: Column (
264
+ children: [
265
+ SizedBox (
266
+ height: 34 ,
267
+ child: Center (
268
+ child: Icon (icon, size: 24 , color: color,)),
269
+ ),
270
+ Expanded (
271
+ child: Text (
272
+ label,
273
+ style: TextStyle (
274
+ fontSize: 12 ,
275
+ color: color,
276
+ height: 1.0 ,),
277
+ textAlign: TextAlign .center,
278
+ maxLines: 2 ,
279
+ overflow: TextOverflow .ellipsis),
280
+ )
281
+ ]),
282
+ ));
263
283
}
264
284
}
265
285
0 commit comments