由于Row 和 Column 是 Flex 组件,是无法滚动的,如果没有足够的空间,flutter就提示溢出错误。
return Column(
children:[
Container(
width: 1133,
alignment: Alignment.topCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text('',style: TextStyle(color: Colors.white,fontSize: 20,fontWeight: FontWeight.bold)),
width: 560,
height: 446,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0,1.0],
colors: [Color.fromRGBO(29,110,255,1), Color.fromRGBO(75,177,255,1)]
)
),
),
Container(
child: Text('',style: TextStyle(fontSize: 20,fontWeight: FontWeight.bold)),
width: 560,
height: 446,
decoration: BoxDecoration(
color: Colors.white,
),
),
],
),
)]
)
这时只要用Expanded组件将外层Container包起来就不会出现黄条了 但是治标不治本,不能滚动会隐藏一部分,如果需要滚动的话可以使用SingleChildScrollView组件 在SingleChildScrollView外面包一层Container并指定宽高为无限大就可以完美解决这一问题了
return Container(
height: double.infinity,
width: double.infinity,
child:SingleChildScrollView(
child:Column(...)
)
);
|