SliverImplicitlyAnimatedList<E extends Object> constructor
- Key? key,
- required List<
E> items, - required dynamic 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,
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,
);