educative.io

Local THEME - font style

Do I need to use the format you show to set a local theme for font style for a widget or do I just set the font style in the widget directly?
Say I want the font color to be Colors.black54. for a text widget?
What is the best way to do that?

I’m looking for a way to set a Global theme for font sizes and colors , like heading, body1, body2 etc and then how to use that in a widget for text widget?

You code looks like this;
//NEW CODE: Applying local theme to profileActionItems()
child: Theme(
data: ThemeData(
//Applying iconTheme locally
iconTheme: IconThemeData(
//NOTE: Try Colors.orange or a diffrent color
color: Colors.orange,
),
),
child: profileActionItems(),
),


Type your question above this line.

Course: https://www.educative.io/collection/5726865580883968/6563776842170368
Lesson: https://www.educative.io/collection/page/5726865580883968/6563776842170368/5413454140669952

Hi David!
You can use any method to set up the font color/style in a flutter app. In order to implement a global theme on widgets, you may set a Theme for your MaterialApp. You may achieve this by creating a new custom theme in a separate file and then including that file in the main file.

I hope it will clear your ambiguity. If you still have any queries please let us know.
Thank you.