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

This commit is contained in:
Ian Hickson 2017-02-16 17:15:03 -08:00 committed by GitHub
parent 1bd7dbc2ec
commit 0736fac441
2 changed files with 18 additions and 1 deletions

View File

@ -750,7 +750,7 @@ class DrivenScrollActivity extends ScrollActivity {
}
void _end() {
position.beginBallisticActivity(velocity);
position?.beginBallisticActivity(velocity);
}
@override

View File

@ -143,4 +143,21 @@ void main() {
expect(controller.offset, equals(105.0));
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));
});
}