Skip to content

Commit

Permalink
Fix blink issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneha-s committed Feb 28, 2024
1 parent 4c3b378 commit 883fda8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion 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 @@ -626,7 +628,7 @@ class MotionBuilderState extends State<MotionBuilder>
updateMotionData: (MotionData motionData) {
final itemOffset = _itemOffsetAt(index);
childrenMap[index] =
motionData.copyWith(startOffset: itemOffset, endOffset: itemOffset);
motionData.copyWith(startOffset: itemOffset, endOffset: itemOffset, visible: true);
},
capturedThemes:
InheritedTheme.capture(from: context, to: overlay.context),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/component/motion_animated_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class MotionAnimatedContentState extends State<MotionAnimatedContent>
listState.registerItem(this);
}
if (oldWidget.index != widget.index) {
visible = false;
visible= widget.motionData.visible;
print("$index------------ $visible");
}
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
if (mounted) {
Expand Down

0 comments on commit 883fda8

Please sign in to comment.