Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何在颤振中创建带边框的圆形容器?_Flutter_Dart_Containers_Border - Fatal编程技术网

Flutter 如何在颤振中创建带边框的圆形容器?

Flutter 如何在颤振中创建带边框的圆形容器?,flutter,dart,containers,border,Flutter,Dart,Containers,Border,正如您所注意到的,装饰的背景色稍微溢出了圆形边框。我尝试过不同的方法(例如使用ClipOval),但结果总是一样的 I have just faced the same issue... Easy workaround: Container( width: 28, height: 28, decoration: BoxDecoration( color: Colors.green.withOpa

正如您所注意到的,装饰的背景色稍微溢出了圆形边框。我尝试过不同的方法(例如使用ClipOval),但结果总是一样的

    I have just faced the same issue...
    Easy workaround:

     Container(
        width: 28,
        height: 28,
        decoration: BoxDecoration(
          color: Colors.green.withOpacity(0.25), // border color
          shape: BoxShape.circle,
        ),
        child: Padding(
          padding: EdgeInsets.all(2), // border width
          child: Container( // or ClipRRect if you need to clip the content
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              color: Colors.blue, // inner circle color
            ),
            child: Container(), // inner content
          ),
        ),
      ),
Container(
            height: 200,
            width: 200,
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              border: Border.all(width: 1, color: Colors.red)
            ),
          ),