From 081d260e94031f07247bfce130c35dc9257dcfa8 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Thu, 19 Jan 2023 12:12:32 +0530 Subject: [PATCH] Fixed remove item animation bug --- CHANGELOG.md | 3 +++ example/pubspec.lock | 2 +- lib/src/multi_image_picker_controller.dart | 6 ++---- lib/src/multi_image_picker_view.dart | 3 +-- pubspec.yaml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66bc380..9e55cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.0.13 +- Fixed remove item animation bug + ## 0.0.12 - Github pages demo project added - maxImages 1 support diff --git a/example/pubspec.lock b/example/pubspec.lock index 748ce04..444cfaf 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -148,7 +148,7 @@ packages: path: ".." relative: true source: path - version: "0.0.12" + version: "0.0.13" path: dependency: transitive description: diff --git a/lib/src/multi_image_picker_controller.dart b/lib/src/multi_image_picker_controller.dart index 3036909..435fa5f 100644 --- a/lib/src/multi_image_picker_controller.dart +++ b/lib/src/multi_image_picker_controller.dart @@ -61,13 +61,11 @@ class MultiImagePickerController with ChangeNotifier { } /// Manually re-order image, i.e. move image from one position to another position. - void reOrderImage(int oldIndex, int newIndex, {bool notify = true}) { + void reOrderImage(int oldIndex, int newIndex) { final oldItem = _images.removeAt(oldIndex); oldItem.size; _images.insert(newIndex, oldItem); - if (notify) { - notifyListeners(); - } + notifyListeners(); } /// Manually remove image from list. diff --git a/lib/src/multi_image_picker_view.dart b/lib/src/multi_image_picker_view.dart index 21bfae0..a7d622f 100644 --- a/lib/src/multi_image_picker_view.dart +++ b/lib/src/multi_image_picker_view.dart @@ -174,8 +174,7 @@ class _MultiImagePickerViewState extends State { onReorder: (List orderUpdateEntities) { for (final orderUpdateEntity in orderUpdateEntities) { widget.controller.reOrderImage( - orderUpdateEntity.oldIndex, orderUpdateEntity.newIndex, - notify: false); + orderUpdateEntity.oldIndex, orderUpdateEntity.newIndex); if (widget.onChange != null) { widget.onChange!(widget.controller.images); } diff --git a/pubspec.yaml b/pubspec.yaml index 12ff889..af3912d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: multi_image_picker_view description: A complete widget which can easily pick multiple images from device and display them in UI. Also picked image can be re-ordered and removed easily. -version: 0.0.12 +version: 0.0.13 homepage: https://github.com/shubham-gupta-16/multi_image_picker_view repository: https://github.com/shubham-gupta-16/multi_image_picker_view issue_tracker: https://github.com/shubham-gupta-16/multi_image_picker_view/issues