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
6a9ea16e
Commit
6a9ea16e
authored
Feb 24, 2017
by
Adam Barth
Committed by
GitHub
Feb 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jumpTo during a user drag shouldn't assert (#8384)
Fixes #8380
parent
718859ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
2 deletions
+58
-2
scroll_position.dart
packages/flutter/lib/src/widgets/scroll_position.dart
+5
-2
scroll_view_test.dart
packages/flutter/test/widgets/scroll_view_test.dart
+53
-0
No files found.
packages/flutter/lib/src/widgets/scroll_position.dart
View file @
6a9ea16e
...
@@ -629,8 +629,11 @@ class DragScrollActivity extends ScrollActivity {
...
@@ -629,8 +629,11 @@ class DragScrollActivity extends ScrollActivity {
@override
@override
Notification
createScrollEndNotification
(
AbstractScrollState
scrollable
)
{
Notification
createScrollEndNotification
(
AbstractScrollState
scrollable
)
{
assert
(
_lastDetails
is
DragEndDetails
);
// We might not have DragEndDetails yet if we're being called from beginActivity.
return
new
ScrollEndNotification
(
scrollable:
scrollable
,
dragDetails:
_lastDetails
);
return
new
ScrollEndNotification
(
scrollable:
scrollable
,
dragDetails:
_lastDetails
is
DragEndDetails
?
_lastDetails
:
null
);
}
}
@override
@override
...
...
packages/flutter/test/widgets/scroll_view_test.dart
View file @
6a9ea16e
...
@@ -115,4 +115,57 @@ void main() {
...
@@ -115,4 +115,57 @@ void main() {
expect
(
log
,
equals
(<
String
>[
'Massachusetts'
]));
expect
(
log
,
equals
(<
String
>[
'Massachusetts'
]));
log
.
clear
();
log
.
clear
();
});
});
testWidgets
(
'Can jumpTo during drag'
,
(
WidgetTester
tester
)
async
{
final
List
<
Type
>
log
=
<
Type
>[];
final
ScrollController
controller
=
new
ScrollController
();
await
tester
.
pumpWidget
(
new
NotificationListener
<
ScrollNotification
>(
onNotification:
(
ScrollNotification
notification
)
{
log
.
add
(
notification
.
runtimeType
);
return
false
;
},
child:
new
ListView
(
controller:
controller
,
children:
kStates
.
map
<
Widget
>((
String
state
)
{
return
new
Container
(
height:
200.0
,
child:
new
Text
(
state
),
);
}).
toList
(),
),
));
expect
(
log
,
isEmpty
);
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Point
(
100.0
,
100.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
100.0
));
expect
(
log
,
equals
(<
Type
>[
ScrollStartNotification
,
UserScrollNotification
,
ScrollUpdateNotification
,
]));
log
.
clear
();
await
tester
.
pump
();
controller
.
jumpTo
(
550.0
);
expect
(
controller
.
offset
,
equals
(
550.0
));
expect
(
log
,
equals
(<
Type
>[
ScrollEndNotification
,
UserScrollNotification
,
ScrollStartNotification
,
ScrollUpdateNotification
,
ScrollEndNotification
,
]));
log
.
clear
();
await
tester
.
pump
();
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
100.0
));
expect
(
controller
.
offset
,
equals
(
550.0
));
expect
(
log
,
isEmpty
);
});
}
}
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