CupertinoBottomSheet
Inherits: DialogControl
Properties
-
bgcolor
(ColorValue | None
) –The background color of this bottom sheet.
-
content
(Control
) –The control to be displayed in this bottom sheet.
-
height
(Number | None
) –The height of this bottom sheet.
-
modal
(bool
) –Whether this bottom sheet can be dismissed/closed by
-
padding
(PaddingValue | None
) –The sheet's padding.
Examples#
Displaying a CupertinoActionSheet
#
import flet as ft
def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
def handle_click(e):
page.add(ft.Text(f"Action clicked: {e.control.content.value}"))
page.pop_dialog()
action_sheet = ft.CupertinoActionSheet(
title=ft.Row(
controls=[ft.Text("Title"), ft.Icon(ft.Icons.BEDTIME)],
alignment=ft.MainAxisAlignment.CENTER,
),
message=ft.Row(
controls=[ft.Text("Description"), ft.Icon(ft.Icons.AUTO_AWESOME)],
alignment=ft.MainAxisAlignment.CENTER,
),
cancel=ft.CupertinoActionSheetAction(
content=ft.Text("Cancel"),
on_click=handle_click,
),
actions=[
ft.CupertinoActionSheetAction(
content=ft.Text("Default Action"),
default=True,
on_click=handle_click,
),
ft.CupertinoActionSheetAction(
content=ft.Text("Normal Action"),
on_click=handle_click,
),
ft.CupertinoActionSheetAction(
content=ft.Text("Destructive Action"),
destructive=True,
on_click=handle_click,
),
],
)
bottom_sheet = ft.CupertinoBottomSheet(action_sheet)
page.add(
ft.CupertinoFilledButton(
content="Open CupertinoBottomSheet",
on_click=lambda e: page.show_dialog(bottom_sheet),
)
)
ft.run(main)