Skip to content

Commit e6c3f5c

Browse files
home: Replace IconButton with Material, InkWell and Icon widgets
Replaced Iconbutton with Material and InkWell widgets latter ensures InkSplash effect on icon as well as text label in the upcomming commit
1 parent 586c667 commit e6c3f5c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

lib/widgets/home.dart

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,26 @@ 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(
257+
child: Material(
258+
type: MaterialType.transparency,
259+
child: InkWell(
265260
// TODO(#417): Disable splash effects for all buttons globally.
261+
borderRadius: BorderRadius.all(Radius.circular(4)),
266262
splashFactory: NoSplash.splashFactory,
267263
highlightColor: designVariables.navigationButtonBg,
268-
shape: const RoundedRectangleBorder(
269-
borderRadius: BorderRadius.all(Radius.circular(4))),
270-
).copyWith(foregroundColor: iconColor)));
264+
onTap: onPressed,
265+
child: Column(
266+
mainAxisSize: MainAxisSize.min,
267+
children: [
268+
SizedBox(height: 34,
269+
child: Center(
270+
child: Icon(icon, size: 24, color: color,))),
271+
]))));
271272
}
272273
}
273274

0 commit comments

Comments
 (0)