一次在轮播中显示两张图片

时间:2020-08-26 04:33:48

标签: flutter carousel indicator

carousel with indicator, and two pictures at a time

如何在颤动的画面上进行类似的处理? 我搜索了flous carousel_slider 2.2.1库, 但它没有一次显示两张图片的功能。

    Widget _buildReport() {
  return CarouselSlider(
    options: CarouselOptions(
      height: 150.0,
      autoPlay: true,
      autoPlayInterval: Duration(seconds: 4),
      autoPlayAnimationDuration: Duration(milliseconds: 800),
      autoPlayCurve: Curves.fastOutSlowIn,
    ),
    items: [1, 2, 3, 4, 5].map((i) {
      return Builder(
        builder: (BuildContext context) {
          return Container(
              width: MediaQuery.of(context).size.width,
              margin: EdgeInsets.symmetric(horizontal: 5.0),
              child: Image(
                image: AssetImage('assets/dog.jpg'),
                fit: BoxFit.cover,
              ));
        },
      );
    }).toList(),
  );
}

1 个答案:

答案 0 :(得分:0)

您可以使用带有Row的{​​{1}}小部件来进行轮播,并像这样用MainAxisAlignment.spaceBetween包装每个图像:

Expanded

正在运行的应用程序:

enter image description here