Skip to main content

View

View is the top most container for all other controls.

A root view is automatically created when a new user session started. From layout perspective the View represents a Column control, so it has a similar behavior and shares same properties.

Inherits: ScrollableControl

Properties

Events

Methods

Properties​

alignclass-attributedeprecatedinstance-attribute​

align: Alignment | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_alignclass-attributedeprecatedinstance-attribute​

animate_align: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_marginclass-attributedeprecatedinstance-attribute​

animate_margin: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_offsetclass-attributedeprecatedinstance-attribute​

animate_offset: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_opacityclass-attributedeprecatedinstance-attribute​

animate_opacity: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_positionclass-attributedeprecatedinstance-attribute​

animate_position: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_rotationclass-attributedeprecatedinstance-attribute​

animate_rotation: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_scaleclass-attributedeprecatedinstance-attribute​

animate_scale: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

animate_sizeclass-attributedeprecatedinstance-attribute​

animate_size: AnimationValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

appbarclass-attributeinstance-attribute​

appbar: AppBar | CupertinoAppBar | None = None

An AppBar control to display at the top of the Page.

aspect_ratioclass-attributedeprecatedinstance-attribute​

aspect_ratio: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

bgcolorclass-attributeinstance-attribute​

bgcolor: ColorValue | None = None

Background color of the view.

bottomclass-attributedeprecatedinstance-attribute​

bottom: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

bottom_appbarclass-attributeinstance-attribute​

bottom_appbar: BottomAppBar | None = None

A BottomAppBar control to display at the bottom of the Page.

can_popclass-attributeinstance-attribute​

can_pop: bool = True

Whether the view can be popped.

controlsclass-attributeinstance-attribute​

controls: list[BaseControl] = field(default_factory=list)

A list of controls to display.

decorationclass-attributeinstance-attribute​

decoration: BoxDecoration | None = None

The background decoration.

drawerclass-attributeinstance-attribute​

drawer: NavigationDrawer | None = None

A NavigationDrawer control to display as a panel sliding from the start edge of the view.

end_drawerclass-attributeinstance-attribute​

end_drawer: NavigationDrawer | None = None

A NavigationDrawer control to display as a panel sliding from the end edge of the view.

flipclass-attributedeprecatedinstance-attribute​

flip: Flip | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

floating_action_buttonclass-attributeinstance-attribute​

floating_action_button: FloatingActionButton | None = None

A FloatingActionButton control to display on top of Page content.

floating_action_button_locationclass-attributeinstance-attribute​

floating_action_button_location: (
    FloatingActionButtonLocation | OffsetValue | None
) = None

Describes position of floating_action_button

foreground_decorationclass-attributeinstance-attribute​

foreground_decoration: BoxDecoration | None = None

The foreground decoration.

fullscreen_dialogclass-attributeinstance-attribute​

fullscreen_dialog: bool = False

If True, the view is a fullscreen modal dialog.

heightclass-attributedeprecatedinstance-attribute​

height: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

horizontal_alignmentclass-attributeinstance-attribute​

horizontal_alignment: CrossAxisAlignment = (
    CrossAxisAlignment.START
)

How the child Controls should be placed horizontally.

leftclass-attributedeprecatedinstance-attribute​

left: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

marginclass-attributedeprecatedinstance-attribute​

margin: MarginValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

max_heightclass-attributedeprecatedinstance-attribute​

max_height: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

max_widthclass-attributedeprecatedinstance-attribute​

max_width: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

min_heightclass-attributedeprecatedinstance-attribute​

min_height: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

min_widthclass-attributedeprecatedinstance-attribute​

min_width: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

navigation_barclass-attributeinstance-attribute​

navigation_bar: (
    NavigationBar | CupertinoNavigationBar | None
) = None

A navigation bar (NavigationBar or CupertinoNavigationBar) control to display at the bottom of the Page.

offsetclass-attributedeprecatedinstance-attribute​

offset: OffsetValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

paddingclass-attributeinstance-attribute​

padding: PaddingValue | None = field(
    default_factory=lambda: Padding.all(10)
)

A space between page contents and its edges.

rightclass-attributedeprecatedinstance-attribute​

right: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

rotateclass-attributedeprecatedinstance-attribute​

rotate: RotateValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

routeclass-attributeinstance-attribute​

route: str = field(default_factory=lambda: '/')

View's route - not currently used by Flet framework, but can be used in a user program to update Page.route when a view popped.

scaleclass-attributedeprecatedinstance-attribute​

scale: ScaleValue | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

servicesclass-attributeinstance-attribute​

services: list[Service] = field(
    default_factory=list, metadata={"skip": True}
)

A list of Service controls associated with this view.

size_change_intervalclass-attributeinstance-attribute​

size_change_interval: int = 10

Sampling interval in milliseconds for on_size_change event.

Setting to 0 calls on_size_change immediately on every change.

spacingclass-attributeinstance-attribute​

spacing: Number = 10

The vertical spacing between controls on the Page.

topclass-attributedeprecatedinstance-attribute​

top: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

transformclass-attributedeprecatedinstance-attribute​

transform: Transform | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

vertical_alignmentclass-attributeinstance-attribute​

vertical_alignment: MainAxisAlignment = (
    MainAxisAlignment.START
)

Defines how the child controls should be placed vertically.

widthclass-attributedeprecatedinstance-attribute​

width: Number | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

Events​

on_animation_endclass-attributedeprecatedinstance-attribute​

on_animation_end: ControlEventHandler[View] | None = None
Deprecated

Deprecated since version 1.2.0 and scheduled for removal in 1.5.0. A View always fills its page, so this property has no effect.

Has no effect.

on_confirm_popclass-attributeinstance-attribute​

on_confirm_pop: ControlEventHandler[View] | None = None

An event handler that is called when the view is about to be popped. You can use this event to confirm or cancel the pop action by calling confirm_pop method.

on_size_changeclass-attributeinstance-attribute​

on_size_change: (
    EventHandler[LayoutSizeChangeEvent[View]] | None
) = None

Called when the size of this view's body changes.

The body is the area between the app bar and the bottom navigation bar or bottom app bar, including padding. It shrinks while the on-screen keyboard is shown. For the size of the whole window, use Page.on_resize.

size_change_interval defines how often this event is called.

Methods​

close_drawerasync​

close_drawer()

Close the drawer.

close_end_drawerasync​

close_end_drawer()

Close the end drawer.

confirm_popasync​

confirm_pop(should_pop: bool) -> None

Resolves a pending pop-confirmation request for this view.

Call this from on_confirm_pop to allow or cancel the current back-navigation attempt.

Parameters:

  • should_pop (bool) - True to proceed with popping this view, False to keep the view on the navigation stack.
Notes
  • This method only has effect while a pop confirmation is pending.
  • If not called, the frontend confirmation wait times out and the pop is canceled.

show_drawerasync​

show_drawer()

Show the drawer.

Raises:

  • ValueError - If no drawer is defined.

show_end_drawerasync​

show_end_drawer()

Show the end drawer.

Raises: