shrunkenButtonsThemeData property

ThemeData shrunkenButtonsThemeData

Theme data used to create compact buttons.

Should not be used often as buttons typically should not be too small.

Implementation

ThemeData get shrunkenButtonsThemeData {
  MaterialStateProperty<EdgeInsetsGeometry> buildShrunkenButtonPadding() {
    return MaterialStateProperty.all(EdgeInsets.zero);
  }

  return copyWith(
    textButtonTheme: TextButtonThemeData(
      style: textButtonTheme.style?.copyWith(
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
        padding: buildShrunkenButtonPadding(),
        foregroundColor: MaterialStateProperty.all(colorScheme.primary),
      ),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: elevatedButtonTheme.style?.copyWith(
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
        padding: buildShrunkenButtonPadding(),
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: outlinedButtonTheme.style?.copyWith(
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
        padding: buildShrunkenButtonPadding(),
      ),
    ),
  );
}