• Greg Spencer's avatar
    Implement focus traversal for desktop platforms, shoehorn edition. (#30040) · 4218c0bc
    Greg Spencer authored
    Implements focus traversal for desktop platforms, including re-implementing the existing focus manager and focus tree.
    
    This implements a Focus widget that can be put into a widget tree to allow input focus to be given to a particular part of a widget tree.
    
    It incorporates with the existing FocusScope and FocusNode infrastructure, and has minimal breakage to the API, although FocusScope.reparentIfNeeded is removed, replaced by a call to FocusAttachment.reparent(), so this is a breaking change:
    
    FocusScopeNodes must now be attached to the focus tree using FocusScopeNode.attach, which takes a context and an optional onKey callback, and returns a FocusAttachment that should be kept by the widget that hosts the FocusScopeNode. This is necessary because of the need to make sure that the focus tree reflects the widget hierarchy.
    
    Callers that used to call FocusScope(context).reparentIfNeeded in their build method will call reparent  on a FocusAttachment instead, which they will obtain by calling FocusScopeNode.attach in their initState method. Widgets that own FocusNodes will need to call dispose on the focus node in their dispose method.
    
    Addresses #11344, #1608, #13264, and #1678
    Fixes #30084
    Fixes #26704
    4218c0bc
Name
Last commit
Last update
..
flutter Loading commit data...
flutter_driver Loading commit data...
flutter_goldens Loading commit data...
flutter_goldens_client Loading commit data...
flutter_localizations Loading commit data...
flutter_test Loading commit data...
flutter_tools Loading commit data...
fuchsia_remote_debug_protocol Loading commit data...
analysis_options.yaml Loading commit data...