MaterialButton constructor

const MaterialButton(
  1. {Key key,
  2. @required VoidCallback onPressed,
  3. VoidCallback onLongPress,
  4. ValueChanged<bool> onHighlightChanged,
  5. ButtonTextTheme textTheme,
  6. Color textColor,
  7. Color disabledTextColor,
  8. Color color,
  9. Color disabledColor,
  10. Color focusColor,
  11. Color hoverColor,
  12. Color highlightColor,
  13. Color splashColor,
  14. Brightness colorBrightness,
  15. double elevation,
  16. double focusElevation,
  17. double hoverElevation,
  18. double highlightElevation,
  19. double disabledElevation,
  20. EdgeInsetsGeometry padding,
  21. ShapeBorder shape,
  22. Clip clipBehavior: Clip.none,
  23. FocusNode focusNode,
  24. bool autofocus: false,
  25. MaterialTapTargetSize materialTapTargetSize,
  26. Duration animationDuration,
  27. double minWidth,
  28. double height,
  29. bool enableFeedback: true,
  30. Widget child}
)

Creates a material button.

Rather than creating a material button directly, consider using FlatButton or RaisedButton. To create a custom Material button consider using RawMaterialButton.

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

Implementation

const MaterialButton({
  Key key,
  @required this.onPressed,
  this.onLongPress,
  this.onHighlightChanged,
  this.textTheme,
  this.textColor,
  this.disabledTextColor,
  this.color,
  this.disabledColor,
  this.focusColor,
  this.hoverColor,
  this.highlightColor,
  this.splashColor,
  this.colorBrightness,
  this.elevation,
  this.focusElevation,
  this.hoverElevation,
  this.highlightElevation,
  this.disabledElevation,
  this.padding,
  this.shape,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  this.materialTapTargetSize,
  this.animationDuration,
  this.minWidth,
  this.height,
  this.enableFeedback = true,
  this.child,
}) : assert(clipBehavior != null),
     assert(autofocus != null),
     assert(elevation == null || elevation >= 0.0),
     assert(focusElevation == null || focusElevation >= 0.0),
     assert(hoverElevation == null || hoverElevation >= 0.0),
     assert(highlightElevation == null || highlightElevation >= 0.0),
     assert(disabledElevation == null || disabledElevation >= 0.0),
     super(key: key);