BasePage
A visual container representing a top-level view in a Flet application.
BasePage serves as the base class for Page and MultiView,
and provides a unified surface for rendering application content, app bars,
navigation elements, dialogs, overlays, and more. It manages one or more
View instances and exposes high-level layout,
scrolling, and theming properties.
Unlike lower-level layout controls (e.g., Column,
Container), BasePage represents
an entire logical view or screen of the app. It provides direct access
to view-level controls such as AppBar, NavigationBar,
FloatingActionButton, and supports system-level events like window
resizing and media changes.
This class is not intended to be used directly in most apps; instead,
use Page or MultiView, which extend this base
functionality.
Inherits: AdaptiveControl
Properties
appbar- Gets or sets the top application bar (AppBarorCupertinoAppBar) for the view.auto_scroll- Whether root view should auto-scroll to the end on content changes.bgcolor- Background color of the root view.bottom_appbar- Bottom app bar displayed in the root view.controls- Root view content controls displayed by this page.dark_theme- Customizes the theme of the application when in dark theme mode.decoration- Background decoration of the root view container.drawer- Navigation drawer opened from the leading edge.enable_screenshots- Enable taking screenshots of the entire page withtake_screenshotmethod.end_drawer- Navigation drawer opened from the trailing edge.floating_action_button- Floating action button shown for the root view.floating_action_button_location- Placement of the floating action button in the root view.foreground_decoration- Foreground decoration painted above root view content.height- Page height in logical pixels.horizontal_alignment- Horizontal alignment of root view child controls.locale_configuration- Configures supported locales and the current locale.media- The current environmental metrics of the page or window.navigation_bar- Bottom navigation bar for the root view.overlay- The list of overlay controls rendered above page content.padding- Inner padding for the root view content.scroll- Scroll behavior mode for root view content.services- Service instances attached to the root view lifecycle.show_semantics_debugger- Whether to turn on an overlay that shows the accessibility information reported by the framework.spacing- Default spacing between root view child controls.theme- Customizes the theme of the application when in light theme mode.theme_animation_style- Overrides the default animation style used when the application's theme is changed (for example, whentheme_modeswitches between light and dark).theme_mode- The page's theme mode.title- Page or window title.vertical_alignment- Vertical alignment of root view child controls.views- A list of views managed by the page.width- Page width in logical pixels.
Events
on_media_change- Called whenmediahas changed.on_resize- Called when a user resizes a browser or native OS window containing Flet app
Methods
add- Adds controls to the page.before_eventclean- Remove all root view controls and send update to the client.close_drawer- Close the drawer.close_end_drawer- Close the end drawer.insert- Inserts controls at specific index ofpage.controlslist.pop_dialog- Closes the most recently opened dialog.remove- Removes specific controls frompage.controlslist.remove_at- Remove controls frompage.controlslist at specific index.scroll_to- Moves scroll position to either absoluteoffset, relativedeltaor jump to the control with specifiedscroll_key.show_dialog- Displays a dialog and manages its dismissal lifecycle.show_drawer- Show the drawer.show_end_drawer- Show the end drawer.take_animation- Captures an animated sequence of page screenshots in a single round-trip.take_screenshot- Captures a screenshot of the entire page with overlays.update- Push pending updates to the connected client.
Properties
appbarpropertywritable
appbar: AppBar | CupertinoAppBar | NoneGets or sets the top application bar (AppBar or CupertinoAppBar) for the view.
The app bar typically displays the page title and optional actions such as navigation icons, menus, or other interactive elements.
auto_scrollpropertywritable
auto_scroll: boolWhether root view should auto-scroll to the end on content changes.
bottom_appbarpropertywritable
bottom_appbar: BottomAppBar | NoneBottom app bar displayed in the root view.
controlspropertywritable
controls: list[BaseControl]Root view content controls displayed by this page.
dark_themeclass-attributeinstance-attribute
dark_theme: Theme | None = NoneCustomizes the theme of the application when in dark theme mode.
decorationpropertywritable
decoration: BoxDecoration | NoneBackground decoration of the root view container.
drawerpropertywritable
drawer: NavigationDrawer | NoneNavigation drawer opened from the leading edge.
enable_screenshotsclass-attributeinstance-attribute
enable_screenshots: bool = FalseEnable taking screenshots of the entire page with take_screenshot method.
end_drawerpropertywritable
end_drawer: NavigationDrawer | NoneNavigation drawer opened from the trailing edge.
floating_action_buttonpropertywritable
floating_action_button: FloatingActionButton | NoneFloating action button shown for the root view.
floating_action_button_locationpropertywritable
floating_action_button_location: (
FloatingActionButtonLocation | OffsetValue | None
)Placement of the floating action button in the root view.