The Wayback Machine - https://web.archive.org/web/20210911031824/https://github.com/flutter/flutter/pull/89199
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a dropdown button menu position bug #89199

Merged
merged 5 commits into from Sep 11, 2021
Merged

Conversation

@xu-baolin
Copy link
Member

@xu-baolin xu-baolin commented Aug 31, 2021

Fixes #89029

This is an enhanced patch of #76493

menuTop = math.min(buttonTop, topLimit);
menuBottom = menuTop + menuHeight;

This comment has been minimized.

@xu-baolin

xu-baolin Aug 31, 2021
Author Member

This is a bug and I add an assertion to check this at line 580

@xu-baolin
Copy link
Member Author

@xu-baolin xu-baolin commented Aug 31, 2021

Ready for review now.

@HansMuller HansMuller requested a review from Piinks Sep 3, 2021
@@ -516,7 +516,10 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
// selected item is aligned with the button's vertical center, as far as
// that's possible given availableHeight.
_MenuLimits getMenuLimits(Rect buttonRect, double availableHeight, int index) {
final double maxMenuHeight = availableHeight - 2.0 * _kMenuItemHeight;
double maxMenuHeight = availableHeight - 2.0 * _kMenuItemHeight;

This comment has been minimized.

@Piinks

Piinks Sep 9, 2021
Contributor

maxMenuHeight v menuMaxHeight is a bit confusing.
What if we made this one computedMaxHeight? Or something like that?

@@ -567,6 +577,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
scrollOffset = math.min(scrollOffset, preferredMenuHeight - menuHeight);
}

assert(menuHeight == menuBottom - menuTop);

This comment has been minimized.

@Piinks

Piinks Sep 9, 2021
Contributor

Can you add a test that triggers this assertion?

This comment has been minimized.

@xu-baolin

xu-baolin Sep 10, 2021
Author Member

If we only add this assertion to the master branch, there will be many tests that trigger this assertion.
Fortunately, no one has used _MenuLimits.menuBottom before, so there are no functional issues.

This comment has been minimized.

@xu-baolin

xu-baolin Sep 10, 2021
Author Member

This is just to check that the metrics calculated by this function are correct.
I didn't think of a good way to test and trigger it.

@Piinks
Piinks approved these changes Sep 10, 2021
Copy link
Contributor

@Piinks Piinks left a comment

LGTM! This will need to be rebased after #89861 lands, it is the cause of the test failures here

@fluttergithubbot fluttergithubbot merged commit b2550fe into flutter:master Sep 11, 2021
48 checks passed
48 checks passed
@flutter-github-sync
Google testing Google testing passed!
Details
@flutter-dashboard
Linux analyze
Details
@flutter-dashboard
Linux build_tests_1_2
Details
@flutter-dashboard
Linux build_tests_2_2
Details
@flutter-dashboard
Linux customer_testing
Details
@flutter-dashboard
Linux docs_test
Details
@flutter-dashboard
Linux firebase_abstract_method_smoke_test
Details
@flutter-dashboard
Linux firebase_android_embedding_v2_smoke_test
Details
@flutter-dashboard
Linux firebase_release_smoke_test
Details
@flutter-dashboard
Linux framework_tests_libraries
Details
@flutter-dashboard
Linux framework_tests_misc
Details
@flutter-dashboard
Linux framework_tests_widgets
Details
@flutter-dashboard
Linux fuchsia_precache
Details
@flutter-dashboard
Linux skp_generator
Details
@flutter-dashboard
Linux web_long_running_tests_1_5
Details
@flutter-dashboard
Linux web_long_running_tests_2_5
Details
@flutter-dashboard
Linux web_long_running_tests_3_5
Details
@flutter-dashboard
Linux web_long_running_tests_4_5
Details
@flutter-dashboard
Linux web_long_running_tests_5_5
Details
@flutter-dashboard
Linux web_tests_0
Details
@flutter-dashboard
Linux web_tests_1
Details
@flutter-dashboard
Linux web_tests_2
Details
@flutter-dashboard
Linux web_tests_3
Details
@flutter-dashboard
Linux web_tests_4
Details
@flutter-dashboard
Linux web_tests_5
Details
@flutter-dashboard
Linux web_tests_6
Details
@flutter-dashboard
Linux web_tests_7_last
Details
@flutter-dashboard
Mac build_tests_1_4
Details
@flutter-dashboard
Mac build_tests_2_4
Details
@flutter-dashboard
Mac build_tests_3_4
Details
@flutter-dashboard
Mac build_tests_4_4
Details
@flutter-dashboard
Mac customer_testing
Details
@flutter-dashboard
Mac framework_tests_libraries
Details
@flutter-dashboard
Mac framework_tests_misc
Details
@flutter-dashboard
Mac framework_tests_widgets
Details
@flutter-dashboard
Mac tool_tests_commands
Details
@wip
WIP Ready for review
Details
@flutter-dashboard
Windows build_tests_1_3
Details
@flutter-dashboard
Windows build_tests_2_3
Details
@flutter-dashboard
Windows build_tests_3_3
Details
@flutter-dashboard
Windows customer_testing
Details
@flutter-dashboard
Windows framework_tests_libraries
Details
@flutter-dashboard
Windows framework_tests_misc
Details
@flutter-dashboard
Windows framework_tests_widgets
Details
@flutter-dashboard
ci.yaml validation .ci.yaml validation
Details
@google-cla
cla/google All necessary CLAs are signed
@flutter-dashboard
flutter-gold All golden file tests have passed.
Details
@flutter-dashboard
luci-flutter
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants