Duplicate Check
Describe the requested feature
Add a property to the AutoComplete control to capture and handle user input when it does not match any provided suggestions.
Currently, the AutoComplete control in Flet only provides functionality for users to select from predefined suggestions. It would be beneficial to add a property or event handler to capture and process user input regardless of whether it matches the provided suggestions. This feature will allow developers to handle scenarios where users input custom values, enhancing the flexibility and usability of the AutoComplete control.
Suggest a solution
Add a value property to the AutoComplete control. This property should reflect the current input value of the AutoComplete, whether it matches a suggestion or is a custom user input.
Example Implementation:
import flet as ft
def main(page: ft.Page):
def on_value_select(e):
print(f"Current input value: {e.control.value}")
page.add(
ft.AutoComplete(
suggestions=[
ft.AutoCompleteSuggestion(key="one 1", value="One"),
ft.AutoCompleteSuggestion(key="two 2", value="Two"),
ft.AutoCompleteSuggestion(key="three 3", value="Three"),
],
value="", # New property to capture the input value
on_select=on_value_select
)
)
ft.app(target=main)
Screenshots
No response
Additional details
No response
Duplicate Check
Describe the requested feature
Add a property to the AutoComplete control to capture and handle user input when it does not match any provided suggestions.
Currently, the AutoComplete control in Flet only provides functionality for users to select from predefined suggestions. It would be beneficial to add a property or event handler to capture and process user input regardless of whether it matches the provided suggestions. This feature will allow developers to handle scenarios where users input custom values, enhancing the flexibility and usability of the AutoComplete control.
Suggest a solution
Add a value property to the AutoComplete control. This property should reflect the current input value of the AutoComplete, whether it matches a suggestion or is a custom user input.
Example Implementation:
Screenshots
No response
Additional details
No response