颤动给容器圆形边框 [英] Flutter give container rounded border

查看:35
本文介绍了颤动给容器圆形边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个 Container(),我给了它一个边框,但如果有圆形边框会更好.

I'm making a Container(), I gave it a border, but it would be nice to have rounded borders.

这就是我现在所拥有的:

This is what I have now:

Container(
      width: screenWidth / 7,
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.red[500],
        ),
      ),
      child: Padding(
        padding: EdgeInsets.all(5.0),
        child: Column(
          children: <Widget>[
            Text(
              '6',
              style: TextStyle(
                  color: Colors.red[500],
                  fontSize: 25),
            ),
            Text(
             'sep',
              style: TextStyle(
                  color: Colors.red[500]),
            )
          ],
        ),
      ),
    );

我尝试将 ClipRRect 放在它上面,但它把边框剪掉了.有解决办法吗?

I tried putting ClipRRect on it, but that crops the border away. Is there a solution for this?

推荐答案

尝试使用 BoxDecoration

类似的东西

Container(
  decoration: BoxDecoration(
    border: Border.all(
      color: Colors.red[500],
    ),
    borderRadius: BorderRadius.all(Radius.circular(20))
  ),
  child: ...
)

这篇关于颤动给容器圆形边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆