build method
Describes the part of the user interface represented by this widget.
Implementation
@override
Widget build(BuildContext context) {
_updateListener();
return Focus(
focusNode: _focusNode,
onFocusChange: (hasFocus) {
widget.focused = hasFocus;
widget.onFocusChange?.call(hasFocus);
if (mounted) {
setState(() {}); // Redraw cursor highlight
}
},
onKeyEvent: (event) =>
widget.handleKeyEvent(event) ||
(widget.onKeyEvent?.call(event) ?? false),
child: _TextFieldRenderWidget(widget, _focusNode),
);
}