CupertinoTextField
Inherits: TextField
Properties
-
blend_mode
(BlendMode | None
) –The blend mode applied to the
-
clear_button_semantics_label
(str | None
) –The semantic label for the clear button used by screen readers.
-
clear_button_visibility_mode
(OverlayVisibilityMode
) –Defines the visibility of the clear button based on the state of text entry.
-
gradient
(Gradient | None
) –Configures the gradient background.
-
image
(DecorationImage | None
) –An image to paint above the
-
padding
(PaddingValue
) –The padding around the text entry area between the
-
placeholder_style
(TextStyle | None
) –The
TextStyle
to use forplaceholder_text
. -
placeholder_text
(str | None
) –A lighter colored placeholder hint that appears on the first line of the text
-
prefix_visibility_mode
(OverlayVisibilityMode
) –Defines the visibility of the
-
shadows
(BoxShadowValue | None
) –A list of shadows behind this text field.
-
suffix_visibility_mode
(OverlayVisibilityMode
) –Defines the visibility of the
Examples#
Basic Example#
import flet as ft
def main(page: ft.Page):
page.add(
ft.TextField(
label="Material text field",
label_style=ft.TextStyle(color=ft.Colors.GREY_400),
),
ft.CupertinoTextField(
placeholder_text="Cupertino text field",
placeholder_style=ft.TextStyle(color=ft.Colors.GREY_400),
),
ft.TextField(
adaptive=True,
label="Adaptive text field",
label_style=ft.TextStyle(color=ft.Colors.GREY_400),
),
)
ft.run(main)
Properties#
clear_button_semantics_label
#
clear_button_semantics_label: str | None = 'Clear'
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.
clear_button_visibility_mode
#
clear_button_visibility_mode: OverlayVisibilityMode = NEVER
Defines the visibility of the clear button based on the state of text entry.
Will appear only if no
suffix
is provided.
image
#
image: DecorationImage | None = None
padding
#
padding: PaddingValue = field(
default_factory=lambda: all(7)
)
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
.
placeholder_style
#
placeholder_style: TextStyle | None = None
The TextStyle
to use for placeholder_text
.
placeholder_text
#
placeholder_text: str | None = None
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.
prefix_visibility_mode
#
prefix_visibility_mode: OverlayVisibilityMode = ALWAYS
suffix_visibility_mode
#
suffix_visibility_mode: OverlayVisibilityMode = ALWAYS