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.

Properties

route

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

controls

A list of Controls to display on the Page.

For example, to add a new control to a page:

page.controls.append(Text("Hello!"))
page.update()

or to get the same result as above using page.add() shortcut method:

page.add(Text("Hello!"))

To remove the top most control on the page:

page.controls.pop()
page.update()

horizontal_alignment

How the child Controls should be placed horizontally.

Default value is start which means on the left side of the Page. Supported values: start, center, end, stretch, baseline.

vertical_alignment

How the child Controls should be placed vertically.

For example, start, the default, places the children at the top of a Page. Supported values: start, end, center, spaceBetween, spaceAround, spaceEvenly.

spacing

Vertical spacing between controls on the Page. Default value is 10 virtual pixels. Spacing is applied only when alignment is set to start, end or center.

padding

A space between page contents and its edges. Default value is 10 pixels from each side. To set zero padding:

page.padding = 0
page.update()

See Container.padding for more information and possible values.

bgcolor

Background color of the Page.

A color value could be a hex value in #ARGB format (e.g. #FFCC0000), #RGB format (e.g. #CC0000) or a named color from flet.colors module.

scroll

Enables a vertical scrolling for the Page to prevent its content overflow. Supported values:

  • none (default) - the Page is non-scrollable and its content could overflow.
  • auto - scrolling is enabled and scroll bar is only shown when scrolling occurs.
  • adaptive - scrolling is enabled and scroll bar is always shown when running app as web or desktop.
  • always - scrolling is enabled and scroll bar is always shown.
  • hidden - scrolling is enabled, but scroll bar is always hidden.

auto_scroll

True if scrollbar should automatically move its position to the end when children update.

appbar

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

floating_action_button

A FloatingActionButton control to display on top of Page content.