[Flutter]AnimationControllerからアニメーションの状態を取得する方法

Flutter

どうも、ちょげ(@chogetarou)です。

AnimationControllerからアニメーションの状態を取得する方法を紹介します。

スポンサーリンク

方法

インターフェース, インターネット, プログラム, ブラウザ, Www

アニメーションの状態を取得するには、「status」プロパティを使います。

AnimationControllerの「status」にアクセスすることで、アニメーションの状態を知ることが出来ます。

AnimationController _controller = AnimationController(
      duration: Duration(seconds: 1),
      vsync: this,
    );
・・・・
_controller.status;

アニメーションの状態には、以下の2つがあります。

  • AnimationStatus.completed : アニメーション終了後
  • AnimationStatus.dismissed : アニメーションする前

「status」を使うと、上記のいずれかを取得します。

まとめ

アニメーションの状態を取得するには、「AnimationController」の「status」プロパティを使います。

コメント

タイトルとURLをコピーしました