When I'm using (Colors.amberAccent) in Flutter framework, the color square appears automatically. How can I show it in Android studio beside Lines number if I'm using Color.fromARGB(255, 100, 100, 23)?
The second question is, can I use this color style (#ff0000) in Flutter framework?
I've put an image to clear my idea.colors
3 Answers 3
String color = '#ff0000';
String hex = color.replaceAll("#", "");
Color col = Color(int.parse(hex, radix: 16)).withOpacity(1.0);
P.S. Or, you can use this
Comments
To answer your first question: It is not possible to display the color in the IDE when you use something else that Colors.colorName.
For your second question: you can use the style you described with this syntax Color(0xff5600). That will return a Color object instance
return new MaterialApp(
title: appTitle,
theme: new ThemeData(
primarySwatch: : Color(0xff5600),
),
home: ...
);
Comments
The color square will appear if you put the color as a constant:
Color color = const Color(0xFF536DFE);
Colors#fromHexString