This re-implements keyboard text selection so that it will work on platforms other than Android (e.g. macOS, Linux, etc.).
Also, fixed a number of bugs in editing selection via a hardware keyboard (unable to select backwards, incorrect conversion to ASCII when cutting to clipboard, lack of support for CTRL-SHIFT-ARROW word selection, etc.).
Did not address the keyboard locale issues that remain, or add platform specific switches for the bindings. All that will need some more design work before implementing them.
Related Issues
Fixes#31951
In #42533, I disabled the up/down arrows for focus navigation in text fields, but we thought of a better way to do it, so this is that better way.
This change reverts the other change, and instead it tests the context of the node in the action to see if it's an EditableText node. If so, then it doesn't do the navigation action.
The _computeChildren[Width/Height]With[Min/Max]Intrinsics methods in
RenderParagraph overwrite the text painter's placeholder dimensions
in order to compute potential widths and heights for the paragraph.
The placeholder dimensions should be restored to the values computed by
_layoutChildren before painting the text.
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
This disables the arrow key focus navigation for text fields. This was non-standard behavior for text fields, although it remains useful for other kinds of controls.
Fixes#42259
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.
* Updated the BottomAppBar to use elevation overlays when a dark theme is used.
* Moved the code for calculating the overlay color to a new utility
ElevationOverlay class and made it private by not including in the material package.
* Allow showModalBottomSheet to present bottom sheet that is not dismissible by tapping on the scrim
* Add guards, improve styling and tests for BottomSheet
This changes the DropDownButton so that instead of dismissing itself when any metrics change occurs, it only dismisses itself when the orientation changes.
This gets around the fact that we can't currently have a dropdown and a text field on the same page because the keyboard disappearing when the dropdown gets focus causes a metrics change, and the dropdown immediately disappears when activated.
It still will cause the keyboard to jump up and down between controls, but that's a larger issue. At least now we can use the two together again.