• 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
.github Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.cirrus.yml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...