AsyncCupertinoButton constructor
const
AsyncCupertinoButton({
- required Widget child,
- required FutureOr<
void> onPressed()?, - AsyncButtonErrorHandler? onError,
- bool loading = false,
- Widget? loadingChild,
- String? loadingSemanticsLabel,
- CupertinoButtonSize sizeStyle = CupertinoButtonSize.large,
- EdgeInsetsGeometry? padding,
- Color? color,
- Color? foregroundColor,
- Color disabledColor = CupertinoColors.quaternarySystemFill,
- Size? minimumSize,
- double? pressedOpacity = 0.4,
- BorderRadius? borderRadius,
- AlignmentGeometry alignment = Alignment.center,
- Color? focusColor,
- FocusNode? focusNode,
- ValueChanged<
bool> ? onFocusChange, - bool autofocus = false,
- MouseCursor? mouseCursor,
- VoidCallback? onLongPress,
- Duration animationDuration = const Duration(milliseconds: 200),
- double minimumChildOpacity = 0.0,
- TransitionAnimationType transitionType = TransitionAnimationType.stack,
- Widget customBuilder()?,
- Key? key,
Creates an iOS-style button with tracked async activation.
With both onPressed and onLongPress null, the button is disabled.
Implementation
const AsyncCupertinoButton({
required this.child,
required this.onPressed,
this.onError,
this.loading = false,
this.loadingChild,
this.loadingSemanticsLabel,
this.sizeStyle = CupertinoButtonSize.large,
this.padding,
this.color,
this.foregroundColor,
this.disabledColor = CupertinoColors.quaternarySystemFill,
this.minimumSize,
this.pressedOpacity = 0.4,
this.borderRadius,
this.alignment = Alignment.center,
this.focusColor,
this.focusNode,
this.onFocusChange,
this.autofocus = false,
this.mouseCursor,
this.onLongPress,
this.animationDuration = const Duration(milliseconds: 200),
this.minimumChildOpacity = 0.0,
this.transitionType = TransitionAnimationType.stack,
this.customBuilder,
super.key,
}) : _variant = _AsyncCupertinoButtonVariant.plain,
assert(
pressedOpacity == null ||
(pressedOpacity >= 0.0 && pressedOpacity <= 1.0),
),
assert(
transitionType != TransitionAnimationType.customBuilder ||
customBuilder != null,
'customBuilder must be provided when transitionType is customBuilder',
);