RawMaterialButton class

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

This class does not use the current Theme or ButtonTheme to compute default values for unspecified parameters. It's intended to be used for custom Material buttons that optionally incorporate defaults from the themes or from app-specific sources.

This class is planned to be deprecated in a future release, see ButtonStyleButton, the base class of ElevatedButton, FilledButton, OutlinedButton and TextButton.

See also:

Inheritance
Annotations
  • @Category(<String>['Material', 'Button'])

Constructors

RawMaterialButton({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: 88.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.
const

Properties

animationDuration Duration
Defines the duration of animated changes for shape and elevation.
final
autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
child Widget?
Typically the button's label.
final
clipBehavior Clip
The content will be clipped (or not) according to this option.
final
constraints BoxConstraints
Defines the button's size.
final
disabledElevation double
The elevation for the button's Material when the button is not enabled.
final
elevation double
The elevation for the button's Material when the button is enabled but not pressed.
final
enabled bool
Whether the button is enabled or disabled.
no setter
enableFeedback bool
Whether detected gestures should provide acoustic and/or haptic feedback.
final
fillColor Color?
The color of the button's Material.
final
focusColor Color?
The color for the button's Material when it has the input focus.
final
focusElevation double
The elevation for the button's Material when the button is enabled and has the input focus.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
hashCode int
The hash code for this object.
no setterinherited
highlightColor Color?
The highlight color for the button's InkWell.
final
highlightElevation double
The elevation for the button's Material when the button is enabled and pressed.
final
hoverColor Color?
The color for the button's Material when a pointer is hovering over it.
final
hoverElevation double
The elevation for the button's Material when the button is enabled and a pointer is hovering over it.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
materialTapTargetSize MaterialTapTargetSize
Configures the minimum size of the tap target.
final
mouseCursor MouseCursor?
The cursor for a mouse pointer when it enters or is hovering over the button.
final
onHighlightChanged ValueChanged<bool>?
Called by the underlying InkWell widget's InkWell.onHighlightChanged callback.
final
onLongPress VoidCallback?
Called when the button is long-pressed.
final
onPressed VoidCallback?
Called when the button is tapped or otherwise activated.
final
padding EdgeInsetsGeometry
The internal padding for the button's child.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape ShapeBorder
The shape of the button's Material.
final
splashColor Color?
The splash color for the button's InkWell.
final
textStyle TextStyle?
Defines the default text style, with Material.textStyle, for the button's child.
final
visualDensity VisualDensity
Defines how compact the button's layout will be.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RawMaterialButton>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited