cupertinoFilledButton method
CupertinoButton
cupertinoFilledButton({
- CupertinoButtonSize sizeStyle = CupertinoButtonSize.large,
- EdgeInsetsGeometry? padding,
- Color disabledColor = CupertinoColors.tertiarySystemFill,
- @Deprecated('Use minimumSize instead') double? minSize,
- Size? minimumSize,
- double? pressedOpacity = 0.4,
- BorderRadius? borderRadius,
- AlignmentGeometry alignment = Alignment.center,
- Color? focusColor,
- FocusNode? focusNode,
- void onFocusChange()?,
- bool autofocus = false,
- void onLongPress()?,
- required void onPressed()?,
Creates a filled CupertinoButton with this widget as its child.
A filled CupertinoButton has a solid background color that follows the current iOS accent color (typically blue). This style is recommended for primary actions in your interface.
The button automatically adapts to light and dark mode, and provides appropriate contrast ratios for accessibility.
Parameters:
sizeStyle
- The size style of the button (small, medium, large). Defaults to large.padding
- Internal padding around the child widget. If null, uses default padding based on size style.disabledColor
- Background color when the button is disabled. Defaults to tertiary system fill.minSize
- Deprecated: UseminimumSize
instead. Minimum size for the button.minimumSize
- Minimum size constraint for the button. Takes precedence overminSize
.pressedOpacity
- Opacity level when the button is pressed. Defaults to 0.4.borderRadius
- Corner radius of the button. If null, uses default radius.alignment
- How to align the child within the button. Defaults to center.focusColor
- Color overlay when the button has focus (for accessibility).focusNode
- Focus node for keyboard navigation and accessibility.onFocusChange
- Callback when focus state changes.autofocus
- Whether this button should automatically receive focus. Defaults to false.onLongPress
- Callback for long press gestures. If null, long press is disabled.onPressed
- Required callback for tap gestures. If null, button is disabled.
Returns a filled CupertinoButton with this widget as its child.
Example:
Text('Save Changes').cupertinoFilledButton(
onPressed: () => saveDocument(),
sizeStyle: CupertinoButtonSize.large,
);
Implementation
CupertinoButton cupertinoFilledButton({
CupertinoButtonSize sizeStyle = CupertinoButtonSize.large,
EdgeInsetsGeometry? padding,
Color disabledColor = CupertinoColors.tertiarySystemFill,
@Deprecated('Use minimumSize instead') double? minSize,
Size? minimumSize,
double? pressedOpacity = 0.4,
BorderRadius? borderRadius,
AlignmentGeometry alignment = Alignment.center,
Color? focusColor,
FocusNode? focusNode,
void Function(bool)? onFocusChange,
bool autofocus = false,
void Function()? onLongPress,
required void Function()? onPressed,
}) =>
CupertinoButton.filled(
sizeStyle: sizeStyle,
padding: padding,
disabledColor: disabledColor,
minimumSize:
minimumSize ?? (minSize != null ? Size(minSize, minSize) : null),
pressedOpacity: pressedOpacity,
borderRadius: borderRadius,
alignment: alignment,
focusColor: focusColor,
focusNode: focusNode,
onFocusChange: onFocusChange,
autofocus: autofocus,
onLongPress: onLongPress,
onPressed: onPressed,
child: this,
);