flutter/examples/api/test/widgets
auto-submit[bot] f9b3b84d4e
Reverts "Changing TextPainter.getOffsetForCaret implementation to remove the logarithmic search (#143281)" (#143801)
Reverts flutter/flutter#143281

Initiated by: LongCatIsLooong

Reason for reverting: https://github.com/flutter/flutter/issues/143797

Original PR Author: LongCatIsLooong

Reviewed By: {justinmc, jason-simmons}

This change reverts the following previous change:
Original Description:
The behavior largely remains the same, except:

1. The EOT cursor `(textLength, downstream)` for text ending in the opposite writing direction as the paragraph is now placed at the visual end of the last line. 
  For example, in a LTR paragraph, the EOT cursor for `aA` (lowercase for LTR and uppercase for RTL) is placed to the right of the line: `aA|` (it was `a|A` before). 
  This matches the behavior of most applications that do logical order arrow key navigation instead of visual order navigation. 
  And it makes the navigation order consistent for `aA\naA`:
```
  |aA    =>  aA|  => aA|  => aA  => aA   => aA 
   aA        aA      aA     |aA     aA|     aA|     
   (1)       (2)     (3)    (4)    (5)      (6)
```
This is indeed still pretty confusing as (2) and (3), as well as (5) and (6) are hard to distinguish (when the I beam has a large width they are actually visually distinguishable -- they use the same anchor but one gets painted to the left and the other to the right. I noticed that emacs does the same). 
But logical order navigation will always be confusing in bidi text, in one way or another.

Interestingly there are 3 different behaviors I've observed in chrome:
- the chrome download dialog (which I think uses GTK text widgets but not sure which version) gives me 2 cursors when navigating bidi text, and 
- its HTML fields only show one, and presumably they place the I beam at the **trailing edge** of the character (which makes more sense for backspacing I guess). 
- On the other hand, its (new) omnibar seems to use visual order arrow navigation

Side note: we may need to update the "tap to place the caret here" logic to handle the case where the tap lands outside of the text and the text ends in the opposite writing direction. 

2. Removed the logarithmic search. The same could be done using the characters package but when glyphInfo tells you about the baseline location in the future we probably don't need the `getBoxesForRange` call. This should fix https://github.com/flutter/flutter/issues/123424.

## Internal Tests

This is going to change the image output of some internal golden tests. I'm planning to merge https://github.com/flutter/flutter/pull/143281 before this to avoid updating the same golden files twice for invalid selections.
2024-02-21 00:10:18 +00:00
..
actions Fix Action.overridable example (#110824) 2022-09-02 00:46:21 +00:00
animated_grid Add SliverAnimatedGrid and AnimatedGrid (#112982) 2022-10-07 22:15:11 +00:00
animated_list Fix gets removedItem instead of its index (#119638) 2023-02-03 00:15:58 +00:00
app Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
app_lifecycle_listener Fix typo (#141426) 2024-01-11 17:05:01 -08:00
basic Fix MultiChildLayoutDelegate.hasChild doc (#126433) 2023-05-11 14:59:07 +00:00
binding Add AppLifecycleListener, with support for application exit handling (#123274) 2023-06-08 22:57:19 +00:00
draggable_scrollable_sheet Fixed a lot of typos (#141431) 2024-01-12 22:10:25 +00:00
editable_text Add more documentation for TextEditingController default constructor (#143452) 2024-02-14 20:10:18 +00:00
form Write Tests for API Example of form.0.dart (#142635) 2024-02-01 21:54:46 +00:00
gesture_detector Remove "note that" in our documentation (as per style guide) (#120842) 2023-02-17 22:27:33 +00:00
hardware_keyboard Explain the "patching" protocol in KeyMessageManager.keyMessageHandler and add an example (#105280) 2022-07-26 05:42:05 +00:00
heroes Dev, examples/api, etc updated for Material 3 by default (#129683) 2023-06-28 09:41:58 -07:00
implicit_animations Dev, examples/api, etc updated for Material 3 by default (#129683) 2023-06-28 09:41:58 -07:00
inherited_model InheritedModel: Add a complete interactive example and update snippet for null safety (#104174) 2022-05-30 06:13:10 -07:00
interactive_viewer Update example code and docs for InteractiveViewer.builder (#98623) 2022-02-16 17:25:17 -08:00
layout_builder Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
magnifier Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
navigator_pop_handler Reland root predictive back (#132249) 2023-08-17 23:55:05 +00:00
overlay Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
page_view Reland "Remove hack from PageView." (#142172) 2024-01-24 23:44:11 +00:00
pop_scope Reland root predictive back (#132249) 2023-08-17 23:55:05 +00:00
routes Update RouteObserver example and fix an error thrown (#141166) 2024-01-09 20:48:56 +00:00
scroll_notification_observer Add ScrollNotificationObserver sample (#127023) 2023-05-25 15:58:52 +00:00
scroll_position Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823) 2023-05-15 21:01:06 +00:00
scroll_view Add findChildIndexCallback examples (#133469) 2023-10-18 00:26:17 +00:00
scrollbar Add an example for how to hide default scrollbar on desktop platform. (#108542) 2022-08-18 13:09:23 +00:00
shortcuts Add CallbackShortcuts example (#123944) 2023-04-05 22:17:59 +00:00
sliver Sliver Main Axis Group (#126596) 2023-06-08 15:54:09 -07:00
slotted_render_object_widget Reland "Mixin for slotted RenderObjectWidgets and RenderBox (#94077)" (#94632) 2021-12-03 14:39:02 -08:00
tap_region Replace FocusTrap with TapRegionSurface (#107262) 2022-07-29 16:00:07 +00:00
text Add one DefaultTextStyle example (#122182) 2023-03-08 20:40:54 +00:00
text_magnifier Reverts "Changing TextPainter.getOffsetForCaret implementation to remove the logarithmic search (#143281)" (#143801) 2024-02-21 00:10:18 +00:00
transitions Fix sample code crash, add test (#133812) 2023-08-31 22:56:06 +00:00
navigator_utils.dart Reland root predictive back (#132249) 2023-08-17 23:55:05 +00:00