flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.55k stars 452 forks source link

feat: Add `{value_length}`, `{max_length}`, and `{symbols_left}` placeholders to `TextField.counter_text` #4403

Closed ndonkoHenri closed 3 days ago

ndonkoHenri commented 6 days ago

Closes #1534

Test Code

import flet as ft

def main(page: ft.Page):
    page.add(
        ft.TextField(
            hint_text="Custom counter text",
            counter_text="{value_length} chars / {max_length} max chars / {symbols_left} symbols left",
            max_length=10,
        ),
        ft.TextField(
            hint_text="Counter text isn't shown by default anymore",
            max_length=20,
        ),
    )

ft.app(main)

Summary by Sourcery

Add new placeholders to TextField.counter_text for dynamic character count display, enhancing the user interface with real-time feedback on text input length.

New Features:

Enhancements: