0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ScrollablePositionedListを使ってみた

Posted at

はじめに

Flutterには、任意の位置までスクロール可能なListViewがありません。
他の言語のListViewだとscrollToで任意の位置までスクロール出来るから、同じようにやりたいと思って探してみると、このscrollable_positioned_listというパッケージを見つけました。
備忘録程度に書き残しておこうと思います。

使い方

scrollTo

いくつか機能のあるパッケージですが、まずはscrollTo、これが一番やりたかった。
indexで指定したリスト位置までスクロールできる。
ピクセル等の指定ではないので、任意のアイテムを表示したいときに使いやすい。

itemScrollController.scrollTo(
  index: 150,
  duration: Duration(seconds: 2),
  curve: Curves.easeInOutCubic);

jumpTo

スクロールではなく、特定の位置までジャンプさせることも可能。
こちらも、ピクセル等ではなく、indexで指定したリスト位置までジャンプする。

itemScrollController.jumpTo(index: 150);
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?