flutter black & white image

flutter black & white image

472

Would you like to have disabled (gary) image? here is a tip for you

If your child object is a .png image, flutter will render it with a grey background by default, if you put Colors.grey. Using the same color of your widget background you will have a perfect disabled image

But how do I make my colored image black and white?

well the answer is to use ColorFiltered widget, and here is how to

ColorFiltered(
    colorFilter: ColorFilter.mode(
        Colors.white,
        BlendMode.saturation,
    ),
    child: child,
)

Now you can add your image as child and test the results.

- Last updated 8 months ago

Be the first to leave a comment.

You must login to leave a comment