Flutter Carousel,将副物品放在中心卡后面
我想知道如何将轮播项目放在中心项目后面,然后当它滑动时,项目之间不会有空格,但它会留在
这是我的代码:
CarouselSlider(
options: CarouselOptions(
height: Sizes.width,
enableInfiniteScroll: true,
aspectRatio: 2.0,
enlargeCenterPage: true,
viewportFraction: 0.8,
onPageChanged: (index, reason) =>
setState(() => currentCard = index),
),
items: hardcore.map((i) {
return Builder(builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.asset(i, fit: BoxFit.cover)));
});
}).toList()),
I want to know how to put the carousel items behind the center item, then when it slides there will be no spaces between items but it will stay behind
And I want somethig like this:
This is my code:
CarouselSlider(
options: CarouselOptions(
height: Sizes.width,
enableInfiniteScroll: true,
aspectRatio: 2.0,
enlargeCenterPage: true,
viewportFraction: 0.8,
onPageChanged: (index, reason) =>
setState(() => currentCard = index),
),
items: hardcore.map((i) {
return Builder(builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.asset(i, fit: BoxFit.cover)));
});
}).toList()),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论