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:
Introduce placeholders {value_length}, {max_length}, and {symbols_left} in TextField.counter_text to dynamically display character count information.
Enhancements:
Modify buildInputDecoration to support dynamic counter text with new placeholders.
Closes #1534
Test Code
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:
{value_length}
,{max_length}
, and{symbols_left}
inTextField.counter_text
to dynamically display character count information.Enhancements:
buildInputDecoration
to support dynamic counter text with new placeholders.