Skip to content

Commit

Permalink
Fix blink issue for AnimatedGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneha-s committed Apr 11, 2024
1 parent dff985a commit 023a978
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/src/builder/motion_animated_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,16 @@ class MotionBuilderState extends State<MotionBuilder>
}

Offset getChildOffset(int index) {
final offset= _itemOffsetAt(index);
final currentOffset= _itemOffsetAt(index);
if(!isGrid){
return currentOffset;
}
final gridDelegate= widget.delegateBuilder as SliverReorderableGridDelegateWithFixedCrossAxisCount;
final int col= index % gridDelegate.crossAxisCount;
if(col == gridDelegate.crossAxisCount-1){
return Offset(gridDelegate.childCrossAxisExtent, offset.dy+gridDelegate.childMainAxisExtent);
return Offset(gridDelegate.childCrossAxisExtent, currentOffset.dy+gridDelegate.childMainAxisExtent);
}else{
return Offset(offset.dx+gridDelegate.childCrossAxisExtent, offset.dy);
return Offset(currentOffset.dx+gridDelegate.childCrossAxisExtent, currentOffset.dy);
}
}

Expand Down

0 comments on commit 023a978

Please sign in to comment.