0

I wanted to use Hexa color code for my flutter app using backgroundColor: Colors.#34A123. But I can only pickup flutter defaults values

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('CRICKDOM MOBILE'),
        backgroundColor: Colors.blue,
        leading:IconButton(
          icon: Icon(
            Icons.menu
          ),
          onPressed: (){},
        ),
 
        ],
    );

  }
}



`` 
Siddharth Mehra
  • 1,691
  • 1
  • 9
  • 32
Shalitha Jayamal
  • 171
  • 2
  • 16

1 Answers1

1

You have to use one of the constructors of Color class.

If you have RGB values then you can use:

Color c = const Color.fromRGBO(66, 165, 245, 1.0);

if you have HEX then you can use default constructor i.e for #ABCDEF use

Color myColor = const Color(0xFFABCDEF);

Note that the first 2 FF is the alpha channel - transparency. FF means completely visible. If you omit them your color will be fully transparent.

pr0gramist
  • 8,305
  • 2
  • 36
  • 48