ModeIconButton constructor
ModeIconButton({
- Key? key,
- required VoidCallback onPressed,
- VoidCallback? onLongPress,
- required Widget icon,
Implementation
ModeIconButton({
Key? key,
required VoidCallback onPressed,
VoidCallback? onLongPress,
required Widget icon,
}) : super(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.focused) ||
states.contains(MaterialState.pressed)) {
return WidgetStyleConstants.modesButtonPressedColor;
}
return WidgetStyleConstants.modesButtonUnpressedColor;
},
),
shape: MaterialStateProperty.resolveWith<OutlinedBorder>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.focused) ||
states.contains(MaterialState.pressed)) {
return RingBorder(
side: BorderSide(
color: WidgetStyleConstants.modesButtonUnpressedColor,
width: 2.0),
);
}
return CircleBorder(side: BorderSide());
}),
minimumSize: MaterialStateProperty.all<Size>(Size.square(48.0)),
),
child: ModeButtonIconChild(icon: icon),
);