flutter_swiper
flutter_swiper copied to clipboard
Splitting itemCount with items per page
With the sample code, itemCount = 2, how do we put children 0,1,2,3,4 into slider 1 page and 5,6,7,8,9 on to slider 2 page? i.e how to split it evenly with the children[].map approach.
new ConstrainedBox(
child: new Swiper(
outer:false,
itemBuilder: (c, i) {
return new Wrap(
runSpacing: 6.0,
children: [0,1,2,3,4,5,6,7,8,9].map((i){
return new SizedBox(
width: MediaQuery.of(context).size.width/5,
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new SizedBox(
child: new Container(
child: new Image.network("https://fuss10.elemecdn.com/c/db/d20d49e5029281b9b73db1c5ec6f9jpeg.jpeg%3FimageMogr/format/webp/thumbnail/!90x90r/gravity/Center/crop/90x90"),
),
height: MediaQuery.of(context).size.width * 0.12,
width: MediaQuery.of(context).size.width * 0.12,
),
new Padding(padding: new EdgeInsets.only(top:6.0),child: new Text("$i"),)
],
),
);
}).toList(),
);
},
pagination: new SwiperPagination(
margin: new EdgeInsets.all(5.0)
),
itemCount: 2,
),
constraints:new BoxConstraints.loose(new Size(screenWidth, 170.0))
),
same issue on my project
With the sample code, itemCount = 2, how do we put children 0,1,2,3,4 into slider 1 page and 5,6,7,8,9 on to slider 2 page? i.e how to split it evenly with the children[].map approach.
new ConstrainedBox( child: new Swiper( outer:false, itemBuilder: (c, i) { return new Wrap( runSpacing: 6.0, children: [0,1,2,3,4,5,6,7,8,9].map((i){ return new SizedBox( width: MediaQuery.of(context).size.width/5, child: new Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ new SizedBox( child: new Container( child: new Image.network("https://fuss10.elemecdn.com/c/db/d20d49e5029281b9b73db1c5ec6f9jpeg.jpeg%3FimageMogr/format/webp/thumbnail/!90x90r/gravity/Center/crop/90x90"), ), height: MediaQuery.of(context).size.width * 0.12, width: MediaQuery.of(context).size.width * 0.12, ), new Padding(padding: new EdgeInsets.only(top:6.0),child: new Text("$i"),) ], ), ); }).toList(), ); }, pagination: new SwiperPagination( margin: new EdgeInsets.all(5.0) ), itemCount: 2, ), constraints:new BoxConstraints.loose(new Size(screenWidth, 170.0)) ),