Aliases
AppCallable
Type alias for Flet app lifecycle callbacks.
Represents a callable (synchronous or asynchronous) that accepts a single argument of type Page. The return value is ignored.
Used for both main and before_main handlers.
Callable[[Page], Union[Any, Awaitable[Any]]]AnimationValue
Type alias for animation configuration values.
Represents animation input as either:
TrueorFalseto enable or disable animation,- an
intduration in milliseconds, - or an explicit Animation configuration.
Union[bool, int, Animation]BadgeValue
Type alias for badge content values.
Represents a badge as either:
- a
strvalue, rendered as a text label badge, - or a Badge.
Union[str, Badge]BlurValue
Type alias for blur configuration values.
Represents blur as either:
- a single sigma value applied to both axes,
- a
(sigma_x, sigma_y)tuple, - or an explicit Blur object.
BorderRadiusValue
Type alias for border radius values.
Represents radius as either:
- a single numeric radius applied to all corners,
- or an explicit BorderRadius configuration.
Union[Number, BorderRadius]BorderSideStrokeAlignValue
Type alias for border stroke alignment values.
Represents stroke alignment as either:
- a BorderSideStrokeAlign enum value,
- or a numeric alignment value.
Union[BorderSideStrokeAlign, Number]ColorValue
Type alias for color values.
Represents a color and can be:
- a string (representing a color name or hex value),
- a material color from the Colors enum,
- or a Cupertino color from the CupertinoColors enum.
More information here.
Union[str, Colors, CupertinoColors]context
Global context object for the running Flet app.
Use flet.context to access the current page and control auto-update behavior inside callbacks.
Context()ControlEventHandler
Type alias for typed control event callback handlers.
Represents a callback that accepts either:
- no arguments,
- or a typed Event for a specific control type.
Union[Callable[[], Any], Callable[[Event[EventControlType]], Any]]ControlStateValue
Type alias for state-dependent control values.
Represents either:
- a single value applied to all (supported) states,
- or a mapping from ControlState to per-state values.
Union[T, dict[ControlState, T]]DateTimeValue
Type alias for date/time values.
Represents either a datetime or a date.
Union[datetime, date]DurationValue
Type alias for duration values.
Represents duration as either:
- a Duration object,
- or an integer number of milliseconds (or seconds, depending on context).
Union[Duration, int]EventControlType
Type variable bound to a control type for typed event payloads.
TypeVar('EventControlType', bound=_BaseControlType)EventHandler
Type alias for generic event callback handlers.
Represents a callback that accepts either:
- no arguments,
- or an Event-derived payload.
Union[Callable[[], Any], Callable[[EventType], Any]]IconData
Represents an icon used in the UI.
An icon can come from:
- the Material icon set via the
Iconsicon collection, - the Cupertino icon set via the
CupertinoIconsicon collection, - or a custom icon set defined by the developer.
Internally, an icon is stored as an integer that encodes icon's index in its originating code set.
Encoding structure:
- Lower 16 bits (bits 0-15): the icon's index.
- Third byte (bits 16-24): the icon set identifier (set ID), which distinguishes between icon sets like Material, Cupertino, etc.
This encoding scheme allows a single integer to uniquely represent any icon across multiple icon sets.
Inherits: enum.IntEnum
Methods
random- Selects a random icon from the subclass enum, with optional exclusions and weights.
IconDataOrControl
Type alias for icon-like values.
Represents either:
- an IconData value (for example, a member of Icons or CupertinoIcons),
- or a custom icon Control.
MarginValue
Type alias for margin values.
Represents margin as either:
- a single numeric value applied to all sides,
- or an explicit Margin configuration.
OffsetValue
Type alias for offset values.
Represents offset as either:
- an Offset object,
- or an
(x, y)tuple.
PaddingValue
Type alias for padding values.
Represents padding as either:
- a single numeric value applied to all sides,
- or an explicit Padding configuration.
ResponsiveNumber
Type alias for responsive numeric values.
Represents either:
- a single numeric value used for all breakpoints,
- or a breakpoint-to-value mapping keyed by string or ResponsiveRowBreakpoint.
Union[dict[Union[str, ResponsiveRowBreakpoint], Number], Number]RotateValue
Type alias for rotation values.
Represents rotation as either:
- a numeric angle in radians,
- or an explicit Rotate transform.
ScaleValue
Type alias for scale values.
Represents scale as either:
- a numeric uniform scale factor,
- or an explicit Scale transform.