Adjust the brightness of images in flutter

964

enter image description here

enter image description here

Use a ColoredBox over your image in a Stack:

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
      ),
    ],
  ),
)

You can also use this ColorFiltered answer for more customizations.

Share:
964
new_user
Author by

new_user

Updated on December 18, 2022

Comments

  • new_user
    new_user 11 months

    Does anyone know how to adjust the brightness of an image asset in flutter? I currently have a background image and I wanted to add some brightness to the image for now. Could I get any assistance?

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