Home > Enterprise >  flutter swiper when only have 1 item
flutter swiper when only have 1 item

Time:10-19

enter image description here

using flutter swipper package, how to remove side image (my marked red) if have 1 item only?

I already try change to viewportFraction: 1 but it's change width to full width, I wan't change size width, only hide side image

this part of my code

                             Swiper(
                                autoplay: true,
                                itemBuilder: (BuildContext context,
                                    int index) {
                                  return InkWell(
                                    child: Card(
                                        margin: new EdgeInsets.only(
                                            bottom: 30
                                        ),
                                        shape: RoundedRectangleBorder(
                                            borderRadius: BorderRadius
                                                .circular(20)
                                        ),
                                        child: (
                                            ClipRRect(
                                                child: (
                                                    CachedNetworkImage(
                                                      imageUrl: dataPromo[index].bannerPath,
                                                        fit: BoxFit.fill,
                                                    )
                                                )
                                            )
                                        )
                                    ),
                                  );
                                },
                                itemCount: dataPromo.length,
                                viewportFraction: 0.8,
                                scale: 0.9,
                              ),

CodePudding user response:

Have you tried change the viewportFraction to viewportFraction: 1.0?

  • Related