Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5ab6c7bc
Unverified
Commit
5ab6c7bc
authored
Oct 01, 2021
by
Kate Lovett
Committed by
GitHub
Oct 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix overflow edge case in overscrolled RenderShrinkWrappingViewport (#90419)
parent
77887659
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+1
-1
viewport_test.dart
packages/flutter/test/rendering/viewport_test.dart
+49
-0
No files found.
packages/flutter/lib/src/rendering/viewport.dart
View file @
5ab6c7bc
...
...
@@ -1933,7 +1933,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
scrollOffset:
math
.
max
(
0.0
,
correctedOffset
),
overlap:
math
.
min
(
0.0
,
correctedOffset
),
layoutOffset:
math
.
max
(
0.0
,
-
correctedOffset
),
remainingPaintExtent:
mainAxisExtent
,
remainingPaintExtent:
mainAxisExtent
+
math
.
min
(
0.0
,
correctedOffset
)
,
mainAxisExtent:
mainAxisExtent
,
crossAxisExtent:
crossAxisExtent
,
growthDirection:
GrowthDirection
.
forward
,
...
...
packages/flutter/test/rendering/viewport_test.dart
View file @
5ab6c7bc
...
...
@@ -7,6 +7,8 @@
// initialize a binding, which rendering_tester will attempt to re-initialize
// (or vice versa).
@Tags
(<
String
>[
'reduced-test-set'
])
import
'dart:ui'
as
ui
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -1867,6 +1869,53 @@ void main() {
);
}
testWidgets
(
'Constrained Shrinkwrapping viewport will not overflow on overscroll'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/89717
final
ScrollController
controller
=
ScrollController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
Column
(
children:
<
Widget
>[
Container
(
height:
100
,
color:
const
Color
(
0x00000000
)),
Container
(
height:
150
,
color:
const
Color
(
0xFFF44336
),
child:
ListView
.
builder
(
controller:
controller
,
shrinkWrap:
true
,
physics:
const
BouncingScrollPhysics
(
parent:
AlwaysScrollableScrollPhysics
()),
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
Text
(
'Item
$index
'
),
itemCount:
10
,
),
),
Container
(
height:
100
,
color:
const
Color
(
0x00000000
)),
],
),
),
)
);
expect
(
controller
.
offset
,
0.0
);
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Item 0'
)).
dy
,
100.0
);
// Overscroll
final
TestGesture
overscrollGesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
text
(
'Item 0'
)));
await
overscrollGesture
.
moveBy
(
const
Offset
(
0
,
25
));
await
tester
.
pump
();
expect
(
controller
.
offset
,
-
25.0
);
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Item 0'
)).
dy
,
125.0
);
await
expectLater
(
find
.
byType
(
Directionality
),
matchesGoldenFile
(
'shrinkwrapped_overscroll.png'
),
);
await
overscrollGesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
0.0
);
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Item 0'
)).
dy
,
100.0
);
});
testWidgets
(
'Shrinkwrap allows overscrolling on default platforms - vertical'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/10949
// Scrollables should overscroll by default on iOS and macOS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment