FloatingActionButtonLocation
Defines a position for the FloatingActionButton.
Inherits: enum.Enum
Properties
CENTER_DOCKED- CenteredFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.CENTER_FLOAT- CenteredFloatingActionButton, floating at the bottom of the screen.CENTER_TOP- CenteredFloatingActionButton, floating over the transition between theAppBarand the page body.END_CONTAINED- End-alignedFloatingActionButton, floating over a bottom navigation control so the button lines up with that control's center.END_DOCKED- End-alignedFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.END_FLOAT- End-alignedFloatingActionButton, floating at the bottom of the screen.END_TOP- End-alignedFloatingActionButton, floating over the transition between theAppBarand the page body.MINI_CENTER_DOCKED- Centered miniFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.MINI_CENTER_FLOAT- Centered miniFloatingActionButton, floating at the bottom of the screen.MINI_CENTER_TOP- Centered miniFloatingActionButton, floating over the transition between theAppBarand the page body.MINI_END_DOCKED- End-aligned miniFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.MINI_END_FLOAT- End-aligned miniFloatingActionButton, floating at the bottom of the screen.MINI_END_TOP- End-aligned miniFloatingActionButton, floating over the transition between theAppBarand the page body.MINI_START_DOCKED- Start-aligned miniFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.MINI_START_FLOAT- Start-aligned miniFloatingActionButton, floating at the bottom of the screen.MINI_START_TOP- Start-aligned miniFloatingActionButton, floating over the transition between theAppBarand the page body.START_DOCKED- Start-alignedFloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.START_FLOAT- Start-alignedFloatingActionButton, floating at the bottom of the screen.START_TOP- Start-alignedFloatingActionButton, floating over the transition between theAppBarand the page body.
Examples
Floating Action Button Location showcase
import flet as ft
def showcase_card(location: ft.FloatingActionButtonLocation) -> ft.Container:
mini = location.name.startswith("MINI_")
return ft.Container(
width=300,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(location.name, weight=ft.FontWeight.BOLD),
ft.Pagelet(
width=260,
height=200,
bgcolor=ft.Colors.SURFACE,
appbar=ft.AppBar(
title=ft.Text("AppBar", size=12),
center_title=True,
toolbar_height=38,
bgcolor=ft.Colors.PRIMARY_CONTAINER,
),
content=ft.Container(
alignment=ft.Alignment.CENTER,
content=ft.Text("Body", size=12),
),
bottom_appbar=ft.BottomAppBar(
height=42,
bgcolor=ft.Colors.SECONDARY_CONTAINER,
),
floating_action_button=ft.FloatingActionButton(
icon=ft.Icons.ADD,
mini=mini,
bgcolor=ft.Colors.LIGHT_BLUE_400,
),
floating_action_button_location=location,
),
],
),
)
def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.appbar = ft.AppBar(title="FloatingActionButtonLocation Showcase")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Text("Compare FloatingActionButton placement presets."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[
showcase_card(location)
for location in ft.FloatingActionButtonLocation
],
),
],
),
)
)
if __name__ == "__main__":
ft.run(main)
Properties
CENTER_DOCKEDclass-attributeinstance-attribute
Centered FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Not typically useful for apps without a bottom navigation control.
CENTER_FLOATclass-attributeinstance-attribute
Centered FloatingActionButton, floating at the bottom of the screen.
Use MINI_CENTER_FLOAT for mini buttons.
CENTER_TOPclass-attributeinstance-attribute
Centered FloatingActionButton, floating over the transition between the AppBar and the page body.
Not typically useful for apps without a top AppBar.
END_CONTAINEDclass-attributeinstance-attribute
End-aligned FloatingActionButton, floating over a bottom navigation control so the button lines up with that control's center.
Not typically useful for apps with a NavigationBar or a non-Material 3 BottomAppBar.
END_DOCKEDclass-attributeinstance-attribute
End-aligned FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Not typically useful for apps without a bottom navigation control.
END_FLOATclass-attributeinstance-attribute
End-aligned FloatingActionButton, floating at the bottom of the screen.
This is the default alignment in Material apps. Use MINI_END_FLOAT for mini buttons.
END_TOPclass-attributeinstance-attribute
End-aligned FloatingActionButton, floating over the transition between the AppBar and the page body.
Not typically useful for apps without a top AppBar.
MINI_CENTER_DOCKEDclass-attributeinstance-attribute
Centered mini FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Intended for use with mini buttons.
MINI_CENTER_FLOATclass-attributeinstance-attribute
Centered mini FloatingActionButton, floating at the bottom of the screen.
Intended for use with mini buttons.
MINI_CENTER_TOPclass-attributeinstance-attribute
Centered mini FloatingActionButton, floating over the transition between the AppBar and the page body.
Intended for use with mini buttons.
MINI_END_DOCKEDclass-attributeinstance-attribute
End-aligned mini FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Intended for use with mini buttons.
MINI_END_FLOATclass-attributeinstance-attribute
End-aligned mini FloatingActionButton, floating at the bottom of the screen.
Intended for use with mini buttons.
MINI_END_TOPclass-attributeinstance-attribute
End-aligned mini FloatingActionButton, floating over the transition between the AppBar and the page body.
Intended for use with mini buttons.
MINI_START_DOCKEDclass-attributeinstance-attribute
Start-aligned mini FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Intended for use with mini buttons.
MINI_START_FLOATclass-attributeinstance-attribute
Start-aligned mini FloatingActionButton, floating at the bottom of the screen.
Intended for use with mini buttons.
MINI_START_TOPclass-attributeinstance-attribute
Start-aligned mini FloatingActionButton, floating over the transition between the AppBar and the page body.
Intended for use with mini buttons.
START_DOCKEDclass-attributeinstance-attribute
Start-aligned FloatingActionButton, floating over a bottom navigation control so the button's center lines up with the top of that control.
Not typically useful for apps without a bottom navigation control.
START_FLOATclass-attributeinstance-attribute
Start-aligned FloatingActionButton, floating at the bottom of the screen.
Use MINI_START_FLOAT for mini buttons.
START_TOPclass-attributeinstance-attribute
Start-aligned FloatingActionButton, floating over the transition between the AppBar and the page body.
Not typically useful for apps without a top AppBar.