Skip to content

Commit da4a8fa

Browse files
home: Replace IconButton with GestureDectector over IconButton
To increase the tap area for upcomming text label below the icon. color property was changed from type Widget to Colors for better interoperability between both Icon and Text Widget.
1 parent 8aeeb71 commit da4a8fa

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

lib/widgets/home.dart

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,21 @@ class _NavigationBarButton extends StatelessWidget {
249249
Widget build(BuildContext context) {
250250
final designVariables = DesignVariables.of(context);
251251

252-
final iconColor = WidgetStateColor.fromMap({
253-
WidgetState.pressed: designVariables.iconSelected,
254-
~WidgetState.pressed: selected ? designVariables.iconSelected
255-
: designVariables.icon,
256-
});
252+
final color = selected ? designVariables.iconSelected : designVariables.icon;
257253

258254
return AnimatedScaleOnTap(
259255
scaleEnd: 0.875,
260256
duration: const Duration(milliseconds: 100),
261-
child: IconButton(
262-
icon: Icon(icon, size: 24),
263-
onPressed: onPressed,
264-
style: IconButton.styleFrom(
265-
// TODO(#417): Disable splash effects for all buttons globally.
266-
splashFactory: NoSplash.splashFactory,
267-
highlightColor: designVariables.navigationButtonBg,
268-
shape: const RoundedRectangleBorder(
269-
borderRadius: BorderRadius.all(Radius.circular(4))),
270-
).copyWith(foregroundColor: iconColor)));
257+
child: GestureDetector(
258+
behavior: HitTestBehavior.opaque,
259+
onTap: onPressed,
260+
child: Column(
261+
mainAxisSize: MainAxisSize.min,
262+
children: [
263+
SizedBox(height: 34,
264+
child: Center(
265+
child: Icon(icon, size: 24, color: color,))),
266+
])));
271267
}
272268
}
273269

0 commit comments

Comments
 (0)