SliverImplicitlyAnimatedList<E extends Object> constructor

const SliverImplicitlyAnimatedList<E extends Object>({
  1. Key? key,
  2. required List<E> items,
  3. required dynamic itemBuilder,
  4. required ItemDiffUtil<E> areItemsTheSame,
  5. RemovedItemBuilder<Widget, E>? removeItemBuilder,
  6. UpdatedItemBuilder<Widget, E>? updateItemBuilder,
  7. Duration insertDuration = const Duration(milliseconds: 500),
  8. Duration removeDuration = const Duration(milliseconds: 500),
  9. Duration updateDuration = const Duration(milliseconds: 500),
  10. bool? spawnIsolate,
})

Creates a Flutter Sliver that implicitly animates between the changes of two lists.

The items parameter represents the current items that should be displayed in the list.

The itemBuilder callback is used to build each child as needed. The parent must be a Reorderable widget.

The areItemsTheSame callback is called by the DiffUtil to decide whether two objects represent the same item. For example, if your items have unique ids, this method should check their id equality.

The onReorderFinished callback is called in response to when the dragged item has been released and animated to its final destination. Here you should update the underlying data in your model/bloc/database etc.

The spawnIsolate flag indicates whether to spawn a new isolate on which to calculate the diff between the lists. Usually you wont have to specify this value as the MyersDiff implementation will use its own metrics to decide, whether a new isolate has to be spawned or not for optimal performance.

Implementation

const SliverImplicitlyAnimatedList({
  Key? key,
  required List<E> items,
  required AnimatedItemBuilder<Widget, E> itemBuilder,
  required ItemDiffUtil<E> areItemsTheSame,
  RemovedItemBuilder<Widget, E>? removeItemBuilder,
  UpdatedItemBuilder<Widget, E>? updateItemBuilder,
  Duration insertDuration = const Duration(milliseconds: 500),
  Duration removeDuration = const Duration(milliseconds: 500),
  Duration updateDuration = const Duration(milliseconds: 500),
  bool? spawnIsolate,
}) : super(
        key: key,
        items: items,
        itemBuilder: itemBuilder,
        areItemsTheSame: areItemsTheSame,
        removeItemBuilder: removeItemBuilder,
        updateItemBuilder: updateItemBuilder,
        insertDuration: insertDuration,
        removeDuration: removeDuration,
        updateDuration: updateDuration,
        spawnIsolate: spawnIsolate,
      );