FilledButton.tonalIcon constructor
- Key? key,
- required VoidCallback? onPressed,
- VoidCallback? onLongPress,
- ValueChanged<
bool> ? onHover, - ValueChanged<
bool> ? onFocusChange, - ButtonStyle? style,
- FocusNode? focusNode,
- bool? autofocus,
- Clip? clipBehavior,
- MaterialStatesController? statesController,
- Widget? icon,
- required Widget label,
- IconAlignment iconAlignment = IconAlignment.start,
Create a filled tonal button from icon
and label
.
The icon
and label
are arranged in a row with padding at the start and
end and a gap between them.
If icon
is null, will create a FilledButton.tonal instead.
Implementation
factory FilledButton.tonalIcon({
Key? key,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
ValueChanged<bool>? onHover,
ValueChanged<bool>? onFocusChange,
ButtonStyle? style,
FocusNode? focusNode,
bool? autofocus,
Clip? clipBehavior,
MaterialStatesController? statesController,
Widget? icon,
required Widget label,
IconAlignment iconAlignment = IconAlignment.start,
}) {
if (icon == null) {
return FilledButton.tonal(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
onHover: onHover,
onFocusChange: onFocusChange,
style: style,
focusNode: focusNode,
autofocus: autofocus ?? false,
clipBehavior: clipBehavior ?? Clip.none,
statesController: statesController,
child: label,
);
}
return _FilledButtonWithIcon.tonal(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
onHover: onHover,
onFocusChange: onFocusChange,
style: style,
focusNode: focusNode,
autofocus: autofocus,
clipBehavior: clipBehavior,
statesController: statesController,
icon: icon,
label: label,
iconAlignment: iconAlignment,
);
}