【发布时间】:2020-08-17 08:26:33
【问题描述】:
你知道如何让所有移动页面都可以滚动吗?因为如果我们显示一些小部件,如果它超过移动屏幕的高度就会产生错误
【问题讨论】:
-
您可以使用 ListView 或 SingleChildScrollView 包装您的小部件。 Click here for more info
标签: flutter
你知道如何让所有移动页面都可以滚动吗?因为如果我们显示一些小部件,如果它超过移动屏幕的高度就会产生错误
【问题讨论】:
标签: flutter
这会很完美。看看吧。
ListView(
children: <Widget>[
// first widget here
Container(
height: 200,
width: MediaQuery.of(context).size.width,
color: Colors.blue,
),
// third widget here
Container(
height: 200,
width: MediaQuery.of(context).size.width,
color: Colors.black,
),
// second widget here
Container(
height: 200,
width: MediaQuery.of(context).size.width,
color: Colors.red,
),
],
),
【讨论】:
您可以使用ListView
Widget view(){
return ListView(
children: <Widget[
Text("your widgets here"),
SizedBox(height: 20), // you can use these for spacing
]
)
}
或SingleChildScrollView
Widget view(){
return SingleChildScrollView(
children: <Widget[
Text("your widgets here"),
SizedBox(height: 20), // you can use these for spacing
]
)
}
【讨论】: