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

问题描述

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...