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,260 points
852 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)

To know more about Flutter, join our Best Flutter Course today.

answered Jul 24, 2020 by MD
• 95,460 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,460 points
1,736 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,460 points
19,206 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 4,643 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 18, 2019 in Others by Rojalin
• 200 points
1,476 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,460 points
3,452 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,460 points
9,067 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,460 points
6,310 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,460 points
2,125 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,460 points
1,159 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP