View
Inherits: ScrollableControl, LayoutControl
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
-
appbar(Optional[Union[AppBar, CupertinoAppBar]]) –An
AppBarcontrol to display at the top of thePage. -
bgcolor(Optional[ColorValue]) –Background color of the view.
-
bottom_appbar(Optional[BottomAppBar]) –A
BottomAppBarcontrol to display at the bottom of thePage. -
can_pop(bool) –Whether the view can be popped.
-
controls(list[BaseControl]) –A list of controls to display.
-
decoration(Optional[BoxDecoration]) –The background decoration.
-
drawer(Optional[NavigationDrawer]) –A
NavigationDrawercontrol to display as a panel sliding from the start edge of the view. -
end_drawer(Optional[NavigationDrawer]) –A
NavigationDrawercontrol to display as a panel sliding from the end edge of the view. -
floating_action_button(Optional[FloatingActionButton]) –A
FloatingActionButtoncontrol to display on top ofPagecontent. -
floating_action_button_location(Optional[Union[FloatingActionButtonLocation, OffsetValue]]) –Describes position of
floating_action_button -
foreground_decoration(Optional[BoxDecoration]) –The foreground decoration.
-
fullscreen_dialog(bool) –If
True, the view is a fullscreen modal dialog. -
horizontal_alignment(CrossAxisAlignment) –How the child Controls should be placed horizontally.
-
navigation_bar(Union[NavigationBar, CupertinoNavigationBar, None]) –A navigation bar (
NavigationBarorCupertinoNavigationBar) control to display at the bottom of thePage. -
padding(Optional[PaddingValue]) –A space between page contents and its edges.
-
route(str) –View's route - not currently used by Flet framework, but can be used in a user program to update
Page.routewhen a view popped. -
services(list[Service]) –A list of
Servicecontrols associated with this view. -
spacing(Number) –The vertical spacing between
controlson thePage. -
vertical_alignment(MainAxisAlignment) –Defines how the child
controlsshould be placed vertically.
Events
-
on_confirm_pop(Optional[ControlEventHandler[View]]) –An event handler that is called when the view is about to be popped.
Methods
-
close_drawer–Close the drawer.
-
close_end_drawer–Close the end drawer.
-
confirm_pop– -
show_drawer–Show the drawer.
-
show_end_drawer–Show the end drawer.
Properties#
appbar
class-attribute
instance-attribute
#
appbar: Optional[Union[AppBar, CupertinoAppBar]] = None
An AppBar control to display at the top of the Page.
bgcolor
class-attribute
instance-attribute
#
bgcolor: Optional[ColorValue] = None
Background color of the view.
bottom_appbar
class-attribute
instance-attribute
#
bottom_appbar: Optional[BottomAppBar] = None
A BottomAppBar control to display at the bottom of the Page.
controls
class-attribute
instance-attribute
#
controls: list[BaseControl] = field(default_factory=list)
A list of controls to display.
decoration
class-attribute
instance-attribute
#
decoration: Optional[BoxDecoration] = None
The background decoration.
drawer
class-attribute
instance-attribute
#
drawer: Optional[NavigationDrawer] = None
A NavigationDrawer control to display as a panel sliding from the start edge of the view.
end_drawer
class-attribute
instance-attribute
#
end_drawer: Optional[NavigationDrawer] = None
A NavigationDrawer control to display as a panel sliding from the end edge of the view.
floating_action_button
class-attribute
instance-attribute
#
floating_action_button: Optional[FloatingActionButton] = (
None
)
A FloatingActionButton control to display on top of Page content.
floating_action_button_location
class-attribute
instance-attribute
#
floating_action_button_location: Optional[
Union[FloatingActionButtonLocation, OffsetValue]
] = None
Describes position of floating_action_button
foreground_decoration
class-attribute
instance-attribute
#
foreground_decoration: Optional[BoxDecoration] = None
The foreground decoration.
fullscreen_dialog
class-attribute
instance-attribute
#
fullscreen_dialog: bool = False
If True, the view is a fullscreen modal dialog.
horizontal_alignment
class-attribute
instance-attribute
#
horizontal_alignment: CrossAxisAlignment = START
How the child Controls should be placed horizontally.
navigation_bar
class-attribute
instance-attribute
#
navigation_bar: Union[
NavigationBar, CupertinoNavigationBar, None
] = None
A navigation bar (NavigationBar or CupertinoNavigationBar) control to display at the bottom of the Page.
padding
class-attribute
instance-attribute
#
padding: Optional[PaddingValue] = field(
default_factory=lambda: all(10)
)
A space between page contents and its edges.
route
class-attribute
instance-attribute
#
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.
spacing
class-attribute
instance-attribute
#
spacing: Number = 10
The vertical spacing between controls on the Page.
Note
Has effect only when vertical_alignment
is set to MainAxisAlignment.START,
MainAxisAlignment.END, or MainAxisAlignment.CENTER.
vertical_alignment
class-attribute
instance-attribute
#
vertical_alignment: MainAxisAlignment = START
Defines how the child controls should be placed vertically.
Events#
on_confirm_pop
class-attribute
instance-attribute
#
on_confirm_pop: Optional[ControlEventHandler[View]] = 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.