Skip to content

Aliases

AppCallable module-attribute #

AppCallable = Callable[[Page], Any | Awaitable[Any]]

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.

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.

AnimationValue module-attribute #

AnimationValue = 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 = 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 = 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 = 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 = 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 = 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 = 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 = (
    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 = 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 = 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 = 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 = (
    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.

IconData #

Represents an icon used in the UI.

An icon can come from:

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

Methods

  • random

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

IconDataOrControl module-attribute #

IconDataOrControl = 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 #

KeyValue = ValueKey | ScrollKey | str | int | float | bool

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 = 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 = int | float

Type alias for numeric values (int or float).

Type alias for numeric values (int or float).

OffsetValue module-attribute #

OffsetValue = 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 = 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 = (
    dict[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 = 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 = 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 = 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 = 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.