How do I use RGB color in Flutter?

Shehbaz Khan picture Shehbaz Khan · Feb 4, 2019 · Viewed 28.8k times · Source

I am trying to use it like this but it is giving me no color on text.

Color.fromARGB(1, 239 ~/ 255, 58 ~/ 255, 121 ~/ 255)

Answer

Prithvi Bhola picture Prithvi Bhola · Feb 4, 2019

Try using

Color.fromRGBO(38, 38, 38, 0.4)

Where r is for Red, g is for Green, b is for Blueand o is for opacity

Example:

Container(
                width: double.infinity,
                height: double.infinity,
                color: Color.fromRGBO(38, 38, 38, 0.4),
                child: Center(
                  child: CircularProgressIndicator(),
                ))