Skip to content

Aliases

AnimationValue module-attribute #

AnimationValue = Union[bool, int, Animation]

Type alias for animation configuration values.

Represents animation input as either: - True or False to enable or disable animation, - an int duration in milliseconds, - or an explicit Animation configuration.

Type alias for animation configuration values.

Represents animation input as either: - True or False to enable or disable animation, - an int duration in milliseconds, - or an explicit Animation configuration.

BadgeValue module-attribute #

BadgeValue = Union[str, Badge]

Type alias for badge content values.

Represents a badge as either: - a str value, rendered as a text label badge, - or a Badge.

Type alias for badge content values.

Represents a badge as either: - a str value, rendered as a text label badge, - or a Badge.

BlurValue module-attribute #

BlurValue = Union[Number, tuple[Number, Number], Blur]

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.

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 module-attribute #

BorderRadiusValue = Union[Number, BorderRadius]

Type alias for border radius values.

Represents radius as either: - a single numeric radius applied to all corners, - or an explicit BorderRadius configuration.

Type alias for border radius values.

Represents radius as either: - a single numeric radius applied to all corners, - or an explicit BorderRadius configuration.

BorderSideStrokeAlignValue module-attribute #

BorderSideStrokeAlignValue = Union[
    BorderSideStrokeAlign, Number
]

Type alias for border stroke alignment values.

Represents stroke alignment as either: - a BorderSideStrokeAlign enum value, - or a numeric alignment value.

Type alias for border stroke alignment values.

Represents stroke alignment as either: - a BorderSideStrokeAlign enum value, - or a numeric alignment value.

BoxShadowValue module-attribute #

BoxShadowValue = Union[BoxShadow, list[BoxShadow]]

Type alias for box shadow values.

Represents shadows as either: - a single BoxShadow object, - or a list of BoxShadow objects.

Type alias for box shadow values.

Represents shadows as either: - a single BoxShadow object, - or a list of BoxShadow objects.

ColorValue module-attribute #

ColorValue = Union[str, Colors, CupertinoColors]

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.

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.

context module-attribute #

context = Context()

Global context object for the running Flet app.

Use flet.context to access the current page and control auto-update behavior inside callbacks.

Global context object for the running Flet app.

Use flet.context to access the current page and control auto-update behavior inside callbacks.

ControlEvent module-attribute #

ControlEvent = Event[_BaseControlType]

Type alias for an event emitted by any base control.

Type alias for an event emitted by any base control.

ControlEventHandler module-attribute #

ControlEventHandler = Union[
    Callable[[], Any],
    Callable[[Event[EventControlType]], Any],
]

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.

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.

ControlStateValue module-attribute #

ControlStateValue = Union[T, dict[ControlState, T]]

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.

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.

DateTimeValue module-attribute #

DateTimeValue = Union[datetime, date]

Type alias for date/time values.

Represents either a datetime or a date.

Type alias for date/time values.

Represents either a datetime or a date.

DurationValue module-attribute #

DurationValue = Union[Duration, int]

Type alias for duration values.

Represents duration as either: - a Duration object, - or an integer number of milliseconds (or seconds, depending on context).

Type alias for duration values.

Represents duration as either: - a Duration object, - or an integer number of milliseconds (or seconds, depending on context).

EventControlType module-attribute #

EventControlType = TypeVar(
    "EventControlType", bound=_BaseControlType
)

Type variable bound to a control type for typed event payloads.

Type variable bound to a control type for typed event payloads.

EventHandler module-attribute #

EventHandler = Union[
    Callable[[], Any], Callable[[EventType], Any]
]

Type alias for generic event callback handlers.

Represents a callback that accepts either: - no arguments, - or an Event-derived payload.

Type alias for generic event callback handlers.

Represents a callback that accepts either: - no arguments, - or an Event-derived payload.

HeroTag module-attribute #

HeroTag = Union[str, int, float, bool]

Type alias for Hero tag values.

Represents an identifier used to match source and destination Hero controls during route transitions.

Type alias for Hero tag values.

Represents an identifier used to match source and destination Hero controls during route transitions.

IconData #

Represents an icon used in the UI.

An icon can come from:

  • the Material icon set via the Icons enum,
  • the Cupertino icon set via the CupertinoIcons enum,
  • 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: IntEnum

Methods

  • random

    Selects a random icon from the subclass enum, with optional exclusions and weights.

IconDataOrControl module-attribute #

IconDataOrControl = Union[IconData, 'Control']

Type alias for icon-like values.

Represents either: - an IconData value (for example, a member of Icons or CupertinoIcons), - or a custom icon Control.

Type alias for icon-like values.

Represents either: - an IconData value (for example, a member of Icons or CupertinoIcons), - or a custom icon Control.

KeyValue module-attribute #

Type alias for control key values.

Represents keys as either: - a ValueKey or ScrollKey object, - or a primitive str, int, float, or bool value.

Type alias for control key values.

Represents keys as either: - a ValueKey or ScrollKey object, - or a primitive str, int, float, or bool value.

MarginValue module-attribute #

MarginValue = Union[Number, Margin]

Type alias for margin values.

Represents margin as either: - a single numeric value applied to all sides, - or an explicit Margin configuration.

Type alias for margin values.

Represents margin as either: - a single numeric value applied to all sides, - or an explicit Margin configuration.

Number module-attribute #

Number = Union[int, float]

Type alias for numeric values (int or float).

Type alias for numeric values (int or float).

OffsetValue module-attribute #

OffsetValue = Union[Offset, tuple[Number, Number]]

Type alias for offset values.

Represents offset as either: - an Offset object, - or an (x, y) tuple.

Type alias for offset values.

Represents offset as either: - an Offset object, - or an (x, y) tuple.

PaddingValue module-attribute #

PaddingValue = Union[Number, Padding]

Type alias for padding values.

Represents padding as either: - a single numeric value applied to all sides, - or an explicit Padding configuration.

Type alias for padding values.

Represents padding as either: - a single numeric value applied to all sides, - or an explicit Padding configuration.

ResponsiveNumber module-attribute #

ResponsiveNumber = Union[
    dict[Union[str, ResponsiveRowBreakpoint], Number],
    Number,
]

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.

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.

RotateValue module-attribute #

RotateValue = Union[Number, Rotate]

Type alias for rotation values.

Represents rotation as either: - a numeric angle in radians, - or an explicit Rotate transform.

Type alias for rotation values.

Represents rotation as either: - a numeric angle in radians, - or an explicit Rotate transform.

ScaleValue module-attribute #

ScaleValue = Union[Number, Scale]

Type alias for scale values.

Represents scale as either: - a numeric uniform scale factor, - or an explicit Scale transform.

Type alias for scale values.

Represents scale as either: - a numeric uniform scale factor, - or an explicit Scale transform.

StrOrControl module-attribute #

StrOrControl = Union[str, 'Control']

Type alias for string or control values.

Represents a string or a control and can be: - a string, which will be converted internally into a Text control, - or a control.

Type alias for string or control values.

Represents a string or a control and can be: - a string, which will be converted internally into a Text control, - or a control.

TooltipValue module-attribute #

TooltipValue = Union[str, Tooltip]

Type alias for tooltip values.

Represents a tooltip as either: - a str message, - or a Tooltip.

Type alias for tooltip values.

Represents a tooltip as either: - a str message, - or a Tooltip.