filledButton method
FilledButton
filledButton({
- required void onPressed()?,
- void onLongPress()?,
- void onHover()?,
- void onFocusChange()?,
- ButtonStyle? style,
- FocusNode? focusNode,
- bool autofocus = false,
- Clip? clipBehavior = Clip.none,
- WidgetStatesController? statesController,
Creates a FilledButton with this widget as its child.
Filled buttons are high-emphasis buttons with a solid background color. They're used for the most important actions in your app and have the highest visual impact after the floating action button.
Parameters:
onPressed
- Called when the button is pressed. If null, button is disabled.onLongPress
- Called when the button is long-pressed.onHover
- Called when a pointer enters or exits the button area.onFocusChange
- Called when the focus state of the button changes.style
- Customizes the button's appearance and behavior.focusNode
- An optional focus node to use as the focus node for this widget.autofocus
- Whether this widget should focus itself if nothing else is focused.clipBehavior
- The content will be clipped (or not) according to this option.statesController
- Represents the interactive state of the button.
Returns a FilledButton with this widget as its child.
Example:
Text('Submit')
.filledButton(
onPressed: () => submitForm(),
style: FilledButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
),
)
See also:
- FilledButton, the underlying Material Design filled button.
- filledTonalButton, for a less prominent filled button variant.
- filledIconButton, for creating filled buttons with icons.
Implementation
FilledButton filledButton({
required void Function()? onPressed,
void Function()? onLongPress,
void Function(bool)? onHover,
void Function(bool)? onFocusChange,
ButtonStyle? style,
FocusNode? focusNode,
bool autofocus = false,
Clip? clipBehavior = Clip.none,
WidgetStatesController? statesController,
}) =>
FilledButton(
onPressed: onPressed,
onLongPress: onLongPress,
onHover: onHover,
onFocusChange: onFocusChange,
style: style,
focusNode: focusNode,
autofocus: autofocus,
clipBehavior: clipBehavior,
statesController: statesController,
child: this,
);