首页 > 解决方案 > 在flutter中将自定义透明度值设置为floatingActionButton

问题描述

floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: Icon(Icons.add),
        backgroundColor: Colors.blueGrey[800],
      ),

如何将自定义不透明度/透明度值设置为 floatingActionButton?是否有定义透明度百分比的属性?

标签: flutterdart

解决方案


您可以通过为其颜色添加不透明度来设置浮动按钮的透明度

floatingActionButton: FloatingActionButton(
    onPressed: () {},
    child: Icon(Icons.add),
    backgroundColor: Colors.blueGrey.withOpacity(0.5),
  ),

推荐阅读