AnimatedList Flutter

AnimatedList Flutter :

Screenshot :

AnimatedList  Flutter
import 'package:flutter/material.dart';
import 'dart:math';

void main() => runApp(MyApp());

class Item {
  String name;

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AnimatedList Flutter Tutorial',
      home: ListViewAnimatedScreen(),

class ListViewAnimatedScreen extends StatefulWidget {
  _AnimatedListState createState() => _AnimatedListState();

class _AnimatedListState extends State<ListViewAnimatedScreen> {
  List<Item> items = new List();
  final GlobalKey<AnimatedListState> listKey = GlobalKey<AnimatedListState>();
  var rng = new Random();

  _addItem() {
    setState(() {
          .insertItem(items.length, duration: const Duration(seconds: 1));
      items.add(new Item(name: "Flutter Tutorial"));

  _removeItem() {
    setState(() {
      int id = rng.nextInt(items.length);
        (context, animation) => buildItem(context, 0, animation),
        duration: const Duration(milliseconds: 250),

  Widget buildItem(
      BuildContext context, int index, Animation<double> animation) {
    return SizeTransition(
      key: ValueKey<int>(index),
      axis: Axis.vertical,
      sizeFactor: animation,
      child: SizedBox(
        child: ListTile(
          title: Text('${items[index].name}'),

  Widget build(BuildContext context) {
    final Map<int, Animation<double>> animations = <int, Animation<double>>{};
    return Scaffold(
        appBar: AppBar(
          title: Text("AnimatedList"),
          actions: <Widget>[
              icon: const Icon(Icons.add),
              onPressed: _addItem,
              icon: const Icon(Icons.remove),
              onPressed: _removeItem,
        body: Directionality(
            textDirection: TextDirection.ltr,
            child: AnimatedList(
              key: listKey,
              initialItemCount: items.length,
              itemBuilder: (context, index, animation) {
                return buildItem(context, index, animation);

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit