为图像添加透明度

时间:2019-10-06 12:16:06

标签: flutter dart

我在容器中有以下图像。有没有办法使实际图像本身更加透明?现在,它阻止了我将在其上面覆盖的文本。

 return Consumer<UserModel>(
      builder: (context, model, _) => Scaffold(
        body: Container(
          decoration: BoxDecoration(
            color: Colors.orange.withOpacity(0.8), // <-------------
            image: DecorationImage(
              alignment: Alignment.bottomCenter,
              image: AssetImage("assets/images/pngguru.com-id-bnwsh.png"),
              fit: BoxFit.cover,
            ),
          ),

1 个答案:

答案 0 :(得分:-1)

您可以使用Opacity小部件并将其包装在图像周围。 https://api.flutter.dev/flutter/widgets/Opacity-class.html