buildWidget method
Widget
buildWidget(
- BuildContext context, {
- T? param,
- Axis orientation = Axis.horizontal,
- bool compact = false,
- bool floating = false,
- String? tooltip,
override
Implementation
@override
Widget buildWidget(
BuildContext context, {
T? param,
Axis orientation = Axis.horizontal,
bool compact = false,
bool floating = false,
String? tooltip,
}) {
final theme = Theme.of(context);
final icon = super.icon(param);
final iconData = super.iconData(param);
final enabled = super.enabled(param);
final isButton = super.onPressed != null;
final isButtonEnabled = isButton && enabled;
final onPressed = isButtonEnabled //
? () => super.onPressed!(param)
: null;
final isPressed = this.isPressed != null //
? this.isPressed!(param)
: false;
return Semantics(
label: semanticLabel ?? tooltip,
excludeSemantics: true,
blockUserActions: true,
button: isButton,
enabled: isButtonEnabled,
child: ElevatedButton(
key: super.key,
onPressed: onPressed,
style: style == null
? ElevatedButton.styleFrom(
padding: const EdgeInsets.all(0),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
iconColor: isPressed
? this.pressedIconColor ??
theme.buttonTheme.colorScheme?.onPrimary
.withValues(alpha: 0.5)
: this.iconColor,
backgroundColor: isPressed
? this.pressedBackgroundColor ??
theme.buttonTheme.colorScheme?.primary
.withValues(alpha: 0.5)
: this.backgroundColor,
maximumSize: size,
minimumSize: size,
)
: style!.copyWith(
maximumSize: WidgetStateProperty.all(size),
minimumSize: WidgetStateProperty.all(size),
),
child: icon ?? Icon(iconData),
),
);
}