【发布时间】:2022-01-04 17:41:10
【问题描述】:
这是我的代码.. 我收到错误消息说“BoxConstraints 强制无限高”。然后是一个描述,我是新来的,我没有办法解决这个问题。
body:SingleChildScrollView(
child: Stack(
fit: StackFit.expand,
children: [
Image(
color: Colors.black12,
colorBlendMode: BlendMode.darken,
image: AssetImage('images/Alone.jpg'),
fit: BoxFit.cover,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Show('Alone is Stronger', 'y'),
],
)
],
),
),
这是我的 Show 小部件。
Widget Show(String x,String y){
return
Container(
margin: EdgeInsets.fromLTRB(10, 5, 10, 2),
width: 400,
decoration: BoxDecoration(
color: Colors.white10,
borderRadius: BorderRadius.circular(10),
),
padding: EdgeInsets.all(10),
child: Text(
'$x',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.yellowAccent,
),
),
);
}
很多问题已经在这里,但我没有找到问题所在。 提前致谢
【问题讨论】:
-
您是否要在正文上添加背景图片?
-
@yeasinSheikh,是的,我希望将背景图像固定在正文上,并且文本部分可滚动。