【发布时间】:2019-05-31 09:52:26
【问题描述】:
我正在学习颤振开发,并希望制作一个屏幕,其中应将容器放置在屏幕底部,并且剩余屏幕的内容应该是可滚动的。
这是Scaffold小部件的主体
body:Stack(
children: <Widget>[
Container(
margin: const EdgeInsets.fromLTRB(0.0, 10.0 , 0.0 , 0.0 ),
height: double.infinity,
child:SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 0.9,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
Container(
height: 100,
child: Text(description),
),
],
),
),
)
) ,
Positioned(
left: 0,
right: 0,
bottom:0,
child: new Container(
transform: Matrix4.translationValues(0.0, 0.0, -20.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new Column(
children: <Widget>[
InkWell(
child: Image.asset('assets/bt1.png'),
onTap: (){
Navigator.pushNamed(context, '/help');
},
),
Text("FIND HELP",
style: TextStyle(fontSize: 14.0,color: Colors.white),
),
],
),
new Column(
children: <Widget>[
InkWell(
child: Image.asset('assets/bt2.png'),
onTap: (){
// Navigator.push(context, new MaterialPageRoute(
// builder: (BuildContext context) => new Home(title: 'Bright Sky'),
// ));
},
),
Text("HOME",
style: TextStyle(fontSize: 14.0,color: Colors.white),
),
],
),
new Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new InkWell(
child: Image.asset('assets/bt3.png'),
onTap: () {
//UrlLauncher.launch("tel://911");
},
),
Text("CALL 999",
style: TextStyle(fontSize: 14.0,color: Colors.white),
),
],
),
],
),
// color: Colors.blue,
),
)
],
)
我将 Container 与 Text 放在一起只是为了测试目的。 但是上面的代码给了我错误。
A RenderFlex overflowed by 388 pixels on the bottom.
The overflowing RenderFlex has an orientation of Axis.vertical.
我在这里做错了什么? 提前致谢。
【问题讨论】: