parent
718859ad8d
commit
6a9ea16e9f
@ -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
|
||||||
|
@ -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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user