Closed yyong37 closed 2 years ago
@rizzi37 I can't reproduce the issue that you mentioned. Please copy/paste the whole FlutterListView element to me to verify it.
@robert-bitguild thanks for your fast reply, I have updated my origin issue with the same code.
@rizzi37 我认为这个是正常行为,我对比了ListView的官方源码(ListView也有这个问题),这是因为你在下拉过程中,Timer.periodic(Duration(seconds: 1), (timer) 里创建了新的项而导致滚动后退了。现实情况下,这种情况一般不会考虑,即下拉过程中有UI刷新。
另外,keepPosition: true时最好实现 onItemKey: (index) ,否测keepPosition不会成效。因为我不知道你insert的行在那里。onItemKey要返加该行的唯一值。
return Scaffold(
body: FlutterListView(
reverse: true,
delegate: FlutterListViewDelegate(
(BuildContext context, int index) =>
ListTile(title: Text('List Item ${data[index]}')),
childCount: data.length,
keepPosition: true,
onItemKey: (index) {
return data[index];
},
)));
收到.再次表示感谢.
预期: 下拉回弹会定位到顶部第一个元素. 但是现在会回弹至第2,3个元素才停止
expect: bouncing and stop edge first item