CupertinoTextField
An iOS-style text field for text input with iOS-specific styling and behavior.Class signature
TextField, so all standard TextField properties are available.
Properties
A lighter colored placeholder hint that appears on the first line of the text field when the text entry is empty.Defaults to an empty string.
The TextStyle to use for
placeholder_text.Configures the gradient background.
The blend mode applied to the
bgcolor or gradient background.A list of shadows behind this text field.
Defines the visibility of the
prefix control based on the state of text entry.Has no effect if prefix is not specified.Defines the visibility of the
suffix control based on the state of text entry.Has no effect if suffix is not specified.Defines the visibility of the clear button based on the state of text entry.Will appear only if no
suffix is provided.The semantic label for the clear button used by screen readers.This will be used by screen reading software to identify the clear button widget.
An image to paint above the
bgcolor or gradient background.The padding around the text entry area between the
prefix and suffix or the clear button when clear_button_visibility_mode is not OverlayVisibilityMode.NEVER.OverlayVisibilityMode enum
Controls the visibility of text field overlays (prefix, suffix, clear button) based on text entry state.Overlay will never appear regardless of the text entry state.
Overlay will only appear when the current text entry is not empty.This includes prefilled text that the user did not type in manually, but does not include text in placeholders.
Overlay will only appear when the current text entry is empty.This also includes not having prefilled text that the user did not type in manually. Texts in placeholders are ignored.
Always show the overlay regardless of the text entry state.
Inherited properties
SinceCupertinoTextField extends TextField, it inherits all TextField properties including:
value- The current text valuepassword- Whether to obscure the textmultiline- Whether the field allows multiple linesmax_length- Maximum number of characterskeyboard_type- Type of keyboard to showautofocus- Whether to focus on loadread_only- Whether the field is read-onlyon_change- Called when text changeson_submit- Called when user submits- And many more
iOS-specific behavior
- The clear button appears as an “X” icon in iOS style when visibility conditions are met
- Overlay visibility modes follow iOS patterns for showing/hiding auxiliary controls
- Default padding of 7 pixels matches iOS text field standards
- Supports iOS-specific keyboard types and input behaviors
Comparison with Material
- CupertinoTextField uses
placeholder_textvs Material’shint_text - CupertinoTextField has built-in clear button with visibility control
- CupertinoTextField has overlay visibility modes for prefix/suffix controls
- Styling follows iOS Human Interface Guidelines vs Material Design