Commit 0736fac4 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

DrivenScrollActivity._end didn't handle being already disposed (#8219)

parent 1bd7dbc2
...@@ -750,7 +750,7 @@ class DrivenScrollActivity extends ScrollActivity { ...@@ -750,7 +750,7 @@ class DrivenScrollActivity extends ScrollActivity {
} }
void _end() { void _end() {
position.beginBallisticActivity(velocity); position?.beginBallisticActivity(velocity);
} }
@override @override
......
...@@ -143,4 +143,21 @@ void main() { ...@@ -143,4 +143,21 @@ void main() {
expect(controller.offset, equals(105.0)); expect(controller.offset, equals(105.0));
expect(realOffset(), equals(controller.offset)); expect(realOffset(), equals(controller.offset));
}); });
testWidgets('DrivenScrollActivity ending after dispose', (WidgetTester tester) async {
ScrollController controller = new ScrollController();
await tester.pumpWidget(new ListView(
controller: controller,
children: <Widget>[ new Container(height: 200000.0) ],
));
controller.animateTo(1000.0, duration: const Duration(seconds: 1), curve: Curves.linear);
await tester.pump(); // Start the animation.
// We will now change the tree on the same frame as the animation ends.
await tester.pumpWidget(new Container(), const Duration(seconds: 2));
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment