Button class
A pressable button widget that responds to keyboard input.
Use onPressed for click handling. Supports style and focusStyle
customization, and enabled for disabled state.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- Button
Constructors
- Button({Key? key, required String text, VoidCallback? onPressed, bool enabled = true, ButtonStyle? style, FocusNode? focusNode})
-
Creates a Button displaying
textwith an optionalonPressedcallback.const
Properties
- enabled → bool
-
Whether the button is interactive.
final
- focusNode → FocusNode?
-
An optional focus node for keyboard navigation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another in the tree.
finalinherited
- onPressed → VoidCallback?
-
Called when the button is activated via Enter or Space.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → ButtonStyle?
-
The visual style configuration for the button.
final
- text → String
-
The label text displayed on the button.
final
Methods
-
createElement(
) → StatefulElement -
Creates the Element for this widget.
inherited
-
createState(
) → State< Button> -
Creates the mutable state for this widget.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited