Hello I would like to validate the textfieldinput of a user when the textfield loses it's focus. I could only change the focusstate with the FocusNode but couldnt listen to it. Is there any way to listen to state changes of the FocusNode?
TextEditingController displayNameController = TextEditingController();
late FocusNode myFocusNode;
void initState() {
super.initState();
myFocusNode = FocusNode();
...
}
....
TextField(
focusNode: myFocusNode,
readOnly: currentview == 2 ? false : true,
textAlign: TextAlign.center,
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
isDense: true,
border: InputBorder.none,
//changeup!!
errorText: _displayNameValid ? null : 'Bad characters'
),
style: Theme.of(context).textTheme.bodyText2!.copyWith(
color: AppTheme.white70,
),
controller: displayNameController,
),