简体   繁体   English

如何在 Flutter Listview 中逐个滚动,逐个图像,而不显示两个半图像?

[英]How to scroll in Flutter Listview child by child, so image by image, without having two half images shown?

I wanna make a Listview where every items has the 'width' of the screen size, scrolling horizontally between them.我想制作一个 Listview,其中每个项目都有屏幕尺寸的“宽度”,在它们之间水平滚动。

child: ListView(
        scrollDirection: Axis.horizontal,
        children: [
          Container(
            child: Image.asset("assets/images/tests/asset0.PNG"),
            width: MediaQuery.of(context).size.width,
          ),
          Container(
            child: Image.asset("assets/images/tests/asset1.PNG"),
            width: MediaQuery.of(context).size.width,
          ),
        ],
      ),

But (like if you swipe between many pictures horizontally on instagram) i want the children to be full on page (not half half or something if you start scrolling between them).但是(例如,如果您在 Instagram 上水平滑动许多图片)我希望孩子们在页面上占满(如果您开始在它们之间滚动,则不是一半或其他东西)。

Any ideas?有任何想法吗?

Use PageView.builder instead ListView使用 PageView.builder 代替 ListView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 子ListView在颤动中完成滚动后如何继续滚动bottomModelSheet? - How to continious scroll bottomModelSheet after child ListView completes the scroll in flutter? Flutter 如何添加子背景图片 - Flutter How to add child background image 可见性小部件颤动中的子图像 - child image in visiblity widget flutter 如何将带有子图像小部件的小部件转换为 Flutter 中的图像文件? - How to convert a widget with child Image widgets into an image file in Flutter? 如何在 flutter 中检测 Listview 构建器/屏幕的半滚动? - How to detect half scroll of Listview builder / screen in flutter? 当我滚动子 ListView Flutter 时,InviewNotifierList(父级)正在重建 - InviewNotifierList (Parent) is getting rebuild when I scroll Child ListView Flutter 如何使这些图像在颤动中半正常半透明? - How can I make these image half normal and half transparent in flutter? 如何像这张图片一样让孩子以自定义油漆为中心? - How to centre child on custom paint in flutter like this image? Flutter)我想知道如何将相同的滚动应用于 ListView 中的子小部件列表 - Flutter) I want to know how to apply the same scroll to the child widget list within ListView 如何为 ListView 生成器子 flutter 设置动画? - how to animate ListView builder child flutter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM