-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix unexpected shown of Scrollbar #159386
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
Conversation
victorsanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. cc @nate-thegrate who fixed a similar problem recently in NestedScrollView.
| _lastMetrics = metrics; | ||
| _lastAxisDirection = axisDirection; | ||
|
|
||
| bool needPaint(ScrollMetrics? metrics) => metrics != null && metrics.maxScrollExtent > metrics.minScrollExtent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this public method would be a breaking change, can you revert that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much like in a previous PR by @hgraceb, the narrow GitHub diffs make it kinda difficult to see the context of this change. Fortunately this is a local function defined inside the ScrollbarPainter.update method, so I believe we're good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @nate-thegrate said, thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it is indeed! Sorry I did not catch that! :)
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the few things I remember from college is the huge potential for precision loss when evaluating the difference between two numbers that are very close together.
I also remember how difficult it was for me to figure out what was going wrong while working on #157756.
Thanks for catching this and implementing the fix!
| _lastMetrics = metrics; | ||
| _lastAxisDirection = axisDirection; | ||
|
|
||
| bool needPaint(ScrollMetrics? metrics) => metrics != null && metrics.maxScrollExtent > metrics.minScrollExtent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much like in a previous PR by @hgraceb, the narrow GitHub diffs make it kinda difficult to see the context of this change. Fortunately this is a local function defined inside the ScrollbarPainter.update method, so I believe we're good 👍
|
I'm investigating the google testing failures. I haven't looked too deeply but this change might be causing an issue with horizontal scrollbars. |
Is there any update or more information? |
Still trying to reproduce. But the tests pass if I lower |
|
@victorsanni I can confirm that this test failed because it was written with an incorrect expected result. If you change the width from testWidgets(
'Horizontal scrollbar is visible if isHorizontalScrollBarVisible=true',
(WidgetTester tester) async {
await wrapWidgetSetSurf(tester,
- buildTable(isHorizontalScrollBarVisible: true), const Size(250, 300));
+ buildTable(isHorizontalScrollBarVisible: true), const Size(250 + precisionErrorTolerance, 300));
await tester.pumpAndSettle();
expect(find.byType(Scrollbar).first, paints..rect());
}); |
|
Hi @hgraceb, thanks for your patience. We're currently working on a patch to apply the fixes you proposed to the failing google tests, and will move forward with merging this PR once that work is done. |
|
Hi @hgraceb, this PR has some merge conflicts. Once they are fixed, google testing should pass when rerun. |
|
Hi @victorsanni, the Google tests are still failing. Are there any other unit tests that are broken? |
Roll Flutter from b007899 to 8e2a6fc (61 revisions) flutter/flutter@b007899...8e2a6fc 2025-02-03 [email protected] Implement hot reload using the DDC library bundle format (flutter/flutter#162498) 2025-02-01 [email protected] [Android] add lint ignores to Flutter JNI. (flutter/flutter#162527) 2025-02-01 [email protected] Fix `Linux docs_publish` running at head (flutter/flutter#162557) 2025-02-01 [email protected] [Flutter GPU] Breaking: Use exceptions for resource creation errors. (flutter/flutter#162104) 2025-02-01 [email protected] [Impeller] Increase conical gradient precision. (flutter/flutter#162543) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162542) 2025-01-31 [email protected] [web] Gracefully handle empty ui.Vertices (flutter/flutter#162461) 2025-01-31 [email protected] [web] Remove HTML build artifacts (flutter/flutter#162528) 2025-01-31 [email protected] [ Tool ] Remove use of globals from widget-preview commands (flutter/flutter#162522) 2025-01-31 [email protected] Add a special case for the Fuchsia SDK ftl.fidl file in the license script (flutter/flutter#162423) 2025-01-31 [email protected] [Impeller] Remove some unused methods from EntityPassClipStack (flutter/flutter#162478) 2025-01-31 [email protected] Reenable linux_web_engine mac tests on Mac-14 (flutter/flutter#162409) 2025-01-31 [email protected] Fix NavigationRail examples overflow alignment (flutter/flutter#159937) 2025-01-31 [email protected] Roll Skia from c1dc5033e7c9 to 4bdf90faf708 (1 revision) (flutter/flutter#162511) 2025-01-31 [email protected] Roll Skia from e0941791b86e to c1dc5033e7c9 (1 revision) (flutter/flutter#162504) 2025-01-31 [email protected] [Reland] Fix `Tab` linear and elastic animation blink (#162315) (flutter/flutter#162450) 2025-01-31 [email protected] fix syntax error in comment pseudocode (flutter/flutter#162453) 2025-01-31 [email protected] Roll Skia from ec8c632b8c7f to e0941791b86e (1 revision) (flutter/flutter#162502) 2025-01-31 [email protected] Roll Skia from a9af2a74c5ab to ec8c632b8c7f (2 revisions) (flutter/flutter#162496) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162476) 2025-01-31 [email protected] Document flutter/package deps version policy (flutter/flutter#162492) 2025-01-31 [email protected] Add iOS tool codeowner (flutter/flutter#162167) 2025-01-31 [email protected] Fixed the text aspect ratio (flutter/flutter#162415) 2025-01-31 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Delete `FlutterCommand.usageValues` (#162468)" (flutter/flutter#162494) 2025-01-31 [email protected] Add new web contributors to web triage doc. (flutter/flutter#162420) 2025-01-30 [email protected] Fix the build borked in flutter/flutter#162475. (flutter/flutter#162484) 2025-01-30 [email protected] Roll Skia from e6daf687b558 to a9af2a74c5ab (5 revisions) (flutter/flutter#162474) 2025-01-30 [email protected] Bump `Linux mac_clang_tidy" to 120m timeout (flutter/flutter#162475) 2025-01-30 [email protected] Delete `FlutterCommand.usageValues` (flutter/flutter#162468) 2025-01-30 [email protected] Fixed some floating point inaccuracies in TextContents (flutter/flutter#162351) 2025-01-30 [email protected] Limit number of retries when downloading the Dart SDK on Windows (flutter/flutter#162411) 2025-01-30 [email protected] Add FormField.errorBuilder (flutter/flutter#162255) 2025-01-30 [email protected] Fix `Checkbox` default visual density to meet Material 3 guidelines (flutter/flutter#159081) 2025-01-30 [email protected] [Android] add HC++ platform view class. (flutter/flutter#161829) 2025-01-30 [email protected] Add tests to confirm CupertinoSliverNavigationBar snaps when partially scrolled in .always bottom mode (flutter/flutter#162425) 2025-01-30 [email protected] [Impeller] Disable Vulkan on Emulators. (flutter/flutter#162454) 2025-01-30 [email protected] [FGP Kotlin conversion] Convert `Deeplink` and `IntentFilterCheck` (flutter/flutter#161835) 2025-01-30 [email protected] fix slider semantic label (flutter/flutter#162304) 2025-01-30 [email protected] Roll Skia from f22419dbed05 to e6daf687b558 (37 revisions) (flutter/flutter#162447) 2025-01-30 [email protected] Fix `flutter doctor` instructions displayed when `cmdline-tools` (Android SDK) cannot be found (flutter/flutter#162281) 2025-01-30 [email protected] remove more (simple) usage of package:usage (flutter/flutter#162354) 2025-01-30 [email protected] [Android] HC++ plumbing. (flutter/flutter#162407) 2025-01-30 [email protected] Removes dev dependencies from generated plugin registrant for non-Android platforms (flutter/flutter#161828) 2025-01-30 [email protected] Fix unexpected shown of Scrollbar (flutter/flutter#159386) 2025-01-30 [email protected] Roll package:vm_service to 15.0.0 and package:leak_tracker to 10.0.9 (flutter/flutter#162325) 2025-01-30 [email protected] Roll Fuchsia Test Scripts from r9Dc5VRF6sE3pJH20... to g6IlaYL1_wNmk3zNj... (flutter/flutter#162427) ...
Roll Flutter from b007899 to 8e2a6fc (61 revisions) flutter/flutter@b007899...8e2a6fc 2025-02-03 [email protected] Implement hot reload using the DDC library bundle format (flutter/flutter#162498) 2025-02-01 [email protected] [Android] add lint ignores to Flutter JNI. (flutter/flutter#162527) 2025-02-01 [email protected] Fix `Linux docs_publish` running at head (flutter/flutter#162557) 2025-02-01 [email protected] [Flutter GPU] Breaking: Use exceptions for resource creation errors. (flutter/flutter#162104) 2025-02-01 [email protected] [Impeller] Increase conical gradient precision. (flutter/flutter#162543) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162542) 2025-01-31 [email protected] [web] Gracefully handle empty ui.Vertices (flutter/flutter#162461) 2025-01-31 [email protected] [web] Remove HTML build artifacts (flutter/flutter#162528) 2025-01-31 [email protected] [ Tool ] Remove use of globals from widget-preview commands (flutter/flutter#162522) 2025-01-31 [email protected] Add a special case for the Fuchsia SDK ftl.fidl file in the license script (flutter/flutter#162423) 2025-01-31 [email protected] [Impeller] Remove some unused methods from EntityPassClipStack (flutter/flutter#162478) 2025-01-31 [email protected] Reenable linux_web_engine mac tests on Mac-14 (flutter/flutter#162409) 2025-01-31 [email protected] Fix NavigationRail examples overflow alignment (flutter/flutter#159937) 2025-01-31 [email protected] Roll Skia from c1dc5033e7c9 to 4bdf90faf708 (1 revision) (flutter/flutter#162511) 2025-01-31 [email protected] Roll Skia from e0941791b86e to c1dc5033e7c9 (1 revision) (flutter/flutter#162504) 2025-01-31 [email protected] [Reland] Fix `Tab` linear and elastic animation blink (#162315) (flutter/flutter#162450) 2025-01-31 [email protected] fix syntax error in comment pseudocode (flutter/flutter#162453) 2025-01-31 [email protected] Roll Skia from ec8c632b8c7f to e0941791b86e (1 revision) (flutter/flutter#162502) 2025-01-31 [email protected] Roll Skia from a9af2a74c5ab to ec8c632b8c7f (2 revisions) (flutter/flutter#162496) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162476) 2025-01-31 [email protected] Document flutter/package deps version policy (flutter/flutter#162492) 2025-01-31 [email protected] Add iOS tool codeowner (flutter/flutter#162167) 2025-01-31 [email protected] Fixed the text aspect ratio (flutter/flutter#162415) 2025-01-31 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Delete `FlutterCommand.usageValues` (#162468)" (flutter/flutter#162494) 2025-01-31 [email protected] Add new web contributors to web triage doc. (flutter/flutter#162420) 2025-01-30 [email protected] Fix the build borked in flutter/flutter#162475. (flutter/flutter#162484) 2025-01-30 [email protected] Roll Skia from e6daf687b558 to a9af2a74c5ab (5 revisions) (flutter/flutter#162474) 2025-01-30 [email protected] Bump `Linux mac_clang_tidy" to 120m timeout (flutter/flutter#162475) 2025-01-30 [email protected] Delete `FlutterCommand.usageValues` (flutter/flutter#162468) 2025-01-30 [email protected] Fixed some floating point inaccuracies in TextContents (flutter/flutter#162351) 2025-01-30 [email protected] Limit number of retries when downloading the Dart SDK on Windows (flutter/flutter#162411) 2025-01-30 [email protected] Add FormField.errorBuilder (flutter/flutter#162255) 2025-01-30 [email protected] Fix `Checkbox` default visual density to meet Material 3 guidelines (flutter/flutter#159081) 2025-01-30 [email protected] [Android] add HC++ platform view class. (flutter/flutter#161829) 2025-01-30 [email protected] Add tests to confirm CupertinoSliverNavigationBar snaps when partially scrolled in .always bottom mode (flutter/flutter#162425) 2025-01-30 [email protected] [Impeller] Disable Vulkan on Emulators. (flutter/flutter#162454) 2025-01-30 [email protected] [FGP Kotlin conversion] Convert `Deeplink` and `IntentFilterCheck` (flutter/flutter#161835) 2025-01-30 [email protected] fix slider semantic label (flutter/flutter#162304) 2025-01-30 [email protected] Roll Skia from f22419dbed05 to e6daf687b558 (37 revisions) (flutter/flutter#162447) 2025-01-30 [email protected] Fix `flutter doctor` instructions displayed when `cmdline-tools` (Android SDK) cannot be found (flutter/flutter#162281) 2025-01-30 [email protected] remove more (simple) usage of package:usage (flutter/flutter#162354) 2025-01-30 [email protected] [Android] HC++ plumbing. (flutter/flutter#162407) 2025-01-30 [email protected] Removes dev dependencies from generated plugin registrant for non-Android platforms (flutter/flutter#161828) 2025-01-30 [email protected] Fix unexpected shown of Scrollbar (flutter/flutter#159386) 2025-01-30 [email protected] Roll package:vm_service to 15.0.0 and package:leak_tracker to 10.0.9 (flutter/flutter#162325) 2025-01-30 [email protected] Roll Fuchsia Test Scripts from r9Dc5VRF6sE3pJH20... to g6IlaYL1_wNmk3zNj... (flutter/flutter#162427) ...
Roll Flutter from b007899 to 8e2a6fc (61 revisions) flutter/flutter@b007899...8e2a6fc 2025-02-03 [email protected] Implement hot reload using the DDC library bundle format (flutter/flutter#162498) 2025-02-01 [email protected] [Android] add lint ignores to Flutter JNI. (flutter/flutter#162527) 2025-02-01 [email protected] Fix `Linux docs_publish` running at head (flutter/flutter#162557) 2025-02-01 [email protected] [Flutter GPU] Breaking: Use exceptions for resource creation errors. (flutter/flutter#162104) 2025-02-01 [email protected] [Impeller] Increase conical gradient precision. (flutter/flutter#162543) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162542) 2025-01-31 [email protected] [web] Gracefully handle empty ui.Vertices (flutter/flutter#162461) 2025-01-31 [email protected] [web] Remove HTML build artifacts (flutter/flutter#162528) 2025-01-31 [email protected] [ Tool ] Remove use of globals from widget-preview commands (flutter/flutter#162522) 2025-01-31 [email protected] Add a special case for the Fuchsia SDK ftl.fidl file in the license script (flutter/flutter#162423) 2025-01-31 [email protected] [Impeller] Remove some unused methods from EntityPassClipStack (flutter/flutter#162478) 2025-01-31 [email protected] Reenable linux_web_engine mac tests on Mac-14 (flutter/flutter#162409) 2025-01-31 [email protected] Fix NavigationRail examples overflow alignment (flutter/flutter#159937) 2025-01-31 [email protected] Roll Skia from c1dc5033e7c9 to 4bdf90faf708 (1 revision) (flutter/flutter#162511) 2025-01-31 [email protected] Roll Skia from e0941791b86e to c1dc5033e7c9 (1 revision) (flutter/flutter#162504) 2025-01-31 [email protected] [Reland] Fix `Tab` linear and elastic animation blink (#162315) (flutter/flutter#162450) 2025-01-31 [email protected] fix syntax error in comment pseudocode (flutter/flutter#162453) 2025-01-31 [email protected] Roll Skia from ec8c632b8c7f to e0941791b86e (1 revision) (flutter/flutter#162502) 2025-01-31 [email protected] Roll Skia from a9af2a74c5ab to ec8c632b8c7f (2 revisions) (flutter/flutter#162496) 2025-01-31 [email protected] Roll pub packages (flutter/flutter#162476) 2025-01-31 [email protected] Document flutter/package deps version policy (flutter/flutter#162492) 2025-01-31 [email protected] Add iOS tool codeowner (flutter/flutter#162167) 2025-01-31 [email protected] Fixed the text aspect ratio (flutter/flutter#162415) 2025-01-31 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Delete `FlutterCommand.usageValues` (#162468)" (flutter/flutter#162494) 2025-01-31 [email protected] Add new web contributors to web triage doc. (flutter/flutter#162420) 2025-01-30 [email protected] Fix the build borked in flutter/flutter#162475. (flutter/flutter#162484) 2025-01-30 [email protected] Roll Skia from e6daf687b558 to a9af2a74c5ab (5 revisions) (flutter/flutter#162474) 2025-01-30 [email protected] Bump `Linux mac_clang_tidy" to 120m timeout (flutter/flutter#162475) 2025-01-30 [email protected] Delete `FlutterCommand.usageValues` (flutter/flutter#162468) 2025-01-30 [email protected] Fixed some floating point inaccuracies in TextContents (flutter/flutter#162351) 2025-01-30 [email protected] Limit number of retries when downloading the Dart SDK on Windows (flutter/flutter#162411) 2025-01-30 [email protected] Add FormField.errorBuilder (flutter/flutter#162255) 2025-01-30 [email protected] Fix `Checkbox` default visual density to meet Material 3 guidelines (flutter/flutter#159081) 2025-01-30 [email protected] [Android] add HC++ platform view class. (flutter/flutter#161829) 2025-01-30 [email protected] Add tests to confirm CupertinoSliverNavigationBar snaps when partially scrolled in .always bottom mode (flutter/flutter#162425) 2025-01-30 [email protected] [Impeller] Disable Vulkan on Emulators. (flutter/flutter#162454) 2025-01-30 [email protected] [FGP Kotlin conversion] Convert `Deeplink` and `IntentFilterCheck` (flutter/flutter#161835) 2025-01-30 [email protected] fix slider semantic label (flutter/flutter#162304) 2025-01-30 [email protected] Roll Skia from f22419dbed05 to e6daf687b558 (37 revisions) (flutter/flutter#162447) 2025-01-30 [email protected] Fix `flutter doctor` instructions displayed when `cmdline-tools` (Android SDK) cannot be found (flutter/flutter#162281) 2025-01-30 [email protected] remove more (simple) usage of package:usage (flutter/flutter#162354) 2025-01-30 [email protected] [Android] HC++ plumbing. (flutter/flutter#162407) 2025-01-30 [email protected] Removes dev dependencies from generated plugin registrant for non-Android platforms (flutter/flutter#161828) 2025-01-30 [email protected] Fix unexpected shown of Scrollbar (flutter/flutter#159386) 2025-01-30 [email protected] Roll package:vm_service to 15.0.0 and package:leak_tracker to 10.0.9 (flutter/flutter#162325) 2025-01-30 [email protected] Roll Fuchsia Test Scripts from r9Dc5VRF6sE3pJH20... to g6IlaYL1_wNmk3zNj... (flutter/flutter#162427) ...
Fixes Narrow DatePickerDialog has unnecessary scrollbar on months with 6 rows #141348
Details
288 / 7 + 288 / 7 * 6 = 288.00000000000006Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.