styleFrom static method

ButtonStyle styleFrom({
  1. Color? foregroundColor,
  2. Color? backgroundColor,
  3. Color? disabledForegroundColor,
  4. Color? disabledBackgroundColor,
  5. Color? focusColor,
  6. Color? hoverColor,
  7. Color? highlightColor,
  8. Color? shadowColor,
  9. Color? surfaceTintColor,
  10. double? elevation,
  11. Size? minimumSize,
  12. Size? fixedSize,
  13. Size? maximumSize,
  14. double? iconSize,
  15. BorderSide? side,
  16. OutlinedBorder? shape,
  17. EdgeInsetsGeometry? padding,
  18. MouseCursor? enabledMouseCursor,
  19. MouseCursor? disabledMouseCursor,
  20. VisualDensity? visualDensity,
  21. MaterialTapTargetSize? tapTargetSize,
  22. Duration? animationDuration,
  23. bool? enableFeedback,
  24. AlignmentGeometry? alignment,
  25. InteractiveInkFeatureFactory? splashFactory,
  26. Color? overlayColor,
})

Implementation

static ButtonStyle styleFrom({
  Color? foregroundColor,
  Color? backgroundColor,
  Color? disabledForegroundColor,
  Color? disabledBackgroundColor,
  Color? focusColor,
  Color? hoverColor,
  Color? highlightColor,
  Color? shadowColor,
  Color? surfaceTintColor,
  double? elevation,
  Size? minimumSize,
  Size? fixedSize,
  Size? maximumSize,
  double? iconSize,
  BorderSide? side,
  OutlinedBorder? shape,
  EdgeInsetsGeometry? padding,
  MouseCursor? enabledMouseCursor,
  MouseCursor? disabledMouseCursor,
  VisualDensity? visualDensity,
  MaterialTapTargetSize? tapTargetSize,
  Duration? animationDuration,
  bool? enableFeedback,
  AlignmentGeometry? alignment,
  InteractiveInkFeatureFactory? splashFactory,
  Color? overlayColor,
}) {
  final MaterialStateProperty<Color?>? buttonBackgroundColor =
      (backgroundColor == null && disabledBackgroundColor == null)
          ? null
          : _MIconButtonDefaultBackground(backgroundColor, disabledBackgroundColor);
  final MaterialStateProperty<Color?>? buttonForegroundColor =
      (foregroundColor == null && disabledForegroundColor == null)
          ? null
          : _MIconButtonDefaultForeground(foregroundColor, disabledForegroundColor);
  final MaterialStateProperty<Color?>? effectiveOverlayColor = (overlayColor == null &&
          foregroundColor == null &&
          hoverColor == null &&
          focusColor == null &&
          highlightColor == null)
      ? null
      : _MIconButtonDefaultOverlay(foregroundColor, focusColor, hoverColor, highlightColor, overlayColor);
  final MaterialStateProperty<MouseCursor?> mouseCursor =
      _MIconButtonDefaultMouseCursor(enabledMouseCursor, disabledMouseCursor);

  return ButtonStyle(
    backgroundColor: buttonBackgroundColor,
    foregroundColor: buttonForegroundColor,
    overlayColor: effectiveOverlayColor,
    shadowColor: ButtonStyleButton.allOrNull<Color>(shadowColor),
    surfaceTintColor: ButtonStyleButton.allOrNull<Color>(surfaceTintColor),
    elevation: ButtonStyleButton.allOrNull<double>(elevation),
    padding: ButtonStyleButton.allOrNull<EdgeInsetsGeometry>(padding),
    minimumSize: ButtonStyleButton.allOrNull<Size>(minimumSize),
    fixedSize: ButtonStyleButton.allOrNull<Size>(fixedSize),
    maximumSize: ButtonStyleButton.allOrNull<Size>(maximumSize),
    iconSize: ButtonStyleButton.allOrNull<double>(iconSize),
    side: ButtonStyleButton.allOrNull<BorderSide>(side),
    shape: ButtonStyleButton.allOrNull<OutlinedBorder>(shape),
    mouseCursor: mouseCursor,
    visualDensity: visualDensity,
    tapTargetSize: tapTargetSize,
    animationDuration: animationDuration,
    enableFeedback: enableFeedback,
    alignment: alignment,
    splashFactory: splashFactory,
  );
}