CupertinoButton
An iOS-style button with customizable appearance and behavior.Class signature
Properties
The content of this button. Can be a string or a Control.
An icon shown in this button.
The foreground color of the icon.
The background color of this button.
The color of this button’s text.
The background color of this button when disabled.
Defines the opacity of the button when it is clicked. When not pressed, the button has an opacity of 1.0.Must be between 0.0 and 1.0 inclusive.
The minimum size of this button.
The size preset for this button. Influences defaults such as minimum size, padding, border radius, and text style.Options:
CupertinoButtonSize.SMALL- Compact button style with smaller text and tighter sizingCupertinoButtonSize.MEDIUM- Medium button style with regular text and balanced sizingCupertinoButtonSize.LARGE- Classic large Cupertino button style
The amount of space to surround the content control inside the bounds of the button.
The alignment of this button’s content.Typically buttons are sized to be just big enough to contain the child and its padding. If the button’s size is constrained to a fixed size, this property defines how the child is aligned within the available space.
The radius of the button’s corners when it has a background color.
The URL to open when this button is clicked. If
on_click event callback is also provided, it is fired after opening the URL.Whether this button should be selected as the initial focus when no other node in its scope is currently focused.
The color to use for the focus highlight for keyboard interactions.Defaults to a slightly transparent
bgcolor. If bgcolor is None, defaults to a slightly transparent CupertinoColors.ACTIVE_BLUE.The cursor for a mouse pointer when it enters or is hovering over this button.
Events
Called when a user clicks this button.
Called when a user long-presses this button.
Called when this button receives focus.
Called when this button loses focus.
Methods
focus()
Requests focus for this control.iOS-specific behavior
- When clicked, the button opacity changes to
opacity_on_click(default 0.4) to provide visual feedback - The default border radius of 8.0 matches iOS design guidelines
- Focus color uses the iOS-standard slightly transparent style with opacity of 0.80, brightness of 0.69, and saturation of 0.835
Comparison with Material
Compared to Material’sElevatedButton or TextButton:
- CupertinoButton uses opacity changes for press feedback, Material uses ripple/splash effects
- CupertinoButton has rounded corners by default (8px radius), Material buttons are more rectangular
- CupertinoButton styling follows iOS Human Interface Guidelines
CupertinoFilledButton
An iOS-style button filled with default background color. Inherits all properties and methods fromCupertinoButton.
Class signature
Description
This is a convenience widget that extendsCupertinoButton with a default background color, following iOS design patterns for primary action buttons.