Skip to content

Commit

Permalink
Fix onReorderEnd method (#59)
Browse files Browse the repository at this point in the history
* Minor change

* Update readme
  • Loading branch information
cp-sneha-s authored Apr 30, 2024
1 parent ed916ef commit 7bfe779
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.5 (Apr 30, 2024)

# Changelog

## Bug Fixes
- Fix `onReorderEnd` callback not being called after reordering is completed.

# 1.0.4 (Apr 14, 2024)

# Changelog
Expand Down
6 changes: 6 additions & 0 deletions example/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ class _HomePageState extends State<HomePage> {
list.insert(newIndex, user);
});
},
onReorderEnd: (int index) {
print(" End index : $index");
},
onReorderStart: (int index) {
print(" Start index : $index");
},
proxyDecorator: proxyDecorator

/* A custom builder that is for inserting items with animations.
Expand Down
1 change: 1 addition & 0 deletions lib/src/builder/motion_animated_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class MotionBuilderState extends State<MotionBuilder>
}

void _dragEnd(_DragInfo item) {
widget.onReorderEnd?.call(_insertIndex!);
setState(() => _finalDropPosition = _itemOffsetAt(_insertIndex!));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/component/motion_animated_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class MotionAnimatedContentState extends State<MotionAnimatedContent>
setState(() {
visible = true;
});
widget.updateMotionData?.call(widget.motionData);
}
widget.updateMotionData?.call(widget.motionData);
});
super.didUpdateWidget(oldWidget);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animated_reorderable_list
description: A Flutter Reorderable Animated List with simple implementation and smooth transition.
version: 1.0.4
version: 1.0.5
repository: https://github.com/canopas/animated_reorderable_list

environment:
Expand Down

0 comments on commit 7bfe779

Please sign in to comment.