主题
CupertinoTimerPickerMode 继承自: Enum
Different modes of CupertinoTimerPicker.
示例
python
import flet as ft
def showcase_card(mode: ft.CupertinoTimerPickerMode) -> ft.Container:
return ft.Container(
width=340,
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(mode.name, weight=ft.FontWeight.BOLD),
ft.CupertinoTimerPicker(
mode=mode,
value=ft.Duration(seconds=754),
),
],
),
)
def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.appbar = ft.AppBar(title="CupertinoTimerPickerMode Showcase")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Text("Compare timer picker layouts."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[
showcase_card(mode) for mode in ft.CupertinoTimerPickerMode
],
),
],
),
)
)
if __name__ == "__main__":
ft.run(main)枚举值
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
HOUR_MINUTE | — | 'hm' | Mode that shows the timer duration in hour and minute. Examples: `16 hours \ |
HOUR_MINUTE_SECONDS | — | 'hms' | Mode that shows the timer duration in hour, minute, and second. Examples: `16 hours \ |
MINUTE_SECONDS | — | 'ms' | Mode that shows the timer duration in minute and second. Examples: `14 min \ |