iconButtonStyle function

ButtonStyle iconButtonStyle(
  1. Palette sc, {
  2. TextStyle? textStyle,
})

Icon button: transparent background and stateful icon/text colors.

Implementation

ButtonStyle iconButtonStyle(Palette sc, {TextStyle? textStyle}) {
  return ButtonStyle(
    animationDuration: buttonStyleAnimationDuration,
    visualDensity: VisualDensity.compact,
    backgroundColor: widgetPropertyByState(
      normal: () => Colors.transparent,
      hover: () => sc.backgroundHovered,
      splash: () => sc.backgroundSplashed,
    ),
    surfaceTintColor: widgetPropertyByState(
      normal: () => Colors.transparent,
      hover: () => sc.backgroundHovered,
      splash: () => sc.backgroundSplashed,
    ),
    overlayColor: widgetPropertyByState(
      normal: () => Colors.transparent,
      hover: () => sc.backgroundHovered,
      splash: () => sc.backgroundSplashed,
    ),
    foregroundColor: widgetPropertyByState(
      normal: () => sc.fill,
      hover: () => sc.backgroundHoveredFill,
      splash: () => sc.backgroundSplashedFill,
    ),
    iconColor: widgetPropertyByState(
      normal: () => sc.fill,
      hover: () => sc.backgroundHoveredFill,
      splash: () => sc.backgroundSplashedFill,
    ),
    padding: WidgetStatePropertyAll(EdgeInsets.zero),
    textStyle: textStyle != null ? WidgetStatePropertyAll(textStyle) : null,
  );
}