flutter/packages
Qun Cheng cc4abe92fb
Correct menu position when menu is constrained (#143121)
Fixes #142896

The original code below is to always place the selected item above(overlap) the popup button so that the selected item can always be visible: f8a77225f3/packages/flutter/lib/src/material/popup_menu.dart (L723-L732)

But when menu height is constrained and the menu itself is super long, the selected item still assumes there is enough space to push up all the items whose index is smaller than the selected index. As a result, every time when the menu is open, the calculation provides a different result to be the offset for the selected index,  and then with a constrained height, the menu looks jumping all over the place based on the different selected index.

https://github.com/flutter/flutter/assets/36861262/ad761f95-0ff5-4311-a81d-dac56df879c5

Even though the original calculation is to make the selected item visible when open the menu, the menu doesn't auto scroll and only expands itself as much as possible to show the selected one. In this case, if the screen it too small to show the selected item, we still cannot see it. This can be fixed by using `Scrollable.ensureVisible()`(#143118).

So we remove the calculation in this PR and the menu will always show up based on the top left of the anchor(button).

https://github.com/flutter/flutter/assets/36861262/03272f26-9440-4ac4-a701-9a0b41776ff9
2024-02-08 20:36:24 +00:00
..
flutter Correct menu position when menu is constrained (#143121) 2024-02-08 20:36:24 +00:00
flutter_driver Unpin test (#141427) 2024-02-01 18:53:23 +00:00
flutter_goldens Add a test for the isAvailableForEnvironment logic (#142251) 2024-02-07 19:01:48 +00:00
flutter_localizations Unpin test (#141427) 2024-02-01 18:53:23 +00:00
flutter_test Add the number of mismatched pixels to golden tests output (#142975) 2024-02-07 18:59:57 +00:00
flutter_tools Reland "Move native assets to isolated/ directory" (#143055) 2024-02-08 17:49:48 +00:00
flutter_web_plugins Unpin test (#141427) 2024-02-01 18:53:23 +00:00
fuchsia_remote_debug_protocol Unpin test (#141427) 2024-02-01 18:53:23 +00:00
integration_test Reland "Update gradle lockfiles template (#140115)" (#143081) 2024-02-08 16:22:15 +00:00
analysis_options.yaml Unify analysis options (#108462) 2022-07-28 09:07:49 -07:00