CustomMaterialButton constructor
const
CustomMaterialButton({
- Key? key,
- required VoidCallback? onPressed,
- VoidCallback? onLongPress,
- ValueChanged<
bool> ? onHighlightChanged, - MouseCursor? mouseCursor,
- TextStyle? textStyle,
- Color? fillColor,
- Color? focusColor,
- Color? hoverColor,
- Color? highlightColor,
- Color? splashColor,
- double elevation = 2.0,
- double focusElevation = 4.0,
- double hoverElevation = 4.0,
- double highlightElevation = 8.0,
- double disabledElevation = 0.0,
- EdgeInsetsGeometry padding = EdgeInsets.zero,
- VisualDensity visualDensity = VisualDensity.standard,
- BoxConstraints constraints = const BoxConstraints(minWidth: 35.0, minHeight: 36.0),
- ShapeBorder shape = const RoundedRectangleBorder(),
- Duration animationDuration = kThemeChangeDuration,
- Clip clipBehavior = Clip.none,
- FocusNode? focusNode,
- bool autofocus = false,
- MaterialTapTargetSize? materialTapTargetSize,
- Widget? child,
- 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);