CustomMaterialButton constructor

const CustomMaterialButton({
  1. Key? key,
  2. required VoidCallback? onPressed,
  3. VoidCallback? onLongPress,
  4. ValueChanged<bool>? onHighlightChanged,
  5. MouseCursor? mouseCursor,
  6. TextStyle? textStyle,
  7. Color? fillColor,
  8. Color? focusColor,
  9. Color? hoverColor,
  10. Color? highlightColor,
  11. Color? splashColor,
  12. double elevation = 2.0,
  13. double focusElevation = 4.0,
  14. double hoverElevation = 4.0,
  15. double highlightElevation = 8.0,
  16. double disabledElevation = 0.0,
  17. EdgeInsetsGeometry padding = EdgeInsets.zero,
  18. VisualDensity visualDensity = VisualDensity.standard,
  19. BoxConstraints constraints = const BoxConstraints(minWidth: 35.0, minHeight: 36.0),
  20. ShapeBorder shape = const RoundedRectangleBorder(),
  21. Duration animationDuration = kThemeChangeDuration,
  22. Clip clipBehavior = Clip.none,
  23. FocusNode? focusNode,
  24. bool autofocus = false,
  25. MaterialTapTargetSize? materialTapTargetSize,
  26. Widget? child,
  27. bool enableFeedback = true,
})

Create a button based on Semantics, Material, and InkWell widgets.

The shape, elevation, focusElevation, hoverElevation, highlightElevation, disabledElevation, padding, constraints, autofocus, and clipBehavior arguments must not be null. Additionally, elevation, focusElevation, hoverElevation, highlightElevation, and disabledElevation must be non-negative.

Implementation

const CustomMaterialButton({
  Key? key,
  required this.onPressed,
  this.onLongPress,
  this.onHighlightChanged,
  this.mouseCursor,
  this.textStyle,
  this.fillColor,
  this.focusColor,
  this.hoverColor,
  this.highlightColor,
  this.splashColor,
  this.elevation = 2.0,
  this.focusElevation = 4.0,
  this.hoverElevation = 4.0,
  this.highlightElevation = 8.0,
  this.disabledElevation = 0.0,
  this.padding = EdgeInsets.zero,
  this.visualDensity = VisualDensity.standard,
  this.constraints = const BoxConstraints(minWidth: 35.0, minHeight: 36.0),
  this.shape = const RoundedRectangleBorder(),
  this.animationDuration = kThemeChangeDuration,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  MaterialTapTargetSize? materialTapTargetSize,
  this.child,
  this.enableFeedback = true,
})  : materialTapTargetSize =
          materialTapTargetSize ?? MaterialTapTargetSize.padded,
      assert(elevation >= 0.0),
      assert(focusElevation >= 0.0),
      assert(hoverElevation >= 0.0),
      assert(highlightElevation >= 0.0),
      assert(disabledElevation >= 0.0),
      super(key: key);