Reputation: 171
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: (){},
),
],
);
}
}
``
Upvotes: 0
Views: 425
Reputation: 9038
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.
Upvotes: 1