How to use hexadecimal color strings in Flutter

0 votes

Hi Guys,

I am new to Flutter Framework. Can anyone tell me how can I convert a hexadecimal color string to a Color in Flutter?

Jul 24, 2020 in Others by akhtar
• 38,180 points
112 views

1 answer to this question.

0 votes

Hi@akhtar,

In Flutter the Color class only accepts integers as parameters, or there is the possibility to use the named constructors. So we only need to convert the string to an integer value. Also, we need to respect that opacity always needs to be specified. Now, we just need to append our color string like this.

const color = const Color(0xffb74093)
answered Jul 24, 2020 by MD
• 95,140 points

Related Questions In Others

0 votes
1 answer

How to use ListTile class in Flutter App?

Hi@akhtar, A list tile contains one to three ...READ MORE

answered Aug 26, 2020 in Others by MD
• 95,140 points
399 views
0 votes
1 answer

How to use for loop in Flutter?

Hi@akhtar, As the name suggests Dart for in ...READ MORE

answered Sep 3, 2020 in Others by MD
• 95,140 points
4,242 views
0 votes
2 answers

How to use the flat button in Flutter?

FlatButton is really easy to use. Where ever ...READ MORE

answered Nov 9, 2020 in Others by Vijay
• 200 points

edited Nov 9, 2020 by MD 791 views
+2 votes
1 answer

How to compare 2 comna separated strings in informatica?

A java transformation can be used to ...READ MORE

answered Aug 17, 2019 in Others by Rojalin
• 200 points
257 views
0 votes
1 answer

What is pubspec.yaml file in Flutter?

Hi@akhtar, It is the project's configuration file that ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,140 points
789 views
0 votes
1 answer

Error: No pubspec.yaml file found.

Hi@akhtar, You need to run this command from ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,140 points
2,917 views
0 votes
1 answer

How to launch an emulators from Flutter?

Hi@akhtar, Before launching emulators you should check if ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,140 points
1,465 views
0 votes
1 answer

How to change the background color of AppBar in Flutter?

Hi@akhtar, You can add backgroundColor keyword in your ...READ MORE

answered Aug 12, 2020 in Others by MD
• 95,140 points
958 views
0 votes
1 answer

How to use Card Widget in Flutter App?

Hi@akhtar, A card is a sheet of material used to ...READ MORE

answered Aug 26, 2020 in Others by MD
• 95,140 points
146 views