From 0ba45d82beb88ca2e49a9b0534e8522806096299 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 23 Nov 2020 15:46:38 +0530 Subject: [PATCH] fix: Fixed dispose errors --- lib/src/reaction_picker.dart | 9 ++++++++- pubspec.yaml | 2 +- test/src/message_action_modal_test.dart | 1 + test/src/message_reaction_modal_test.dart | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/src/reaction_picker.dart b/lib/src/reaction_picker.dart index 8d337498..83698e46 100644 --- a/lib/src/reaction_picker.dart +++ b/lib/src/reaction_picker.dart @@ -127,7 +127,6 @@ class _ReactionPickerState extends State void pop() async { for (var a in animations) { a.stop(); - //a.dispose(); } Navigator.of(context).pop(); } @@ -145,4 +144,12 @@ class _ReactionPickerState extends State StreamChannel.of(context).channel.deleteReaction(widget.message, reaction); pop(); } + + @override + void dispose() { + for (var a in animations) { + a?.dispose(); + } + super.dispose(); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 689a54b8..85f164b8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,7 +38,7 @@ dependencies: media_gallery: ^0.1.5 permission_handler: ^5.0.1+1 transparent_image: ^1.0.0 - ezanimation: ^0.4.0 + ezanimation: ^0.4.1 flutter: assets: diff --git a/test/src/message_action_modal_test.dart b/test/src/message_action_modal_test.dart index 1427edd6..b186ab91 100644 --- a/test/src/message_action_modal_test.dart +++ b/test/src/message_action_modal_test.dart @@ -40,6 +40,7 @@ void main() { ); await tester.pump(); + await tester.pump(Duration(milliseconds: 1000)); expect(find.byKey(Key('MessageWidget')), findsOneWidget); expect(find.byIcon(StreamIcons.sorting_up), findsOneWidget); expect(find.byIcon(StreamIcons.edit), findsOneWidget); diff --git a/test/src/message_reaction_modal_test.dart b/test/src/message_reaction_modal_test.dart index e270793e..4cf3dafa 100644 --- a/test/src/message_reaction_modal_test.dart +++ b/test/src/message_reaction_modal_test.dart @@ -87,6 +87,7 @@ void main() { ); await tester.pump(); + await tester.pump(Duration(milliseconds: 1000)); expect(find.byKey(Key('MessageWidget')), findsOneWidget); expect(find.byIcon(StreamIcons.thumbs_up_reaction), findsNWidgets(2)); expect(find.byIcon(StreamIcons.love_reaction), findsNWidgets(2));