1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| void _scrollTopIndex(String tag) { int index = _getIndex(tag); int itemsCountOnScreen = itemPositionsListener.itemPositions.value.length; if (index != -1) {
/ange the data of alignment and make it show properly. if ((widget.data.length - index) < itemsCountOnScreen) {
double alignment = (itemsCountOnScreen - (widget.data.length - index)) / itemsCountOnScreen; itemScrollController.jumpTo(alignment: alignment, index: index); } else { itemScrollController.jumpTo(index: index); } } }
|