LoginSignup
2
1

More than 1 year has passed since last update.

【Flutter小ネタ】リールWidget

Last updated at Posted at 2022-08-07

この記事って?

作成中のオンラインビンゴゲーム副産物であるリール部分のWidgetの紹介。
CodePenの埋込み練習も兼ねて投稿。
アニメーションを一から作るのは現実的では無いので、ListViewを使って実装しています。

See the Pen Untitled by Yomoyama Dev68 (@yomoyama-dev68) on CodePen.

気づきメモ

  • EdgeFadeを有効にするには、Androidと違いListViewに設定するのではなく、ShaderMaskをListViewの親にしてFade設定する。
  • ListViewのScrollアニメーションはどのItemを表示するかという指定はできない。
    コンテンツの上端からの座標(pixel)を指定のみ。
  • ScrollEndNotificationはアニメーションの完了だけでなくjumpToでもonNotificationが呼ばれる。
  • Widgetのサイズ変更は、SchedulerBinding.instance.addPostFrameCallbackのコールバック内で検知できる。
  • Widgetのメンバ変数の変化は、didUpdateWidgetでチェックできる。
  • build処理中は、setStateを呼ぶと例外が発生する。ScrollControllerのスクロール処理も同じ。
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1