颤振:容器颜色溢出边框

用户名

我需要制作一个带有圆形边框,颜色和轮廓的容器,但是背景颜色溢出了轮廓颜色。

我怎样才能解决这个问题?

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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章