I want to use a TextField
to allow the user to rename an item in the app. I would like for the new item name to be saved if the user presses the 'done' button on the keyboard but I would also like for the app to treat the user unfocusing
the TextField
without pressing the done button to mean the user canceled the action and the item name should be reverted to the previous name. Is there a way to call a function on unfocus only when the text was not submitted?
Flutter TextField how to detect that the text field was unfocused but not submitted?
680 views Asked by Kulpas At
1
You can achieve this using the
FocusNode
class in Flutter.