defaultStyleOf method

ButtonStyle defaultStyleOf(
  1. BuildContext context
)

Default StateButton style

Implementation

ButtonStyle defaultStyleOf(BuildContext context) {
  final ThemeData theme = Theme.of(context);
  final ColorScheme colorScheme = theme.colorScheme;

  final EdgeInsetsGeometry scaledPadding = ButtonStyleButton.scaledPadding(
    const EdgeInsets.symmetric(horizontal: 16),
    const EdgeInsets.symmetric(horizontal: 8),
    const EdgeInsets.symmetric(horizontal: 4),
    MediaQuery.maybeOf(context)?.textScaleFactor ?? 1,
  );

  return styleFrom(
    primary: colorScheme.primary,
    onPrimary: colorScheme.onPrimary,
    onSurface: colorScheme.onSurface,
    fail: colorScheme.primary,
    onFail: colorScheme.onPrimary,
    success: colorScheme.primary,
    onSuccess: colorScheme.onPrimary,
    shadowColor: theme.shadowColor,
    elevation: 2,
    textStyle: theme.textTheme.button,
    padding: scaledPadding,
    minimumSize: const Size(64, 36),
    maximumSize: Size.infinite,
    side: null,
    shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(4))),
    enabledMouseCursor: SystemMouseCursors.click,
    disabledMouseCursor: SystemMouseCursors.forbidden,
    visualDensity: theme.visualDensity,
    tapTargetSize: theme.materialTapTargetSize,
    animationDuration: kThemeChangeDuration,
    enableFeedback: true,
    alignment: Alignment.center,
    splashFactory: InkRipple.splashFactory,
  );
}