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?
Asked
Active
Viewed 51 times
0
-
Can you include your current snippet – Md. Yeasin Sheikh Sep 27 '22 at 05:45
2 Answers
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