setLayoutPosition method
Implementation
@override
void setLayoutPosition(
List<DraggableAnimationItem> targetItemList,
Size layoutSize
){
final itemWidth = (layoutSize.width - spacingX * (columnCount -1) ) / columnCount ;
double rowCount = 0;
double colCount = 0;
int index = 0;
for(var item in targetItemList){
if(index % columnCount == 0) {
if(index != 0 ) rowCount++;
colCount = 0;
}else {
colCount++;
}
double top = rowCount * (rowHeight + spacingY);
double left = colCount * (itemWidth + spacingX);
index++;
item.width = itemWidth;
item.height = rowHeight;
item.dx = left;
item.dy = top;
}
}