Closed kavodsky closed 3 years ago
After itemScrollController.scrollTo is called list scroll is blocked, only items which fit screen are visible.
return FutureBuilder( // future: CloudFirestoreDatabaseService.getDictionaryWords(dictionariId), future: FloorDatabaseService.getDictionaryWordVies(dictionaryId), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.none && !snapshot.hasData || snapshot.connectionState == ConnectionState.waiting) { return Center(child: CircularProgressIndicator()); } words = snapshot.data as List<DictionaryWordView>; final ItemScrollController itemScrollController = ItemScrollController(); final ItemPositionsListener itemPositionsListener = ItemPositionsListener.create(); itemPositionsListener.itemPositions.addListener(() => { itemScrollController.scrollTo( index: 15, duration: Duration(milliseconds: 50), curve: Curves.easeInOutCubic) }); return words.length == 0 ? Center( child: Text( 'No words found. Please synchronize with remote dictionary.', textAlign: TextAlign.center, )) : ScrollablePositionedList.builder( itemCount: words.length, itemBuilder: (context, index) { DictionaryWordView wordView = words[index]; return WordCard( wordView: wordView, callback: callback, ); }, itemScrollController: itemScrollController, itemPositionsListener: itemPositionsListener, scrollDirection: Axis.vertical, ); });
guess you are using another package. please fire the issue at https://github.com/google/flutter.widgets/tree/master/packages/scrollable_positioned_list
After itemScrollController.scrollTo is called list scroll is blocked, only items which fit screen are visible.