AnimatedList (Flutter Widget of the Week)

Flutter · 403K views · 2019 · 2:57

Open on YouTube

Software (other)UX & UI designtutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking how to animate list insertions and removals in Flutter, as a quick visual intro to AnimatedList and its GlobalKey-based API.

Recommended by 5 people across 5 different months, 2019 to 2022.

What it is

A short Flutter team video from the Widget of the Week series that introduces AnimatedList, a widget for animating items as they are inserted into or removed from a list. It covers the basic setup, including the GlobalKey and the animation callbacks, in under three minutes.

What people said

Recommends kristiyan.mitev · 2019-06 · Stack Overflow · on “Immutable vs Observable collections in Flutter”

I guess you already watched this, but the referenced example in your question is marked "out-of-date", so here: [this video] I haven't looked at the source of `AnimatedList` but I think it's maintaining its own internal duplicate of the list, because of `removeItem()`... because maybe it needs to keep a reference to the object being removed until the animation finishes? One thing you could try is use the `old - new = changed` logic and build your own implementation of `AnimatedList` with maybe a `ListView` wrapped in a `StreamBuilder`.

Recommends George D · 2019-12 · Stack Overflow · on “How to dismiss item w/ Dismissible widget by tap in AnimatedBuilder?”

For those who got in same situation, I've found the workaround. First, its better to use AnimatedList instead of PageView . Detailed information about AnimatedList you can find here [this video] and here [LINK] . Then you have to specify Dismissible in ItemBuilder class. And that's it, hope it

Recommends Josteve Adekanbi · 2020-03 · Stack Overflow · on “How to animate list changes in Flutter”

I think you need AnimatedList...I wrote an example. You can only set Duration when you want to insert into the list or delete from the List and this is achieved by creating a GlobalKey of AnimatedListState... I wrote an example code for inserting class Pool extends StatelessWidget { final keys = GlobalKey<AnimatedListState>(); var list = List.generate(3, (i) => "Hello $i"); @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: AnimatedList( key: keys, initialItemCount: list.length, itemBuilder: (context, index, animation) { return SlideTransition( position: animation.drive( Tween<Offset>(begin: Offset(1, 0), end: Offset(0, 0)) .chain(CurveTween(curve: Curves.

Recommends user14280337 · 2021-04 · Stack Overflow · on “How to change row/column states with animation in Flutter?”

Flutter already has tons of useful widgets which you can use for this implementation. I believe that the AnimatedList widget solves your problem. I have added the widget of the week video and a basic example below. Widget of the Week - AnimatedList [this video] Example: import 'package:flutter/material.dart'; class PageOne extends StatefulWidget { @override _PageOneState createState() => _PageOneState(); } class _PageOneState extends State<PageOne> { /// The global key to access the animated list. final _animatedListKey = GlobalKey<AnimatedListState>(); List<String> _items = []; @override void initState() { // Set the items that should be display. _items = ['A', 'B', 'D', 'E', 'F']; super.initSta

Recommends Yusuf-Uluc · 2021-07 · Stack Overflow · on “i need animate item when scrolling listview in flutter”

Check out the AnimatedList Widget, it propably fulfills your needs. Here some resources: flutter docs [LINK] Flutter Widget of the Week [this video] Medium Article [LINK] You can set how the items enter the screen and how they leave the screen. If you create a custom animation for it you are propaby good to go.

Cites user9836706 · 2019-06 · Stack Overflow · on “How to use AnimatedList Widget in Flutter”

I saw this video on youtube [this video] and I'm trying to implement an animated list, but I'm not really familiar with animations. What I'm supposed to insert as position: animation.drive(), and removeItem(_index,(context,animation)=> /// what I'm supposed to do here ),); here's the code (just few changes from the "starting app") class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin { List<int> _list = []; final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>(); void

Cites Sergiy Vergun · 2020-02 · Stack Overflow · on “Correct way to point one variable on another in dart”

I use global key to handle AnimatedList, just as it was shown in this short video [this video] . So better solution will be just to pass animatedList's state directly to bloc instead of using global key? Or maybe there is another type of key which I can use to handle state? Thank you for your response! It's really helpful.

Cites Suragch · 2020-06 · Stack Overflow · on “Flutter SlideTransition with AnimatedList”

In the Widget of the Week video [this video] they show the code to animate off an item like this: AnimatedList( initialItemCount: _myItems.length, itemBuilder: (context, index, animation) { return SlideTransition( position: animation.drive(MyTween()), child: ... ); } ) I can't figure out how to configure MyTween() to show the child onscreen to start and then slide off screen later. I finally discovered the answer so I am sharing it below.

Cites NearHuscarl · 2021-10 · Stack Overflow · on “How to animate the items rendered initially using Animated List in flutter”

@Patzu You're thinking too much brother. It does call `setState` inside `AnimatedList` when you call `_listKey.currentState?.insertItem()` or `removeItem()`. See this [this video] video for the summary. Here [LINK] is the source for the concrete evidence.

Cites Hamid Musayev · 2022-07 · Stack Overflow · on “How can i add delay between items in listview.builder?”

You can use AnimatedListView like this code below [this video] // main.dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Test', theme: ThemeData( primaryColor: Colors.green, colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.greenAccent)), home: const HomePage(), ); } } class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> {