buildButton method
Widget
buildButton(
- BuildContext context,
- Widget child, {
- FastButtonEmphasis emphasis = FastButtonEmphasis.low,
- ValueChanged<
bool> ? onHover, - BoxConstraints? constraints,
- EdgeInsetsGeometry? padding,
- BoxDecoration? decoration,
- bool flexible = false,
- bool isEnabled = true,
- String? semanticLabel,
- Color? highlightColor,
- Alignment? alignment,
- FastButtonSize? size,
- VoidCallback? onTap,
- Color? focusColor,
- Color? hoverColor,
- String? tooltip,
- Color? color,
- Widget? icon,
Implementation
Widget buildButton(
BuildContext context,
Widget child, {
FastButtonEmphasis emphasis = FastButtonEmphasis.low,
ValueChanged<bool>? onHover,
BoxConstraints? constraints,
EdgeInsetsGeometry? padding,
BoxDecoration? decoration,
bool flexible = false,
bool isEnabled = true,
String? semanticLabel,
Color? highlightColor,
Alignment? alignment,
FastButtonSize? size,
VoidCallback? onTap,
Color? focusColor,
Color? hoverColor,
String? tooltip,
Color? color,
Widget? icon,
}) {
Widget button = Container(
constraints: constraints ??
getButtonConstraints(
context,
size: size,
icon: icon,
),
alignment: alignment ?? Alignment.center,
padding: padding,
child: child,
);
if (!flexible) {
button = UnconstrainedBox(child: button);
}
if (decoration != null) {
button = Ink(
decoration: decoration,
child: button,
);
}
button = FastInkWell(
highlightColor: getHighlightColor(
context,
highlightColor: highlightColor,
emphasis: emphasis,
color: color,
icon: icon,
),
hoverColor: getHoverColor(
context,
hoverColor: hoverColor,
emphasis: emphasis,
color: color,
icon: icon,
),
focusColor: focusColor,
isEnabled: isEnabled,
onHover: onHover,
onTap: onTap,
child: button,
);
button = Semantics(
label: semanticLabel,
enabled: isEnabled,
button: true,
child: button,
);
if (tooltip != null) {
button = FastTooltip(
message: tooltip,
child: button,
);
}
return button;
}