如何使 ROW 左右滚动?
How to make a ROW scrollable left and right?
是否可以使 Row 小部件的子项仅显示 X 个子项并使小部件可滚动?
Here's an example screenshot
有什么建议吗?
您可以将您的 listview
放入具有特定 height
的 SizedBox
小部件中,然后您应该配置您的列表以使其以水平方式滚动:
SizedBox(
width: MediaQuery.of(context).size.width // This will make your list fill the screen horizontally
height: 100.0 // you can edit it as you desire but it should be small to make the effect of scroll-able row
child: listview.builder(
scrollDirection: Axis.horizontal, //This will make your list scroll on the horizontal axis
itemCount: 10.0,
itemBuilder: (BuildContext content, int index) {
// Your itemBuilder code here
}
),
),
是否可以使 Row 小部件的子项仅显示 X 个子项并使小部件可滚动?
Here's an example screenshot
有什么建议吗?
您可以将您的 listview
放入具有特定 height
的 SizedBox
小部件中,然后您应该配置您的列表以使其以水平方式滚动:
SizedBox(
width: MediaQuery.of(context).size.width // This will make your list fill the screen horizontally
height: 100.0 // you can edit it as you desire but it should be small to make the effect of scroll-able row
child: listview.builder(
scrollDirection: Axis.horizontal, //This will make your list scroll on the horizontal axis
itemCount: 10.0,
itemBuilder: (BuildContext content, int index) {
// Your itemBuilder code here
}
),
),