カテゴリー・パッケージ・リポジトリを検索

パッケージ詳細v0.0.3

phased

アニメーションに焦点を当てた簡素な状態管理

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
991
いいね数
6
Pub ポイント
150

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

flutter pub add phased

パッケージ概要

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

Phased は、アニメーションに焦点を当てて状態管理を簡素化する Flutter パッケージです。開発者が宣言的で直感的な方法で状態遷移を管理できるようにし、特にアニメーション変更に大きく依存する UI に適しています。状態の更新を段階に分けて整理することで、ウィジェット間でスムーズかつ調整されたアニメーションを保証します。このパッケージは Flutter のアニメーションシステムとシームレスに統合され、複雑な状態駆動型アニメーションのための明確で読みやすいコードを促進します。

用途

  • UI状態遷移のアニメーション化
  • 複数ステップのユーザー・フローの管理
  • インタラクティブなオンボーディング画面の作成
  • 動的更新を使用した応答性のあるダッシュボードの構築
  • 複数のウィジェット間でアニメーションを同期する

主な機能

  • フェーズベースの状態管理
  • 組み込みアニメーション調整
  • 状態変更のための宣言的構文
  • 軽量で最小限のボイラープレート
  • Flutter のアニメーションフレームワークとのシームレスな統合

適している対象

  • アニメーションの品質を最優先とする開発者
  • 複雑な状態駆動アニメーションを備えたプロジェクト
  • シンプルな状態管理を求めるチーム
  • UI重視のアプリケーション、たとえばオンボーディングやダッシュボード
  • Flutterの初心者がアニメーションパターンを学ぶ

注意事項

  • アニメーション中心のアプリに最適
  • 状態処理の新しいパラダイムを学ぶ必要がある可能性があります
  • 大規模なデータ中心のアプリケーションには適していない
  • 基本的な例以外のドキュメントは限られている
  • Flutter のアニメーションコンセプトの理解が必要です

元の README

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

Phased

style: very good analysis License: MIT

Simplified state management focused on animations

Installation 💻

❗ In order to start using Phased you must have the Flutter SDK installed on your machine.

Add phased to your pubspec.yaml:

dependencies:
  phased:

Install it:

flutter packages get

Description

Phased is a simple state management meant to be used to build animations, its objective is to provide an easy, boilerplateless way to create and manage the state of an animation, so developers can focus on building the animations themselves.

The package consists of two classes: PhasedState, which describes the state and offers control methods for an animation, and Phased, an abstract Widget that will build the animation itself.

Example

To build a simple animation that blinks a child using opacity, the following code can be used:

class BlinkState extends PhasedState<bool> {
  BlinkState() : super(values: [true, false]);
}

class Blink extends Phased<bool> {
  const Blink({
    super.key,
    required super.state,
    required this.child,
  });

  final Widget child;

  @override
  Widget build(BuildContext context) {
    return AnimatedOpacity(
      opacity: state.phaseValue(
        values: const {true: 1},
        defaultValue: 0,
      ),
      onEnd: state.next,
      duration: const Duration(milliseconds: 250),
      child: child,
    );
  }
}

Then to use it:

Blink(
  state: BlinkState(),
  child: Container(
    width: 100,
    height: 100,
    color: Colors.blue,
  ),
);

For more complex examples, check the example folder.


カテゴリー

ソースリポジトリ

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