Fix ScrollbarPainter thumbExtent calculation and add padding #31763
Fix ScrollbarPainter thumbExtent calculation and add padding #31763LongCatIsLooong merged 41 commits intoflutter:masterfrom
Conversation
030f24b to
96924ec
Compare
…flutter into scrollable-obstructions
|
Can you rebase to head to solve the merge conflict? |
dda788c to
b76d326
Compare
b76d326 to
4d3e39e
Compare
…flutter into scrollable-obstructions
aa0a16f to
21dda78
Compare
21dda78 to
128c12b
Compare
|
@xster @HansMuller removed some randomly made-up terms in documentation. Could you take a look? |
| const double _kMinThumbExtent = 18.0; | ||
|
|
||
| /// A [CustomPainter] for painting scrollbars. | ||
| /// A [CustomPainter] for painting scrollbars. The size of the scrollbar along |
There was a problem hiding this comment.
Let the dartdoc's first sentence be a one line summary paragraph.
| await tester.pump(const Duration(milliseconds: 500)); | ||
|
|
||
| expect(find.byType(CupertinoScrollbar), paints..rrect( | ||
| color: _kScrollbarColor, |
| import '../rendering/mock_canvas.dart'; | ||
|
|
||
| Widget _buildSingleChildScrollViewWithScrollbar({ | ||
| TextDirection textDirection = TextDirection.ltr, |
HansMuller
left a comment
There was a problem hiding this comment.
This looks good, although I'm not claiming to have combed through all of the new tests. Just some minor feedback.
| /// This value can be negative infinity, if the scroll is unbounded. | ||
| /// This value must not be null and must be less than or equal to [maxScrollExtent]. | ||
| /// It can be negative infinity, if the scroll is unbounded. | ||
| double get minScrollExtent; |
There was a problem hiding this comment.
FixedScrollMetrics should assert that these constraints are true.
| ); | ||
| // Thumb extent reflects fraction of content visible, as long as this | ||
| // isn't less than the absolute minimum size. | ||
| // contentExtent >= viewportDimension, so (contentExtent - mainAxisPadding) > 0 |
| viewportBuilder: (BuildContext context, ViewportOffset offset) { | ||
| return Viewport( | ||
| await tester.pumpWidget( | ||
| MediaQuery( |
There was a problem hiding this comment.
I'm hoping that the only change to this test is just adding the MediaQuery
There was a problem hiding this comment.
I think that's the case. Should I make the MediaQuery dependency optional?
There was a problem hiding this comment.
It's fine as is; just difficult to read github diffs sometimes.
9184687 to
67d9e58
Compare
Description
extentInsidecalculation inScrollMetricsextentInsidegetter, as well asScrollPosition.applyContentDimensionsto enforceminScrollExtent <= maxScrollExtentScrollbarPainter, updated implementation. Took care of some edge cases.Related Issues
Fixes #31430, partially fixes #13253 and #25802
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?
Appendix: Screenshots from iPhone XR running iOS 12.1
Both horizontal and vertical scrollbars are visible and overscrolling

Only the horizontal scrollbars is visible and overscrolling

Only the vertical scrollbars is visible and overscrolling
