跳到主要内容

CupertinoActionSheetAction

一个通常用于CupertinoActionSheet中的操作按钮。

示例

在线示例

基本示例

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)

属性

content

在此操作按钮中显示的子控件。如果同时提供了textcontent,则使用content

is_default_action

是否此操作应具有强调的默认操作样式。

默认值为False.

is_destructive_action

是否此操作应具有破坏性操作样式。默认值为False.

text

按钮中显示的文本。如果同时提供了textcontent,则使用content

事件

on_click

点击此操作按钮时触发。