[英]How to make a single vertical scrollable list where each item is a horizontal scrollable list?
I am trying to create a single vertical scrollable list where each item is a horizontal scrollable list.我正在尝试创建一个垂直可滚动列表,其中每个项目都是一个水平可滚动列表。
How can I do something like this without external packages?如果没有外部包,我怎么能做这样的事情呢?
You could create your horizontal list by putting a listview (or its variant like listview.builder or listview.separated) in a sized box with a fixed height and setting the scroll direction as Axis.horizontal.您可以通过将列表视图(或其变体,如 listview.builder 或 listview.separated)放在具有固定高度的大小框中并将滚动方向设置为 Axis.horizontal 来创建水平列表。
You could have multiple horizontal lists like above in a column and wrap your column with a single child scroll view.你可以在一列中有多个像上面这样的水平列表,并用一个子滚动视图包裹你的列。
body: SingleChildScrollView(child: Column(children: [
SizedBox(
height: 100,
child: ListView(scrollDirection: Axis.horizontal, children: [
MyWidget1(),
MyWidget2(),
MyWidget3(),
])),
SizedBox(
height: 100,
child: ListView(scrollDirection: Axis.horizontal, children: [
MyWidget1(),
MyWidget2(),
MyWidget3(),
])),
SizedBox(
height: 100,
child: ListView(scrollDirection: Axis.horizontal, children: [
MyWidget1(),
MyWidget2(),
MyWidget3(),
])),
])),
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.