为图标添加边框

Jal*_*ran 6 flutter flutter-layout

我想为 flutter 中的图标添加边框,如下图所示。

带边框颜色的星形

我怎样才能做到这一点?

小智 9

我尝试了一些有创意的东西

Stack(
  children: [
     _buildIcon(48, Colors.blue),
     _buildIcon(44, Colors.white),
  ],
),

Widget _buildIcon(double size, Color color) {
  return Container(
    height: 48,
    width: 48,
    alignment: Alignment.center,
    child: Icon(
      Icons.star,
      color: color,
      size: size,
    ),
  );
}
Run Code Online (Sandbox Code Playgroud)