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
39e00d2e
Unverified
Commit
39e00d2e
authored
Jun 09, 2020
by
chunhtai
Committed by
GitHub
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix overscroll position if there is sliver before center sliver in custom scroll view (#59015)
parent
5736def3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
overscroll_indicator.dart
packages/flutter/lib/src/widgets/overscroll_indicator.dart
+3
-0
overscroll_indicator_test.dart
packages/flutter/test/widgets/overscroll_indicator_test.dart
+39
-0
No files found.
packages/flutter/lib/src/widgets/overscroll_indicator.dart
View file @
39e00d2e
...
...
@@ -267,6 +267,9 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
final
bool
isLeading
=
controller
==
_leadingController
;
if
(
_lastNotificationType
!=
OverscrollNotification
)
{
final
OverscrollIndicatorNotification
confirmationNotification
=
OverscrollIndicatorNotification
(
leading:
isLeading
);
// It is possible that the scroll extent starts at non-zero.
if
(
isLeading
)
confirmationNotification
.
paintOffset
=
notification
.
metrics
.
minScrollExtent
;
confirmationNotification
.
dispatch
(
context
);
_accepted
[
isLeading
]
=
confirmationNotification
.
_accepted
;
if
(
_accepted
[
isLeading
])
{
...
...
packages/flutter/test/widgets/overscroll_indicator_test.dart
View file @
39e00d2e
...
...
@@ -321,6 +321,45 @@ void main() {
expect
(
painter
,
isNot
(
paints
..
circle
()..
circle
()));
});
testWidgets
(
'CustomScrollView overscroll indicator works if there is sliver before center'
,
(
WidgetTester
tester
)
async
{
final
Key
centerKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
ScrollConfiguration
(
behavior:
TestScrollBehavior2
(),
child:
CustomScrollView
(
center:
centerKey
,
physics:
const
AlwaysScrollableScrollPhysics
(),
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
=>
Text
(
'First sliver
$index
'
,),
childCount:
2
,
),
),
SliverList
(
key:
centerKey
,
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
=>
Text
(
'Second sliver
$index
'
,),
childCount:
5
,
),
),
],
),
),
),
);
expect
(
find
.
text
(
'First sliver 1'
),
findsNothing
);
await
slowDrag
(
tester
,
const
Offset
(
200.0
,
200.0
),
const
Offset
(
0.0
,
300.0
));
expect
(
find
.
text
(
'First sliver 1'
),
findsOneWidget
);
final
RenderObject
painter
=
tester
.
renderObject
(
find
.
byType
(
CustomPaint
));
// The scroll offset and paint extend should cancel out each other.
expect
(
painter
,
paints
..
save
()..
translate
(
y:
0.0
)..
scale
()..
circle
());
});
group
(
'Modify glow position'
,
()
{
testWidgets
(
'Leading'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
...
...
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