我正在使用GridView和卡片构建布局。我想在每张卡片的底部加上一种颜色。我找到了这个问题,并尝试对Fill an area with color in Flutter做同样的把戏,但每次SizedBox都会溢出圆角。你知道怎么解决这个问题吗?
下面的示例代码显示了这个问题。我试着给卡片的底部上色,当我这样做的时候,卡片的角就丢失了,就像从容器中溢出一样。


Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightBlue,
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Card(
margin: EdgeInsets.all(20),
elevation: 10,
child: SizedBox(
height: 100,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text("line1"),
Text(
"line2",
),
Expanded(
child: Container(
/*color: Colors.orange,*/ child: Text("Bottom"),
)),
],
),
),
),
Expanded(
child: Container(),
)
],
),
);}
发布于 2019-01-24 00:10:52
尝试在Container中使用BoxDecoration,并使用与Card相同的半径(4.0)
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(4.0),
bottomRight: Radius.circular(4.0))),
child: Text("Bottom"),
),
),https://stackoverflow.com/questions/54329139
复制相似问题