CupertinoBottomSheet
一种 iOS 风格的底部弹出框。
要打开此控件,只需调用page.open()
辅助方法。
示例
基本示例
- Python
import flet as ft
def main(page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
def handle_click(e):
page.add(ft.Text(f"Action clicked: {e.control.content.value}"))
page.close(bottom_sheet)
action_sheet = ft.CupertinoActionSheet(
title=ft.Row([ft.Text("Title")], alignment=ft.MainAxisAlignment.CENTER),
message=ft.Row([ft.Text("Description")], alignment=ft.MainAxisAlignment.CENTER),
cancel=ft.CupertinoActionSheetAction(
content=ft.Text("Cancel"),
on_click=handle_click,
),
actions=[
ft.CupertinoActionSheetAction(
content=ft.Text("Default Action"),
is_default_action=True,
on_click=handle_click,
),
ft.CupertinoActionSheetAction(
content=ft.Text("Normal Action"),
on_click=handle_click,
),
ft.CupertinoActionSheetAction(
content=ft.Text("Destructive Action"),
is_destructive_action=True,
on_click=handle_click,
),
],
)
bottom_sheet = ft.CupertinoBottomSheet(action_sheet)
page.add(
ft.CupertinoFilledButton(
"Open CupertinoBottomSheet",
on_click=lambda e: page.open(bottom_sheet),
)
)
ft.app(main)

属性
bgcolor
底部弹出框的背景颜色。
content
底部弹出框的内容。
height
底部弹出框的高度。
modal
是否可以通过点击外部区域来关闭此底部弹出框。
open
设置为 True
以显示底部弹出框。
padding
弹出框的内边距。该值是 Padding
类型值。
事件
on_dismiss
当底部弹出框关闭时触发。