Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blink issue #50

Merged
merged 5 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.0.0
## 1.0.1

* Minor fix
* Fixed blink issue

2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.3"
version: "1.0.0"
async:
dependency: transitive
description:
Expand Down
Binary file modified gif/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gif/demo1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions lib/src/builder/motion_animated_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ class MotionBuilderState extends State<MotionBuilder>

final motionData = MotionData(
endOffset: Offset.zero, startOffset: Offset.zero, visible: false);
final lastKey = childrenMap.keys.last;
childrenMap.update(lastKey, (value) => value.copyWith(visible: false));

final updatedChildrenMap = <int, MotionData>{};
if (childrenMap.containsKey(itemIndex)) {
Expand Down Expand Up @@ -625,8 +627,8 @@ class MotionBuilderState extends State<MotionBuilder>
motionData: motionData,
updateMotionData: (MotionData motionData) {
final itemOffset = _itemOffsetAt(index);
childrenMap[index] =
motionData.copyWith(startOffset: itemOffset, endOffset: itemOffset);
childrenMap[index] = motionData.copyWith(
startOffset: itemOffset, endOffset: itemOffset, visible: true);
},
capturedThemes:
InheritedTheme.capture(from: context, to: overlay.context),
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 @@ -76,7 +76,7 @@ class MotionAnimatedContentState extends State<MotionAnimatedContent>
listState.registerItem(this);
}
if (oldWidget.index != widget.index) {
visible = false;
visible = widget.motionData.visible;
}
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
if (mounted) {
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.0
version: 1.0.1
repository: https://github.com/canopas/animated_reorderable_list

environment:
Expand Down
Loading