findChildIndexBuilder method

  1. @override
int findChildIndexBuilder(
  1. String id,
  2. List<AssetEntity> currentAssets
)
override

Indicates how would the grid found a reusable RenderObject through id. 为 Grid 布局指示如何找到可复用的 RenderObject

Implementation

@override
int findChildIndexBuilder(String id, List<AssetEntity> currentAssets) {
  int index = currentAssets.indexWhere((AssetEntity e) => e.id == id);
  if (specialItemPosition == SpecialItemPosition.prepend) {
    index += 1;
  }
  return index;
}