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
ca1dbb94
Unverified
Commit
ca1dbb94
authored
Sep 23, 2021
by
Kate Lovett
Committed by
GitHub
Sep 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stretch recede edge case (#90629)
parent
115b9535
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
overscroll_indicator.dart
packages/flutter/lib/src/widgets/overscroll_indicator.dart
+1
-2
overscroll_stretch_indicator_test.dart
...utter/test/widgets/overscroll_stretch_indicator_test.dart
+29
-5
No files found.
packages/flutter/lib/src/widgets/overscroll_indicator.dart
View file @
ca1dbb94
...
...
@@ -700,8 +700,7 @@ class _StretchingOverscrollIndicatorState extends State<StretchingOverscrollIndi
}
}
}
}
else
if
(
notification
is
ScrollEndNotification
&&
notification
.
dragDetails
!=
null
||
notification
is
ScrollUpdateNotification
&&
notification
.
dragDetails
!=
null
)
{
}
else
if
(
notification
is
ScrollEndNotification
||
notification
is
ScrollUpdateNotification
)
{
_stretchController
.
scrollEnd
();
}
_lastNotification
=
notification
;
...
...
packages/flutter/test/widgets/overscroll_stretch_indicator_test.dart
View file @
ca1dbb94
...
...
@@ -97,7 +97,7 @@ void main() {
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dy
,
greaterThan
(
510.0
));
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.vertical.
top
.png'
),
matchesGoldenFile
(
'overscroll_stretch.vertical.
start.stretched
.png'
),
);
await
gesture
.
up
();
...
...
@@ -110,7 +110,11 @@ void main() {
// Jump to end of the list
controller
.
jumpTo
(
controller
.
position
.
maxScrollExtent
);
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
150.0
);
expect
(
box1
.
localToGlobal
(
Offset
.
zero
).
dy
,
-
150.0
);
expect
(
box2
.
localToGlobal
(
Offset
.
zero
).
dy
,
100.0
);
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dy
,
350.0
);
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.vertical.end.png'
),
...
...
@@ -125,8 +129,16 @@ void main() {
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dy
,
lessThan
(
350.0
));
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.vertical.
bottom
.png'
),
matchesGoldenFile
(
'overscroll_stretch.vertical.
end.stretched
.png'
),
);
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
// Stretch released back
expect
(
box1
.
localToGlobal
(
Offset
.
zero
).
dy
,
-
150.0
);
expect
(
box2
.
localToGlobal
(
Offset
.
zero
).
dy
,
100.0
);
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dy
,
350.0
);
});
testWidgets
(
'Stretch overscroll works in reverse - vertical'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -162,7 +174,7 @@ void main() {
);
});
testWidgets
(
'Stretch overscroll
horizontally
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Stretch overscroll
works in reverse - horizontal
'
,
(
WidgetTester
tester
)
async
{
final
Key
box1Key
=
UniqueKey
();
final
Key
box2Key
=
UniqueKey
();
final
Key
box3Key
=
UniqueKey
();
...
...
@@ -235,7 +247,7 @@ void main() {
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dx
,
greaterThan
(
610.0
));
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.horizontal.
left
.png'
),
matchesGoldenFile
(
'overscroll_stretch.horizontal.
start.stretched
.png'
),
);
await
gesture
.
up
();
...
...
@@ -248,7 +260,11 @@ void main() {
// Jump to end of the list
controller
.
jumpTo
(
controller
.
position
.
maxScrollExtent
);
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
100.0
);
expect
(
box1
.
localToGlobal
(
Offset
.
zero
).
dx
,
-
100.0
);
expect
(
box2
.
localToGlobal
(
Offset
.
zero
).
dx
,
200.0
);
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dx
,
500.0
);
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.horizontal.end.png'
),
...
...
@@ -263,8 +279,16 @@ void main() {
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dx
,
lessThan
(
500.0
));
await
expectLater
(
find
.
byType
(
CustomScrollView
),
matchesGoldenFile
(
'overscroll_stretch.horizontal.
right
.png'
),
matchesGoldenFile
(
'overscroll_stretch.horizontal.
end.stretched
.png'
),
);
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
// Stretch released back
expect
(
box1
.
localToGlobal
(
Offset
.
zero
).
dx
,
-
100.0
);
expect
(
box2
.
localToGlobal
(
Offset
.
zero
).
dx
,
200.0
);
expect
(
box3
.
localToGlobal
(
Offset
.
zero
).
dx
,
500.0
);
});
testWidgets
(
'Disallow stretching overscroll'
,
(
WidgetTester
tester
)
async
{
...
...
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