• Greg Spencer's avatar
    Fix Focus.of to not find FocusScope nodes. (#32826) · 3c16cf6a
    Greg Spencer authored
    Until this change, Focus.of would return a FocusScopeNode if it found a FocusScope widget. This isn't really all that useful, and can easily lead to bad situations where many widgets think that the scope they are in (or the root scope!) is their indication of being focused.
    
    This changes Focus.of to throw an exception if it doesn't find a Focus widget before reaching the nearest FocusScope widget, or the root of the widget hierarchy.
    
    It also adds a nullOk optional bool to Focus.of so that if a caller expects to not find a Focus widget, it can deal with that as it sees fit. I modified InkWell to use this new behavior.
    
    This fixes an unreported issue that widgets using an InkWell will be drawn as focused the first time they are visited.
    3c16cf6a
Name
Last commit
Last update
..
animation Loading commit data...
cupertino Loading commit data...
examples Loading commit data...
foundation Loading commit data...
gestures Loading commit data...
harness Loading commit data...
material Loading commit data...
painting Loading commit data...
physics Loading commit data...
rendering Loading commit data...
scheduler Loading commit data...
semantics Loading commit data...
services Loading commit data...
widgets Loading commit data...
flutter_test_alternative.dart Loading commit data...
flutter_test_config.dart Loading commit data...