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

问题描述

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(),);
}

解决方法

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

Expanded

正在运行的应用程序:

enter image description here