fix a DraggableScrollableSheet bug (#89335)
This commit is contained in:
@@ -466,6 +466,13 @@ class _DraggableScrollableSheetScrollPosition
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Stop the animation before dispose.
|
||||
_ballisticCancelCallback?.call();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void goBallistic(double velocity) {
|
||||
if (velocity == 0.0 ||
|
||||
|
||||
@@ -344,5 +344,23 @@ void main() {
|
||||
];
|
||||
expect(notificationTypes, types);
|
||||
});
|
||||
|
||||
testWidgets('Do not crash when remove the tree during animation.', (WidgetTester tester) async {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/89214
|
||||
await tester.pumpWidget(_boilerplate(
|
||||
null,
|
||||
onScrollNotification: (ScrollNotification notification) {
|
||||
return false;
|
||||
},
|
||||
));
|
||||
|
||||
await tester.flingFrom(const Offset(0, 325), const Offset(0, 325), 200);
|
||||
|
||||
// The animation is running.
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user