パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.1.0

animated_stream_list

Streamからの変更をアニメーション付きで簡単にリスト表示するためのFlutterライブラリです。アニメーション付きのStreamBuilder + ListView.Builderのようなものです。

30日間ダウンロード
139
いいね数
33
Pub ポイント
30

パッケージをインストール

flutter pub add animated_stream_list

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Streamからのアニメーション付き更新を簡単に表示するためのFlutterパッケージです。StreamBuilderとListView.builderの機能を統合し、挿入、削除、更新用の組み込みアニメーションを備えています。リアルタイムデータベースやユーザー入力などの動的データソースに最適で、手動でのアニメーション処理なしにスムーズな視覚的遷移を保証します。ライブラリは軽量で、既存プロジェクトへの統合も簡単です。

用途

  • リアルタイムデータフィード
  • 動的リストの更新
  • チャットアプリのメッセージリスト
  • ユーザーが作成したコンテンツが表示されます
  • ライブダッシュボードデータ

主な機能

  • 組み込みアイテムアニメーション
  • ストリーム駆動型リストの更新
  • 最小限のボイラープレート
  • スムーズな挿入/削除トランジション
  • ストリームの変更時に自動再構築

適している対象

  • シンプルなアニメーション付きリストを探している開発者
  • リアルタイムデータを備えたプロジェクト
  • 応答性のあるUIを必要とするアプリ
  • Flutter初心者が学ぶストリーム
  • UI重視のアプリケーション

注意事項

  • 基本的なアニメーションを超えるカスタマイズは限られている
  • カスタムスクロール物理学のサポートなし
  • 非常に大きなデータセットには最適化されていません
  • ストリームの管理に注意が必要です
  • 頻繁な更新によりパフォーマンスに影響する可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Animated Stream List

pub package Build Status

A Flutter library to easily display a list with animated changes from a Stream<List<E>>.
It's like StreamBuilder + ListView.Builder with animations.
Taken inspiration from the Animated List Sample and Java-diff-utils

Getting Started

1. Add dependency to your pubspec.yaml
dependencies:
  animated_stream_list: ^1.1.0
2. Import it
import 'package:animated_stream_list/animated_stream_list.dart';
3. Use it. See the examples folder for an ... example.

Parameters

@required Stream<List<E>> streamList;
@required AnimatedStreamListItemBuilder<E> itemBuilder; 
@required AnimatedStreamListItemBuilder<E> itemRemovedBuilder; 
Duration duration;

AnimatedStreamListItemBuilder<T> is just a function which builds a tile

typedef Widget AnimatedStreamListItemBuilder<T>(
  T item,
  int index,
  BuildContext context,
  Animation<double> animation,
); 

Example

// create tile view as the user is going to see it, attach any onClick callbacks etc. 
Widget _createTile(String item, Animation<double> animation) {    
 return SizeTransition(      
    axis: Axis.vertical,      
    sizeFactor: animation,      
    child: const Text(item),    
  ); 
}

// what is going to be shown as the tile is being removed, usually same as above but without any 
// onClick callbacks as, most likely, you don't want the user to interact with a removed view 
Widget _createRemovedTile(String item, Animation<double> animation) {    
 return SizeTransition(      
    axis: Axis.vertical,      
    sizeFactor: animation,      
    child: const Text(item),    
  ); 
}

final Stream<List<String>> list = // get list from some source, like BLOC  
final animatedView = AnimatedStreamList<String>(      
  streamList: list,      
  itemBuilder: (String item, int index, BuildContext context, Animation<double> animation) =>      
    _createTile(item, animation),      
  itemRemovedBuilder: (String item, int index, BuildContext context, Animation<double> animation) =>  
    _createRemovedTile(item, animation), 
  ); 
} 

Options

List<E> initialList;

Initial list

Equalizer equals; 

Compares items for equality, by default it uses the == operator, it's critical this works properly.

Equalizer is function, that, given two items of the same type, returns true if they are equal, false otherwise

typedef bool Equalizer(dynamic item1, dynamic item2); 

You can check the Animated List Documentation for the rest:

Axis scrollDirection;
bool reverse;
ScrollController scrollController;
bool primary;
ScrollPhysics scrollPhysics;
bool shrinkWrap;
EdgeInsetsGeometry padding;

Credits

This amazing package was originally created by Dawid Bota over here. I have taken over the development with his blessing and all tracking will be done on this repo moving forward.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。