- 13 Jan, 2020 1 commit
-
-
Greg Spencer authored
This changes the behavior of requestFocus when it is called on a FocusNode that does not yet have a parent, so that it defers requesting focus until it receives a parent. Before this change, calling requestFocus before it had a parent was a no-op. This allows scenarios where a widget is newly added and wishes to immediately request the focus. Previously, it was very hard to make that work because requesting focus before the widget's focus node had a parent was ignored, so the developer had to wait until two frames later to request focus (one for the widget's node to be added to the focus tree, and one to request the focus). Now, in order to have a widget be focused when initially added, you just need to call requestFocus on its node when you create it, and as soon as it is added, it will automatically request focus. This is different from the autofocus attribute on the Focus widget, because it unconditionally requests focus when added (autofocus will only request focus if nothing else in the scope has focus).
-
- 08 Jan, 2020 1 commit
-
-
Greg Spencer authored
-
- 07 Jan, 2020 1 commit
-
-
Alexandre Ardhuin authored
-
- 05 Dec, 2019 2 commits
-
-
Greg Spencer authored
This fixes an issue where lines like this: focusNode.canRequestFocus = widget.canRequestFocus ?? focusNode.canRequestFocus; Were causing the canRequestFocus bit to copy the status of the enclosing scope, since canRequestFocus also looks to the enclosing scope to decide if it can focus.
-
Greg Spencer authored
This normalizes all of the "See also" blocks in comments so that they conform in style. They all look like this now: /// See also: /// /// * [MyFavoriteWidget], because it's cool. class Foo {} I removed some useless "See also" blocks, and added commentary to ones that were just "bare" references. This is my penance for adding so many bullets that are "-" instead of "*". :-)
-
- 04 Dec, 2019 1 commit
-
-
Alexandre Ardhuin authored
* implicit-casts:false in flutter/lib/src/widgets * address review comments * address review comment
-
- 03 Dec, 2019 1 commit
-
-
Greg Spencer authored
This fixes some minor things I noticed while doing another change. - Uncomments an old test that wants to be run, but can't be, and marked it as "skipped", so that the code won't rot anymore. - Added the focus state to the short string version of a FocusNode - Added a missing piece of information to findAncestorWidgetOfExactType
-
- 27 Nov, 2019 1 commit
-
-
Ian Hickson authored
* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
-
- 22 Nov, 2019 1 commit
-
-
Greg Spencer authored
No code changes, just comments: I spell-checked all the comments in the repo.
-
- 01 Nov, 2019 1 commit
-
-
Greg Spencer authored
This adds accessors for WidgetsBinding.instance.focusManager and WidgetsBinding.instance.focusManager.primaryFocus so that they can be more easily found in IDEs and accessed. This adds a top level getter for WidgetsBinding.instance.focusManager.primaryFocus called primaryFocus, and a static accessor FocusManager.instance that returns WidgetsBinding.instance.focusManager.
-
- 30 Oct, 2019 1 commit
-
-
Greg Spencer authored
This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43213), with fixes for the web tests that weren't enabled in the master that it was synced to when I first landed it.
-
- 28 Oct, 2019 2 commits
-
-
Greg Spencer authored
Revert "Re-Land: Add focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43384)" (#43647) This reverts commit 8017f63b, since it breaks web tests.
-
Greg Spencer authored
This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43213) No changes from original, except for finding the right RenderBox in dev/integration_tests/android_semantics_testing/test_driver/main_test.dart.
-
- 23 Oct, 2019 2 commits
-
-
Jonah Williams authored
Revert "Add focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43213)" (#43367) This reverts commit 90006720.
-
Greg Spencer authored
In order to enable keyboard navigation to more controls, I've added focus nodes to switches, checkboxes, and radio buttons. In addition, this change enables mouse hover over these controls. - Added tests for focus, hover, and shortcut activation for Checkbox, Radio, and Switch.
-
- 18 Oct, 2019 1 commit
-
-
Greg Spencer authored
This adds a canRequestFocus and skipTraversal argument to FocusScope and FocusScopeNode, so that a scope can prevent being traversed. This allows a fix for a problem in the gallery where the focus while traversing the list of items would sometimes appear to disappear, since it would be focusing things that were in the backdrop that were part of the tree, but were not visible. Related Issues Fixes #42955
-
- 15 Oct, 2019 1 commit
-
-
Greg Spencer authored
This optimizes certain paths in the FocusManager, FocusNode, and FocusScopeNode classes in order to fix a regression in stock_animation_open_first_frame_average when I added more focus nodes to the tree to do focus traversal. Mainly I removed some remaining sync* iterators, and also started caching the computation of descendants and ancestors, since those are iterated over fairly often. This improves stock_animation_open_first_frame_average by about 2.8% overall (so about half of a 4.9% regression, both averaged over 10 runs). Addresses #42564
-
- 14 Oct, 2019 1 commit
-
-
Greg Spencer authored
This fixes a problem with reparenting of focus nodes where it would remove the node from the scope's focused children when reparented, even if it was being reparented to another place under the same scope. This only occurred if the scope in question didn't have focus. This caused nodes to not get autofocused when they were a child of another node within the scope, and were reparented, and then the scope was given focus (as when a route is pushed). This keeps the node in the scope's child list where it was if the node is reparented under a parent within the same scope. - Added a test that tries to autofocus a TextField when the route is pushed and there is another FocusNode above the text field. This was how this was first noticed: the autofocus got ignored in this configuration. - Added a test to focus_manager_test that tests for the specific case of reparenting a node when it's in the focused children of the scope.
-
- 26 Sep, 2019 2 commits
-
-
Greg Spencer authored
This changes the way ActionDispatchers are found by the Actions widget, so that by default it will look for dispatchers of the parent Actions widgets instead of just creating a default ActionDispatcher. This allows overriding of the ActionDispatcher at the top level: before, the custom action dispatcher would only be invoked if explicitly set on all the Actions widgets. This is not a breaking change because there was a default value to the dispatcher parameter before that performed this function, and not specifying the dispatcher anywhere will still result in a default dispatcher being created.
-
Greg Spencer authored
The proposed change will change focus handling when pushing and popping routes so that the FocusScopeNode for the route receives focus when pushed, and that the FocusScopeNode in the navigator receives focus when the route is popped. This means that the last setFirstFocus call on the scope is used to determine which control actually receives focus. When the focus scope receives focus, it traverses its children, trying to find a non-scope node that is the "first focus" of itself or a child node. This is a breaking change, because the focus behavior has changed. If you push a route after this change, and had a 'first focus' set on a widget via FocusScopeNode.setFirstFocus, it won't currently receive focus immediately, but after this change it will. Similarly, if you pop a route after this change, the focus will go back to where it was before the route was pushed, which is correct, but different from what happens now.
-
- 04 Sep, 2019 1 commit
-
-
Greg Spencer authored
* Automatic focus highlight mode for FocusManager This re-lands the highlight mode change. * Review Changes
-
- 03 Sep, 2019 1 commit
-
-
Greg Spencer authored
This changes the behavior of text fields, Material buttons, and Chips so that if they are disabled they lose focus. Before this change, it was possible to disable a control and then use focus traversal to reach it anyhow, and in the case of text fields, enter text into a disabled field. Fixes #33985
-
- 21 Aug, 2019 1 commit
-
-
Greg Spencer authored
This reverts commit a11d7314 because of a regression in flutter_gallery_ios32__transition_perf's 90th_percentile_frame_build_time_millis. Fixes #38860.
-
- 16 Aug, 2019 3 commits
-
-
Greg Spencer authored
* Add an 'unfocusable' focus node to allow developers to indicate when they don't want a Focus widget to be active * more unfocusable changes. not working. * Switch to focusable attribute * Rename to canRequestFocus * Turn off debug output * Update docs * Removed unused import
-
brandondiamond authored
-
Greg Spencer authored
This adds a FocusHighlightMode to the FocusManager that switches based on the type of input that has recently been received. The initial value is based on the platform, but is updated as soon as user input is received. There is also a FocusHighlightStrategy enum so that the developer can change the strategy to a fixed value if needed. The default is to automatically detect the mode based on the last type of user input. If they use a mouse or keyboard, it shows the focus highlights. If they use a touch interface, then the highlights disappear. This is consistent with the way that Android and Chrome work. The controls still receive focus, only the display of the highlight changes. Text fields show the focus highlight regardless of the focus highlight mode.
-
- 14 Aug, 2019 1 commit
-
-
Jason Simmons authored
The time required to call FocusNode.toString and build _focusDebug messages was showing up in some performance benchmarks.
-
- 12 Aug, 2019 1 commit
-
-
Greg Spencer authored
This improves the ability to debug focus manager issues. It's not meant to be used by developers unless they're debugging problems with the focus manager itself.
-
- 10 Jul, 2019 1 commit
-
-
Greg Spencer authored
Change focus example to be more canonical (and correct), listening to the focus node for changes. (#35913) This changes the example for FocusNode to be more correct, listening to the focus node for changes, instead of assuming that it is the only one doing the changing.
-
- 04 Jun, 2019 1 commit
-
-
Greg Spencer authored
This implements the keyboard shortcut handling and action invocation in order to provide a place in the infrastructure for keyboard events to trigger actions. This will allow binding of key events to actions like "move the focus to the next widget" and "activate button".
-
- 21 May, 2019 1 commit
-
-
Greg Spencer authored
This just fixes up some comments for DefaultFocusTraversal, and fixes a minor bug when setting the onKey on a FocusNode on creation before attaching to it.
-
- 16 May, 2019 1 commit
-
-
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.
-
- 15 May, 2019 1 commit
-
-
Greg Spencer authored
This implements focus and hover handling for Material buttons. It inserts Focus widgets into the tree in order to allow buttons to be focusable via keyboard traversal (a.k.a. TAB traversal), and Listener widgets into the InkWell to allow the detection of hover states for widgets. Addresses #11344, #1608, and #13264.
-
- 10 May, 2019 1 commit
-
-
Greg Spencer authored
This implements a DefaultFocusTraversal widget to describe the focus traversal policy for its children, defined by a FocusTraversalPolicy object from which custom policies may be created. Pre-defined policies include widget-order traversal, "reading order" traversal and directional traversal.
-
- 01 May, 2019 1 commit
-
-
Greg Spencer authored
In #31614, I added an unfocus() to FocusNodes to allow giving up of focus, but it only worked on the primary focus. This changes that so that it will unfocus the entire chain, not just the primary focus. Now, if you call unfocus() on a FocusNode or FocusScopeNode, and their hasFocus returns true, then after calling unfocus(), it will return false. Before this change, it would only do that if hasPrimaryFocus was also true. This also fixes a bug in the way setFirstFocus was implemented, making it conform more to the behavior of the previous implementation. It has simplified logic in reparent, and in when it requests focus for scope nodes that have had setFirstFocus called on them.
-
- 25 Apr, 2019 1 commit
-
-
Greg Spencer authored
This re-lands the Focus changes in #30040. Correctness changes in routes.dart, and removes the automatic requesting of focus on reparent when there is no current focus, which caused undesirable selections. Addresses #11344, #1608, #13264, and #1678 Fixes #30084 Fixes #26704
-
- 23 Apr, 2019 1 commit
-
-
Greg Spencer authored
This reverts commit 4218c0bc.
-
- 22 Apr, 2019 1 commit
-
-
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
-
- 20 Mar, 2019 1 commit
-
-
Alexandre Ardhuin authored
* some space formattings * always use blocks in if-else if a block is used * format spaces in for and while * allow multiline if conditions * fix missing space
-
- 08 Mar, 2019 1 commit
-
-
Greg Spencer authored
In anticipation of changing a lot of the focus code, I'm adding some tests for the FocusScope. As a result, I was able to find and fix a bug where there was an incorrect assert. I also added some more documentation. Several of the tests enforce what I think is incorrect behavior related to passing focus off when the widget tree gets rebuilt without focus nodes that were previously there, but I'm not going to change that behavior in this PR. I also renamed focus_test.dart to focus_scope_test.dart to be more in line with our naming conventions.
-