Giter Site home page Giter Site logo

elplaso / implicitly_animated_list Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcelgarus/implicitly_animated_list

0.0 0.0 0.0 1.58 MB

A Flutter widget that implicitly animates a list whenever it rebuilds with new items.

License: MIT License

Objective-C 0.55% Kotlin 4.97% Dart 88.48% Swift 6.00%

implicitly_animated_list's Introduction

Often, your lists represent some kind of data.

You can just pass the original list data to the ImplicitlyAnimatedList as well as an itemBuilder for building a widget from one data point and it'll animate whenever the data changes:

ImplicitlyAnimatedList(
  // When you change items of this list and hot reload, the list animates. 
  itemData: [1, 2, 3, 4],
  itemBuilder: (_, number) => ListTile(title: Text('$number')),
),

It works with all classes and works well with StreamBuilder:

class User {
  String firstName;
  String lastName;

  // The ImplicitlyAnimatedList uses the == operator to compare items.
  bool operator== (Object other) => other is User
    && firstName == other.firstName
    && lastName == other.lastName;
}

...

StreamBuilder<List<User>>(
  stream: someSource.usersStream,
  builder: (context, snapshot) {
    if (!snapshot.hasData) {
      return ...;
    }
    return ImplicitlyAnimatedList(
      itemData: snapshot.data,
      itemBuilder: (context, user) {
        return ListTile(title: Text('${user.firstName} ${user.lastName}'));
      }
    );
  }
),

Here's an example that generates random numbers and animates from one state to the next (notice it's only 10 fps because of being a gif):

example showcase

implicitly_animated_list's People

Contributors

elplaso avatar jonaswanke avatar marcelgarus avatar mxzinke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.