wrapWithFocus method
- Widget child
Wraps child with the Focus node used to drive
AutovalidateMode.onUnfocus validation.
Subclasses whose builder returns a sliver override focusIncludesSemantics to disable Focus's own Semantics wrapper, which is a render-box widget.
See also:
- focusIncludesSemantics, which controls whether the Focus node adds its own Semantics node.
- wrapWithSemantics, which wraps the result of FormField.builder before this method runs.
Implementation
@protected
Widget wrapWithFocus(Widget child) {
return Focus(
canRequestFocus: false,
skipTraversal: true,
includeSemantics: focusIncludesSemantics,
onFocusChange: (bool value) {
if (!value) {
setState(() {
_validate();
});
}
},
focusNode: _focusNode,
child: child,
);
}