defaultStyleOf method

  1. @override
ButtonStyle defaultStyleOf(
  1. BuildContext context
)
override

Implementation

@override
ButtonStyle defaultStyleOf(BuildContext context) {
  assert(debugCheckHasFluentTheme(context));
  final theme = FluentTheme.of(context);

  return ButtonStyle(
    backgroundColor: ButtonState.resolveWith((states) {
      if (states.isDisabled) {
        return theme.resources.subtleFillColorDisabled;
      } else if (states.isPressing) {
        return theme.resources.subtleFillColorTertiary;
      } else if (states.isHovering) {
        return theme.resources.subtleFillColorSecondary;
      } else {
        return theme.resources.subtleFillColorTransparent;
      }
    }),
    shape: ButtonState.all(
      RoundedRectangleBorder(borderRadius: BorderRadius.circular(4.0)),
    ),
    padding: ButtonState.all(kDefaultButtonPadding),
    foregroundColor: ButtonState.resolveWith((states) {
      if (states.isDisabled) {
        return theme.resources.controlFillColorDisabled;
      } else if (states.isPressing) {
        return theme.accentColor.tertiaryBrushFor(theme.brightness);
      } else if (states.isHovering) {
        return theme.accentColor.secondaryBrushFor(theme.brightness);
      } else {
        return theme.accentColor.defaultBrushFor(theme.brightness);
      }
    }),
    textStyle: ButtonState.all(const TextStyle(
      fontWeight: FontWeight.w600,
      letterSpacing: 0.5,
    )),
  );
}