【问题标题】:Adding frosted glass effect over image在图像上添加磨砂玻璃效果
【发布时间】:2020-02-03 22:02:31
【问题描述】:

我正在尝试在图像上添加磨砂玻璃效果,根据我的研究,以下似乎是一种方法。然而,虽然没有 linting,但它给了我运行时错误:“不能同时提供颜色和装饰”。有没有更好的方法用橙色磨砂效果模糊背景中的图像?

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

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    也就是说,如果您的container 中有BoxDecoration 属性,则需要将color 移动到BoxDecoration 内部

    这样

    Container(
        decoration: BoxDecoration(
          color: Colors.orange.withOpacity(0.75), // <-------------
          image: DecorationImage(
            alignment: Alignment.bottomCenter,
            image: AssetImage("assets/images/pngguru.com-id-bnwsh.png"),
            fit: BoxFit.cover,
          ),
        )
    

    【讨论】:

    猜你喜欢
    • 2014-05-02
    • 1970-01-01
    • 2012-07-21
    • 1970-01-01
    • 2019-04-16
    • 1970-01-01
    • 1970-01-01
    • 2021-11-12
    • 2017-09-18
    相关资源
    最近更新 更多