Skip to content

PageView

PageView #

Bases: AdaptiveControl

TBD

adaptive #

adaptive: bool | None = None

Enables platform-specific rendering or inheritance of adaptiveness from parent controls.

appbar #

appbar: AppBar | CupertinoAppBar | None

auto_scroll #

auto_scroll: bool

badge #

badge: BadgeValue | None = None

A badge to show on top of this control.

bgcolor #

bgcolor: ColorValue | None

bottom_appbar #

bottom_appbar: BottomAppBar | None

col #

col: ResponsiveNumber = 12

If a parent of this control is a ResponsiveRow, this property is used to determine how many virtual columns of a screen this control will span.

Can be a number or a dictionary configured to have a different value for specific breakpoints, for example col={"sm": 6}.

This control spans the 12 virtual columns by default.

Dimensions
Breakpoint Dimension
xs <576px
sm ≥576px
md ≥768px
lg ≥992px
xl ≥1200px
xxl ≥1400px

controls #

controls: list[BaseControl]

dark_theme #

dark_theme: Theme | None = None

Customizes the theme of the application when in dark theme mode.

data #

data: Any = skip_field()

Arbitrary data of any type.

decoration #

decoration: BoxDecoration | None

disabled #

disabled: bool = False

Every control has disabled property which is False by default - control and all its children are enabled.

Note

The value of this property will be propagated down to all children controls recursively.

Example

For example, if you have a form with multiple entry controls you can disable them all together by disabling container:

ft.Column(
    disabled = True,
    controls=[
        ft.TextField(),
        ft.TextField()
    ]
)

drawer #

drawer: NavigationDrawer | None

end_drawer #

end_drawer: NavigationDrawer | None

expand #

expand: bool | int | None = None

Specifies whether/how this control should expand to fill available space in its parent layout.

More information here.

Note

Has effect only if the direct parent of this control is one of the following controls, or their subclasses: Column, Row, View, Page.

expand_loose #

expand_loose: bool = False

Allows the control to expand along the main axis if space is available, but does not require it to fill all available space.

More information here.

Note

If expand_loose is True, it will have effect only if:

  • expand is not None and
  • the direct parent of this control is one of the following controls, or their subclasses: Column, Row, View, Page.

floating_action_button #

floating_action_button: FloatingActionButton | None

floating_action_button_location #

floating_action_button_location: (
    FloatingActionButtonLocation | OffsetValue | None
)

foreground_decoration #

foreground_decoration: BoxDecoration | None

height #

height: Number | None = None

horizontal_alignment #

horizontal_alignment: CrossAxisAlignment | None

key #

key: (
    str | int | float | bool | ValueKey | ScrollKey | None
) = None

locale_configuration #

locale_configuration: LocaleConfiguration | None = None

media #

media: PageMediaData | None = None

navigation_bar #

navigation_bar: (
    NavigationBar | CupertinoNavigationBar | None
)

on_media_change #

on_media_change: ControlEventHandler[PageView] | None = None

Called when page.media has changed.

Event type: PageMediaData

on_resize #

on_resize: EventHandler[PageResizeEvent] | None = None

Called when a user resizes a browser or native OS window containing Flet app, for example:

def page_resize(e):
    print("New page size:", page.window.width, page.window_height)

page.on_resize = page_resize

on_scroll #

on_scroll: EventHandler[OnScrollEvent] | None = None

Called when page's scroll position is changed by a user.

opacity #

opacity: Number = 1.0

Defines the transparency of the control.

Value ranges from 0.0 (completely transparent) to 1.0 (completely opaque without any transparency).

overlay #

overlay: list[BaseControl]

padding #

padding: PaddingValue | None

page #

page: Page | PageView | None

The page (of type Page or PageView) to which this control belongs to.

parent #

parent: BaseControl | None

The direct ancestor(parent) of this control.

It defaults to None and will only have a value when this control is mounted (added to the page tree).

The Page control (which is the root of the tree) is an exception - it always has parent=None.

rtl #

rtl: bool = False

Whether the text direction of the control should be right-to-left (RTL).

scroll #

scroll: ScrollMode | None

scroll_event_interval #

scroll_event_interval: Number | None = None

show_semantics_debugger #

show_semantics_debugger: bool | None = None

True turns on an overlay that shows the accessibility information reported by the framework.

spacing #

spacing: Number | None

theme #

theme: Theme | None = None

Customizes the theme of the application when in light theme mode. Currently, a theme can only be automatically generated from a "seed" color. For example, to generate light theme from a green color.

theme_mode #

theme_mode: ThemeMode | None = SYSTEM

The page's theme mode.

Defaults to ThemeMode.SYSTEM.

title #

title: str | None = None

tooltip #

tooltip: TooltipValue | None = None

The tooltip ot show when this control is hovered over.

vertical_alignment #

vertical_alignment: MainAxisAlignment | None

views #

views: list[View] = field(default_factory=lambda: [View()])

visible #

visible: bool = True

Every control has visible property which is True by default - control is rendered on the page. Setting visible to False completely prevents control (and all its children if any) from rendering on a page canvas. Hidden controls cannot be focused or selected with a keyboard or mouse and they do not emit any events.

width #

width: Number | None = None

add #

add(*controls: Control) -> None

Adds controls to the page.

page.add(ft.Text("Hello!"), ft.FilledButton("Button"))

before_event #

before_event(e: ControlEvent)

before_update #

before_update()

clean #

clean() -> None

close #

close(control: DialogControl) -> None

did_mount #

did_mount()

init #

init()

insert #

insert(at: int, *controls: Control) -> None

Inserts controls at specific index of page.controls list.

is_isolated #

is_isolated()

open #

open(control: DialogControl) -> None

pop_dialog #

pop_dialog() -> DialogControl | None

remove #

remove(*controls: Control) -> None

Removes specific controls from page.controls list.

remove_at #

remove_at(index: int) -> None

Remove controls from page.controls list at specific index.

scroll_to #

scroll_to(
    offset: Number | None = None,
    delta: Number | None = None,
    scroll_key: str
    | int
    | float
    | bool
    | ScrollKey
    | None = None,
    duration: DurationValue | None = None,
    curve: AnimationCurve | None = None,
) -> None

Moves scroll position to either absolute offset, relative delta or jump to the control with specified scroll_key.

See Column.scroll_to() for method details and examples.

show_dialog #

show_dialog(dialog: DialogControl) -> None

TBD

update #

update(*controls) -> None

will_unmount #

will_unmount()