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
f976010f
Unverified
Commit
f976010f
authored
Jul 28, 2022
by
xubaolin
Committed by
GitHub
Jul 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes a NestedScrollView UserScrollNotification issue (#107632)
parent
a299c9e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
nested_scroll_view.dart
packages/flutter/lib/src/widgets/nested_scroll_view.dart
+1
-0
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+53
-0
No files found.
packages/flutter/lib/src/widgets/nested_scroll_view.dart
View file @
f976010f
...
...
@@ -1344,6 +1344,7 @@ class _NestedScrollPosition extends ScrollPosition implements ScrollActivityDele
@override
void
goIdle
()
{
beginActivity
(
IdleScrollActivity
(
this
));
coordinator
.
updateUserScrollDirection
(
ScrollDirection
.
idle
);
}
// This is called by activities when they finish their work and want to go
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
f976010f
...
...
@@ -120,6 +120,59 @@ Widget buildTest({
}
void
main
(
)
{
testWidgets
(
'ScrollDirection test'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/107101
final
List
<
ScrollDirection
>
receivedResult
=
<
ScrollDirection
>[];
const
List
<
ScrollDirection
>
expectedReverseResult
=
<
ScrollDirection
>[
ScrollDirection
.
reverse
,
ScrollDirection
.
idle
];
const
List
<
ScrollDirection
>
expectedForwardResult
=
<
ScrollDirection
>[
ScrollDirection
.
forward
,
ScrollDirection
.
idle
];
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
NotificationListener
<
UserScrollNotification
>(
onNotification:
(
UserScrollNotification
notification
)
{
if
(
notification
.
depth
!=
1
)
{
return
true
;
}
receivedResult
.
add
(
notification
.
direction
);
return
true
;
},
child:
NestedScrollView
(
headerSliverBuilder:
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
=>
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
250.0
,
pinned:
true
,
),
],
body:
ListView
.
builder
(
padding:
const
EdgeInsets
.
all
(
8
),
itemCount:
30
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
SizedBox
(
height:
50
,
child:
Center
(
child:
Text
(
'Item
$index
'
)),
);
},
),
),
),
),
));
// Fling down to trigger ballistic activity
await
tester
.
fling
(
find
.
text
(
'Item 3'
),
const
Offset
(
0.0
,
-
250.0
),
10000.0
);
await
tester
.
pumpAndSettle
();
expect
(
receivedResult
,
expectedReverseResult
);
receivedResult
.
clear
();
// Drag forward, without ballistic activity
await
tester
.
drag
(
find
.
text
(
'Item 29'
),
const
Offset
(
0.0
,
20.0
));
await
tester
.
pump
();
expect
(
receivedResult
,
expectedForwardResult
);
});
testWidgets
(
'NestedScrollView respects clipBehavior'
,
(
WidgetTester
tester
)
async
{
Widget
build
(
NestedScrollView
nestedScrollView
)
{
return
Localizations
(
...
...
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