The PrimaryScrollController is currently attached to more than one ScrollPosition
1,322
use this way , please change the structure ,it is the best practice
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())));
}),
)))),
and adjust the scrollOffset if you want ,
the debug will be
Author by
Rohmatul Laily
Updated on January 04, 2023Comments
-
Rohmatul Laily over 1 year
I have a flutter design using lazyscrollview https://pub.dev/packages/lazy_load_scrollview , on another page, this scroll works fine, but in this design, when scrolling, it gets an error
"The PrimaryScrollController is currently attached to more than one ScrollPosition."
this is my code
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()))); }), ], )))
-
Jinto Joseph about 2 yearswhat is the parent of LazyLoadScrollView, is it Scaffold
-
Rohmatul Laily about 2 yearsi put LazyLoadScrollView at body scaffold
-
Jinto Joseph about 2 yearsok ,why are you using Scrollbar , ListView . you can use ListView.builder as a child of LazyLoadScrollView
-
-
Rohmatul Laily about 2 yearswithout the scrollbar, scroll indicator is not showing
-
Jinto Joseph about 2 yearsi am edited the Answer with scrollbar
-
Jinto Joseph about 2 yearsyou can remove SingleChildScrollView if you want , its up to your use case