DatePicker formatting #4274
ClearSafety
started this conversation in
Ideas
Replies: 1 comment
-
When PR #4278 get merged you will be able to define this from the theme, as follows: import datetime
import flet as ft
def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.theme_mode = ft.ThemeMode.LIGHT
page.theme = page.dark_theme = ft.Theme(
date_picker_theme=ft.DatePickerTheme(
bgcolor=ft.Colors.RED,
year_bgcolor=ft.Colors.GREEN,
cancel_button_style=ft.ButtonStyle(
color=ft.Colors.YELLOW, bgcolor=ft.Colors.RED
),
confirm_button_style=ft.ButtonStyle(
color=ft.Colors.GREEN, bgcolor=ft.Colors.RED
),
)
)
def handle_change(e):
page.add(ft.Text(f"Date changed: {e.control.value.strftime('%Y-%m-%d')}"))
def handle_dismissal(e):
page.add(ft.Text(f"DatePicker dismissed"))
page.add(
ft.ElevatedButton(
"Pick date",
icon=ft.icons.CALENDAR_MONTH,
on_click=lambda e: page.open(
ft.DatePicker(
first_date=datetime.datetime(year=2023, month=10, day=1),
last_date=datetime.datetime(year=2025, month=10, day=1),
on_change=handle_change,
on_dismiss=handle_dismissal,
)
),
)
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to suggest to be implemented in the DatePicker control properties that makes it possible one changes the formatting of it, like the color of the selected date, or event the formatting (shadow, bgcolor, textcolor) of the buttons 'Ok' | 'Cancel'
Beta Was this translation helpful? Give feedback.
All reactions