在此输入图像描述请我需要删除容器小部件并为文本小部件添加边框半径,或者是否可以使文本小部件和容器小部件一起响应更改(意思是:当文本为空时,容器不应显示(
child: Container(
padding: EdgeInsets.fromLTRB(25.0, 0, 10.0, 0),
decoration: ShapeDecoration(
color: Colors.grey[850],
shape: RoundedRectangleBorder(
side: BorderSide(
width: 2.0,
style: BorderStyle.solid,
color: Colors.black,
),
borderRadius:
BorderRadius.all(Radius.circular(15.0)),
),
),
child: Text(
costOfSales,
style: TextStyle(
`enter code here` color: Colors.white,
fontSize: 25.0,
),
)),
Widget build(BuildContext context) {
var costOfSales = "$99";
return costOfSales == null
? Container()
: Container(
padding: EdgeInsets.fromLTRB(25.0, 0, 10.0, 0),
decoration: ShapeDecoration(
color: Colors.grey[850],
shape: RoundedRectangleBorder(
side: BorderSide(
width: 2.0,
style: BorderStyle.solid,
color: Colors.black,
),
borderRadius: BorderRadius.all(Radius.circular(15.0)),
),
),
child: Text(
costOfSales,
style: TextStyle(
color: Colors.white,
fontSize: 25.0,
),
),
);
}