flutter_swiper icon indicating copy to clipboard operation
flutter_swiper copied to clipboard

Viewport not working with custom layout

Open Davete0302 opened this issue 4 years ago • 0 comments

I wanted to show 3 items in swipper so I adjusted na viewportFraction/itemWidth to .6 but does not seem to work. Just wanted to show 3 items like the default swipper while retaining the swipe animation.

new Swiper(
  layout: SwiperLayout.CUSTOM,
  customLayoutOption: new CustomLayoutOption(
      startIndex: -1,
      stateCount: 3
  ).addRotate([
    -45.0/180,
    0.0,
    45.0/180
  ]).addTranslate([
    new Offset(-370.0, -40.0),
    new Offset(0.0, 0.0),
    new Offset(370.0, -40.0)
  ]),
  itemWidth: 300.0,
  itemHeight: 200.0,
  itemBuilder: (context, index) {
    return new Container(
      color: Colors.grey,
      child: new Center(
        child: new Text("$index"),
      ),
    );
  },
  viewportFraction: 0.6,
  itemCount: 10)

Davete0302 avatar Sep 15 '21 04:09 Davete0302