ModeIconButton constructor

ModeIconButton({
  1. Key? key,
  2. required VoidCallback onPressed,
  3. VoidCallback? onLongPress,
  4. 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),
      );