Closed vanlooverenkoen closed 3 years ago
that's the limitation for this package. if your list is not the variable height, you can give both the suggestedRowHeight
to AutoScrollController
and the itemExtent
into your official list widget to speed it up. related flutter issue: https://github.com/flutter/flutter/issues/52207.
final controller = AutoScrollController(
//add this for advanced viewport boundary. e.g. SafeArea
viewportBoundaryGetter: () => Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
//choose vertical/horizontal
axis: scrollDirection,
//this given value will bring the scroll offset to the nearest position in fixed row height case.
//for variable row height case, you can still set the average height, it will try to get to the relatively closer offset
//and then start searching.
suggestedRowHeight: 200
);
because we need to search for the state which is created while visible, each row state will be layout during scrolling. that's why the scrolling is not very fast.
if your row height is variable or you still feel sad by adopting above example, you can try to use this package https://pub.dev/packages/scrollable_positioned_list, it has the mechanism to solve this issue. But the widget inside this package is not as powerful as built-in Sliverlist
, so you should make sure it has all features you needed and then do the migration.
I switched to scrolled_positioned_list
I have a list with 36 000 records. When I am at the top of the list and I want to scroll to index 30 000 It takes a lot of time to complete. Setting the duration to Duration(microseconds:1) does not fix this.