0

I have a boolean that controls the design of a container, its color, decoration, etc. based on if it is True or not. Is there a possible way for it to control the style of any text that is put into it?

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56

2 Answers2

0

You can use two kind of style in extra file and switch:

style: isBoolean ? firstTextstyle : secondTextstyle,

In another file create two textstyle and use above:

final firstTextstyle = Textstyle();

You can use theme here like this question and answer

mohammad esmaili
  • 1,614
  • 2
  • 4
  • 17
0

You can use it by creating a TextStyle object according to the situation.

bool b =true;
TextStyle t1 = TextStyle(fontSize: 10);//true TextStyle
TextStyle t2 = TextStyle(fontSize: 20);//false TextStyle
    
Text('text', style: b ? t1 : t2,);
Jungwon
  • 1,038
  • 7
  • 20