Question

How do I use RGB color in Flutter?

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)
 46  107666  46
1 Jan 1970

Solution

 89

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(),
                ))
2019-02-04

Solution

 7

I am using this code block for a personal project of mine in order to show text with a specific color using Color.fromRGBO, first parameter is Red, second is Green, third is Blue and last parameter defines the Opacity.

Text(
    "This is a sample text",
     textAlign: TextAlign.center,
     style: TextStyle(
             color: Color.fromRGBO(255, 179, 102, 1)
    )
)

2019-02-04