buildWidget method
Widget
buildWidget(
- BuildContext context, {
- T? param,
- Axis orientation = Axis.horizontal,
- bool compact = false,
- bool floating = false,
override
Implementation
@override
Widget buildWidget(
BuildContext context, {
T? param,
Axis orientation = Axis.horizontal,
bool compact = false,
bool floating = false,
}) {
final theme = Theme.of(context);
final icon = super.icon(param);
final iconData = super.iconData(param);
final enabled = super.enabled(param);
final onPressed = super.onPressed != null && enabled //
? () => super.onPressed!(param)
: null;
final isPressed = this.isPressed != null //
? this.isPressed!(param)
: false;
return 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),
);
}