automatic_animated_list 1.1.0 copy "automatic_animated_list: ^1.1.0" to clipboard
automatic_animated_list: ^1.1.0 copied to clipboard

AnimatedList which computes the item deltas each time the underlying list gets updated, and animates the list tiles automatically.

AutomaticAnimatedList #

An AnimatedList which automatically computes the item deltas each time the underlying list changes and animates the list items automatically.

Example #

Usage #

Just provide AutomaticAnimatedList<T> your list, a keyingFunction, which will return an identifing key for each item, and the itemBuilder.

AutomaticAnimatedList<T> will take care of the rest.

class ItemsAnimatedList extends StatelessWidget {
  final List<ItemModel> items;
  const ItemsList({
    Key key,
    this.items,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AutomaticAnimatedList<ItemModel>(
      items: items,
      insertDuration: Duration(seconds: 1),
      removeDuration: Duration(seconds: 1),
      keyingFunction: (ItemModel item) => Key(item.id),
      itemBuilder:
          (BuildContext context, ItemModel item, Animation<double> animation) {
        return FadeTransition(
          key: Key(item.id),
          opacity: animation,
          child: SizeTransition(
            sizeFactor: CurvedAnimation(
              parent: animation,
              curve: Curves.easeOut,
              reverseCurve: Curves.easeIn,
            ),
            child: ListTile(title: Text(item.name)),
          ),
        );
      },
    );
  }
}
copied to clipboard
37
likes
120
points
2.13k
downloads

Publisher

unverified uploader

Weekly Downloads

2024.08.19 - 2025.03.03

AnimatedList which computes the item deltas each time the underlying list gets updated, and animates the list tiles automatically.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

diffutil_dart, flutter

More

Packages that depend on automatic_animated_list