elevatedIconButton method
ElevatedButton
elevatedIconButton({
- required void onPressed()?,
- void onLongPress()?,
- void onHover()?,
- void onFocusChange()?,
- ButtonStyle? style,
- FocusNode? focusNode,
- bool? autofocus,
- Clip? clipBehavior,
- WidgetStatesController? statesController,
- Widget? icon,
- IconAlignment? iconAlignment,
Creates an ElevatedButton.icon with this widget as its label and an optional icon.
This creates an elevated button with both an icon and a label. The icon and label
are arranged horizontally according to the iconAlignment
parameter.
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.icon
- The icon widget to display. If null, no icon is shown.iconAlignment
- How to align the icon relative to the label.
Returns an ElevatedButton configured as an icon button with this widget as the label.
Example:
Text('Download')
.elevatedIconButton(
onPressed: () => downloadFile(),
icon: Icon(Icons.download),
iconAlignment: IconAlignment.start,
)
See also:
- ElevatedButton.icon, the underlying Material Design elevated icon button.
- elevatedButton, for creating elevated buttons without icons.
Implementation
ElevatedButton elevatedIconButton({
required void Function()? onPressed,
void Function()? onLongPress,
void Function(bool)? onHover,
void Function(bool)? onFocusChange,
ButtonStyle? style,
FocusNode? focusNode,
bool? autofocus,
Clip? clipBehavior,
WidgetStatesController? statesController,
Widget? icon,
IconAlignment? iconAlignment,
}) =>
ElevatedButton.icon(
onPressed: onPressed,
onLongPress: onLongPress,
onHover: onHover,
onFocusChange: onFocusChange,
style: style,
focusNode: focusNode,
autofocus: autofocus,
clipBehavior: clipBehavior,
statesController: statesController,
icon: icon,
label: this,
iconAlignment: iconAlignment,
);