-
Qun Cheng authored
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: https://github.com/flutter/flutter/blob/f8a77225f360556322934a9a831ffc9c9f3125da/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
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
lib | ||
test | ||
test_fixes | ||
test_private | ||
test_profile | ||
test_release | ||
LICENSE | ||
README.md | ||
analysis_options.yaml | ||
build.yaml | ||
dart_test.yaml | ||
pubspec.yaml |