styleFrom static method
ButtonStyle
styleFrom({
- Color? primary,
- Color? onSurface,
- Color? backgroundColor,
- Color? shadowColor,
- double? elevation,
- TextStyle? textStyle,
- EdgeInsetsGeometry? padding,
- Size? minimumSize,
- Size? fixedSize,
- Size? maximumSize,
- BorderSide? side,
- OutlinedBorder? shape,
- MouseCursor? enabledMouseCursor,
- MouseCursor? disabledMouseCursor,
- VisualDensity? visualDensity,
- MaterialTapTargetSize? tapTargetSize,
- Duration? animationDuration,
- bool? enableFeedback,
- AlignmentGeometry? alignment,
- InteractiveInkFeatureFactory? splashFactory,
- BorderSide? successSide,
- Color? success,
- BorderSide? failSide,
- Color? fail,
- Color? disable,
- BorderSide? disableSide,
like OutlinedButton.styleFrom with state color for foreground
success
, fail
and state color for side
with successSide
, failSide
Implementation
static ButtonStyle styleFrom({
Color? primary,
Color? onSurface,
Color? backgroundColor,
Color? shadowColor,
double? elevation,
TextStyle? textStyle,
EdgeInsetsGeometry? padding,
Size? minimumSize,
Size? fixedSize,
Size? maximumSize,
BorderSide? side,
OutlinedBorder? shape,
MouseCursor? enabledMouseCursor,
MouseCursor? disabledMouseCursor,
VisualDensity? visualDensity,
MaterialTapTargetSize? tapTargetSize,
Duration? animationDuration,
bool? enableFeedback,
AlignmentGeometry? alignment,
InteractiveInkFeatureFactory? splashFactory,
//extend fields
BorderSide? successSide,
Color? success,
BorderSide? failSide,
Color? fail,
Color? disable,
BorderSide? disableSide,
}) {
final style = OutlinedButton.styleFrom(
primary: primary,
backgroundColor: backgroundColor,
onSurface: onSurface,
shadowColor: shadowColor,
elevation: elevation,
textStyle: textStyle,
padding: padding,
minimumSize: minimumSize,
fixedSize: fixedSize,
maximumSize: maximumSize,
side: side,
shape: shape,
enabledMouseCursor: enabledMouseCursor,
disabledMouseCursor: disabledMouseCursor,
visualDensity: visualDensity,
tapTargetSize: tapTargetSize,
animationDuration: animationDuration,
enableFeedback: enableFeedback,
alignment: alignment,
splashFactory: splashFactory,
);
final _StateOutlineSide? outlineSide =
(side == null && failSide == null && successSide == null)
? null
: _StateOutlineSide(
primary: side,
success: successSide,
fail: failSide,
disable: disableSide,
);
final _StateOutlinedForeground? foregroundColor = (onSurface == null &&
primary == null &&
fail == null &&
success == null)
? null
: _StateOutlinedForeground(
primary: primary,
onSurface: onSurface,
onFail: fail,
onSuccess: success,
onDisable: disable);
return style.copyWith(
foregroundColor: foregroundColor,
side: outlineSide,
);
}