[英]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.