-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
In order to be able to perform focus-based navigation, it is necessary to know the size and location of widgets that might be traversed to.
This is a tracking issue for the breaking change needed to collect this information, in order to fix #1608.
Currently, FocusScopeNode.reparentIfNeeded takes only the FocusNode that it will reparent. In order to provide services needed for keyboard focus traversal, this method will need to provide a BuildContext in order to be able to measure its size and location when determining the next widget to traverse to.
We propose to break the FocusScopeNode API by changing it's signature from:
void reparentIfNeeded(FocusNode node);to
void reparentIfNeeded(BuildContext context, FocusNode node);To modify code to compile again after this change, you would need to add a context argument to the call. Typically, this method is called from a build method in order to keep the focus tree up to date with the widget tree, so instead of calling:
FocusScope.of(context).reparentIfNeeded(focusNode);You would instead call:
FocusScope.of(context).reparentIfNeeded(context, focusNode);