fillButtonStyle function
ButtonStyle
fillButtonStyle(})
Implementation
ButtonStyle fillButtonStyle(
Palette sc, {
bool showBorder = true,
TextStyle? textStyle,
double borderWidth = 2,
OutlinedBorder? shape,
required double scale,
}) {
return ButtonStyle(
animationDuration: buttonStyleAnimationDuration,
visualDensity: VisualDensity.compact,
backgroundColor: widgetPropertyByState(
normal: () => sc.fill,
hover: () => sc.fillHovered,
splash: () => sc.fillSplashed,
),
surfaceTintColor: widgetPropertyByState(
normal: () => sc.fill,
hover: () => sc.fillHovered,
splash: () => sc.fillSplashed,
),
overlayColor: const WidgetStatePropertyAll(Colors.transparent),
foregroundColor: widgetPropertyByState(
normal: () => sc.fillText,
hover: () => sc.fillHoveredText,
splash: () => sc.fillSplashedText,
),
iconColor: widgetPropertyByState(
normal: () => sc.fillIcon,
hover: () => sc.fillHoveredIcon,
splash: () => sc.fillSplashedIcon,
),
textStyle: textStyle != null ? WidgetStatePropertyAll(textStyle) : null,
minimumSize: WidgetStatePropertyAll(minimumSizeForScale(scale)),
maximumSize: WidgetStatePropertyAll(maximumSize),
padding: WidgetStatePropertyAll(padding),
shape: shape == null ? null : WidgetStatePropertyAll(shape),
side: showBorder
? WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.pressed) ||
states.contains(WidgetState.dragged)) {
return BorderSide(
color: sc.fillSplashedBorder,
width: borderWidth,
);
}
if (states.contains(WidgetState.hovered) ||
states.contains(WidgetState.focused) ||
states.contains(WidgetState.selected)) {
return BorderSide(
color: sc.fillHoveredBorder,
width: borderWidth,
);
}
return BorderSide(color: sc.fillBorder, width: borderWidth);
})
: null,
);
}