我需要制作一个带有圆形边框,颜色和轮廓的容器,但是背景颜色溢出了轮廓颜色。
我怎样才能解决这个问题?
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 21,
constraints: BoxConstraints(
minWidth: 21,
),
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 2),
borderRadius: BorderRadius.circular(21),
color: Colors.pink,
),
child: Align(
child: Text(
"1",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12),
)));
}
}
结果:(最左侧可见)
好像是个虫子?我认为您可以将问题报告给github。
如果仅需要解决方法,则可以尝试将背景色(粉红色)移至小部件的较低级别。
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 21,
constraints: BoxConstraints(
minWidth: 21,
),
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 2),
borderRadius: BorderRadius.circular(21),
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: Colors.pink,
),
child: Align(
child: Text(
"1",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12,
),
),
),
),
);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句