PrimaryScrollController 当前附加到多个 ScrollPosition
The PrimaryScrollController is currently attached to more than one ScrollPosition
我有一个使用 lazyscrollview 的 flutter 设计 https://pub.dev/packages/lazy_load_scrollview ,在另一个页面上,这个滚动工作正常,但在这个设计中,滚动时,它得到一个错误
"The PrimaryScrollController is currently attached to more than one
ScrollPosition."
这是我的代码
LazyLoadScrollView(
onEndOfPage: () {},
child: Scrollbar(
child: ListView(
children: [
ListView.builder(
shrinkWrap: true,
itemCount: 10,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (_, i) {
return InkWell(
onTap: () {},
child: Container(
height: 200,
child: Text("kamu " + i.toString())));
}),
],
)))
使用这种方式,请改变结构,这是最好的做法
Scaffold(
body: LazyLoadScrollView(
scrollOffset: 150,
onEndOfPage: () {
print('ppppppppppppppppppppppppppppppppppppppppp');
},
child: Scrollbar(
child: SingleChildScrollView(
child: ListView.builder(
shrinkWrap: true,
itemCount: 10,
physics: ClampingScrollPhysics(),
itemBuilder: (_, i) {
return InkWell(
onTap: () {},
child: Container(
height: 200,
child: Text("kamu " + i.toString())));
}),
)))),
并根据需要调整 scrollOffset,
调试将是
我有一个使用 lazyscrollview 的 flutter 设计 https://pub.dev/packages/lazy_load_scrollview ,在另一个页面上,这个滚动工作正常,但在这个设计中,滚动时,它得到一个错误
"The PrimaryScrollController is currently attached to more than one ScrollPosition."
这是我的代码
LazyLoadScrollView(
onEndOfPage: () {},
child: Scrollbar(
child: ListView(
children: [
ListView.builder(
shrinkWrap: true,
itemCount: 10,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (_, i) {
return InkWell(
onTap: () {},
child: Container(
height: 200,
child: Text("kamu " + i.toString())));
}),
],
)))
使用这种方式,请改变结构,这是最好的做法
Scaffold(
body: LazyLoadScrollView(
scrollOffset: 150,
onEndOfPage: () {
print('ppppppppppppppppppppppppppppppppppppppppp');
},
child: Scrollbar(
child: SingleChildScrollView(
child: ListView.builder(
shrinkWrap: true,
itemCount: 10,
physics: ClampingScrollPhysics(),
itemBuilder: (_, i) {
return InkWell(
onTap: () {},
child: Container(
height: 200,
child: Text("kamu " + i.toString())));
}),
)))),
并根据需要调整 scrollOffset,
调试将是