scroll method

dynamic scroll(
  1. InfiniteScrollController sc,
  2. List<double> offsets,
  3. double totalL, {
  4. bool next = true,
})

Implementation

scroll(InfiniteScrollController sc,List<double> offsets,double totalL,{bool next=true}){
  if(totalL==0)return;
  double o=0;
  double? m;
  int i=offsets.indexWhere((e){
    m=(sc.offset%totalL)-(o+=e);
    return m!<-28;
  });
  if(i==-1){
    m=(sc.offset%totalL)-(o+=offsets[0]);
  }
  if(!next)m=m!+offsets[i%offsets.length]+offsets[(i-1)%offsets.length];
  sc.animateTo((sc.offset-m!)-27, duration: const Duration(milliseconds: 200), curve: Curves.ease);
}