【问题标题】:Adjust the brightness of images in flutter在颤动中调整图像的亮度
【发布时间】:2021-08-20 00:49:00
【问题描述】:

有人知道如何在颤动中调整图像资产的亮度吗?我目前有一个背景图像,我现在想为图像添加一些亮度。我能得到任何帮助吗?

 Container(
              decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage(
                      'assets/images/image.png',
                    ),
                    fit: BoxFit.cover),
              ),
            ),           

【问题讨论】:

    标签: image flutter dart image-processing


    【解决方案1】:

    Stack 中的图像上使用ColoredBox

    SizedBox(
      height: 200,
      child: Stack(
        fit: StackFit.expand,
        children: [
          Image.asset('chocolate_image', fit: BoxFit.cover),
          ColoredBox(
            color: Colors.black.withOpacity(0.5) // 0: Light, 1: Dark
          ),
        ],
      ),
    )
    

    您还可以使用this ColorFiltered answer 进行更多自定义。

    【讨论】:

      猜你喜欢
      • 2019-03-26
      • 2019-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多