我尝试的代码是以下代码。
FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.transparent,
elevation: 0,
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
constraints: const BoxConstraints.expand(),
child: const Icon(
Icons.add,
color: Colors.white,
),
),
)
这张图片就是上面的代码。
我能够让它看起来几乎一样,但如果有更好的方法,请告诉我。
FloatingActionButton
文档显示shape
属性:)
floatingActionButton: FloatingActionButton(
shape: const CircleBorder(),
// ...
),