i am using swiping screen which you can swipe right and left, so if a single user have like 5 picture for me to display one after the other after i click. i am using pageView.Builder with streamBuilder but if the streamBuilder fetch the list of the picture and for me to move to the next image in the pageView, i keep getting
The following assertion was thrown while handling a gesture: ScrollController attached to multiple scroll views. 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 109 pos 12: '_positions.length == 1'
here is my code:
Expanded(
child: Container(
height: MediaQuery.of(context).size.height * 10,
child: TinderSwapCard(
swipeUp: true,
swipeDown: true,
orientation: AmassOrientation.BOTTOM,
totalNum: userData.length,
stackNum: 3,
swipeEdge: 6.0,
maxWidth:
MediaQuery.of(context).size.width * 0.9,
maxHeight:
MediaQuery.of(context).size.height * 0.9,
minWidth:
MediaQuery.of(context).size.width * 0.8,
minHeight:
MediaQuery.of(context).size.width * 0.8,
allowVerticalMovement: true,
cardBuilder: (context, index) => Container(
child: Stack(
fit: StackFit.passthrough,
alignment: Alignment.center,
children: [
StreamBuilder(
stream: firestore
.collection('Image')
.doc(userData[index].id)
.collection('Photos')
.orderBy('timestap')
.snapshots(),
builder: (context, snapsoht) {
if (!snapsoht.hasData) {
return Center(
child:
CircularProgressIndicator(),
);
}
return PageView.builder(
pageSnapping: true,
physics:
NeverScrollableScrollPhysics(),
controller: _pageController,
itemCount:
snapsoht.data.docs.length,
itemBuilder: (ctx, index) {
return GestureDetector(
onTap: () {
_pageController.jumpToPage(
1); // for regular jump
},
child: Container(
child: Card(
semanticContainer: true,
clipBehavior: Clip
.antiAliasWithSaveLayer,
child: Image(
image: NetworkImage(
snapsoht.data
.docs[index]
.data()[
'picture'],
),
fit: BoxFit.fill,
),
),
),
);
});
},
),
if (direction.value <= -1)
Padding(
padding: const EdgeInsets.all(15.0),
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.all(8.0),
child: Container(
height: 100,
width: 100,
child: Image.asset(
'assets/Nope.png')),
),
),
),
if (direction.value >= 1)
Padding(
padding: const EdgeInsets.all(15.0),
child: Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.all(8.0),
child: Container(
height: 100,
width: 100,
child: Image.asset(
'assets/Like.png')),
),
),
),