颤振如何显示3滑块

时间:2020-11-11 14:39:22

标签: flutter

Flutter我需要显示这样的滑块图像

enter image description here

我使用Carouselslide,但无法达到我展示的效果

我的代码是

Container(
              width: double.infinity,
              child: CarouselSlider(
                options: CarouselOptions(
                  disableCenter: true,
                  enableInfiniteScroll: false,
                  viewportFraction: 0.7,
                  enlargeCenterPage: false,
                  height: Height * 0.21,
                ),
                items: list
                    .map((item) => Container(
                  child: Image.asset(item),
                ))
                    .toList(),
              )),

它像这样显示

enter image description here

我需要显示为上图所示。还是轮播滑块无法实现?

1 个答案:

答案 0 :(得分:0)

尝试此代码

   Padding(
      padding: EdgeInsets.only(left: 0, right: 0, top: 0),
      child: Container(
          child: CarouselSlider(
            options: CarouselOptions(
               height: Height * 0.21,
              autoPlay: true,
              viewportFraction: 1.0,
              disableCenter: true,
              enableInfiniteScroll: false,
                
            ),
            items: list
                .map((item) => Container(
              child: Image.network(item, fit: BoxFit.cover, width: 400),
            ))
                .toList(),
          )),
    )