findChildIndexBuilder method

  1. @override
int findChildIndexBuilder({
  1. required String id,
  2. required List<AssetEntity> assets,
  3. int placeholderCount = 0,
})
override

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

See also:

Implementation

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