clickIndexBar method
点击索引,列表滑动
Implementation
void clickIndexBar(int index) {
if (index == 0) {
_scrollController.jumpTo(0);
return;
}
double position = 0;
int length = 0;
// 计算位置
for (int i = 0; i < _mList.length; i++) {
if (_mList[index].letter == _mList[i].letter) {
position = i * widget.itemHeadHeight! + length * widget.itemHeight!;
}
length += _mList[i].data!.length;
}
_scrollController.jumpTo(position);
}