小编Tar*_*ruz的帖子

如何在材质小部件上插入边框

我是颤振的初学者,我无法在材质小部件上插入圆形边框。我已经插入了适当的内容borderRadius: new BorderRadius.circular(6.0),,但我看不出我做错了:

我的代码:

Widget _buildCategoryItem(index) {
return new GestureDetector(
  onTap: () {
    onTabCategory(index);
  },
  child: new Center(
    child: new Container(
      margin: new EdgeInsets.only(left: 10.0),
      child: new Material(
        elevation: 2.0,
        borderRadius: new BorderRadius.circular(6.0),
        child: new Container(
          padding: new EdgeInsets.only(
              left: 12.0, top: 7.0, bottom: 7.0, right: 12.0),
          color: _category_selected == index
              ? Colors.orange[800]
              : Colors.orange[500],
          child: new Text(
            _categorys[index],
            style: new TextStyle(color: Colors.white),
          ),
        ),
      ),
    ),
  ),
);
Run Code Online (Sandbox Code Playgroud)

}

类别标签的格式为方形,但我想将其边框设置为圆形:

在此输入图像描述

flutter flutter-layout flutter-animation

1
推荐指数
1
解决办法
3715
查看次数