[英]Make a flutter Page scrollable
嘿,我目前正在尝试使页面在颤振/飞镖中可滚动。 我遇到的问题是该结构与我在网上可以找到的任何东西都不同。 目前看起来是这样的:
@override
Widget build(BuildContext context) {
return new Scaffold(
resizeToAvoidBottomPadding: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(...),
SizedBox(height: 10.0),
Row(...),
Container(...),
],
),
);
}
我想让 Row(...) 和第二个 Container(...) 现在可以滚动。 我想不通。 希望你能帮助我! 提前致谢
将您的Row
和Container
在Column
中,然后将该Column
包装在SingleChildScrollView
中;
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(),
SizedBox(height: 10.0),
SingleChildScrollView(
child: Column(
children: <Widget>[
Row(...),
Container(...),
],
),
)
],
),
);
}
ps 从 Dart 2.0 开始,您不再需要在Scaffold
前面new
关键字。
试试 Flutter 列表视图。 就像是
ListView(
padding: const EdgeInsets.all(8),
children: <Widget>[
Container(
height: 50,
color: Colors.amber[600],
child: const Center(child: Text('Entry A')),
),
Container(
height: 50,
color: Colors.amber[500],
child: const Center(child: Text('Entry B')),
),
Container(
height: 50,
color: Colors.amber[100],
child: const Center(child: Text('Entry C')),
),
],
)
有关详细信息,请查看以下链接ListView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.