@@ -25,6 +25,7 @@ class TextUtils {
2525 required List <VariableData > variablesOverrides,
2626 required NullSubstitutionMode nullSubstitutionMode,
2727 required bool replaceVariableWithSymbol,
28+ bool hasMissingFont = false ,
2829 List <Effect >? effects,
2930 }) {
3031 String characters = rawText;
@@ -48,6 +49,7 @@ class TextUtils {
4849 variablesOverrides: variablesOverrides,
4950 nullSubstitutionMode: nullSubstitutionMode,
5051 replaceVariableWithSymbol: replaceVariableWithSymbol,
52+ hasMissingFont: hasMissingFont,
5153 tapGestureRecognizer: tapGestureRecognizer,
5254 );
5355 }
@@ -69,19 +71,29 @@ class TextUtils {
6971 required List <VariableData > variablesOverrides,
7072 required NullSubstitutionMode nullSubstitutionMode,
7173 required bool replaceVariableWithSymbol,
74+ bool hasMissingFont = false ,
7275 TapGestureRecognizer ? tapGestureRecognizer,
7376 }) {
7477 String characters = rawText;
7578
76- final TextStyle style = retrieveTextStyle (
77- fontSize: fontSize,
78- fontName: fontName,
79- textDecoration: textDecoration,
80- lineHeight: lineHeight,
81- letterSpacing: letterSpacing,
82- color: color,
83- effects: effects ?? (node is BlendMixin ? node.effects : const []),
84- );
79+ final TextStyle style = switch (hasMissingFont) {
80+ false => retrieveTextStyle (
81+ fontSize: fontSize,
82+ fontName: fontName,
83+ textDecoration: textDecoration,
84+ lineHeight: lineHeight,
85+ letterSpacing: letterSpacing,
86+ color: color,
87+ effects: effects ?? (node is BlendMixin ? node.effects : const []),
88+ ),
89+ true => TextStyle (
90+ color: Colors .red,
91+ fontSize: fontSize,
92+ fontWeight: FontWeight .bold,
93+ decorationColor: Colors .yellow,
94+ decoration: TextDecoration .underline,
95+ ),
96+ };
8597
8698 // Replace with fx symbol if required.
8799 if (replaceVariableWithSymbol) {
@@ -124,6 +136,7 @@ class TextUtils {
124136 required List <VariableData > variablesOverrides,
125137 required NullSubstitutionMode nullSubstitutionMode,
126138 required bool replaceVariablesWithSymbol,
139+ bool hasMissingFont = false ,
127140 List <Effect >? effects,
128141 Map <String , TapGestureRecognizer > tapGestureRecognizers = const {},
129142 }) {
@@ -137,6 +150,7 @@ class TextUtils {
137150 variablesOverrides: variablesOverrides,
138151 nullSubstitutionMode: nullSubstitutionMode,
139152 replaceVariableWithSymbol: replaceVariablesWithSymbol,
153+ hasMissingFont: hasMissingFont,
140154 tapGestureRecognizer: tapGestureRecognizers[prop.link],
141155 effects: effects ?? (node is BlendMixin ? node.effects : const []),
142156 ),
@@ -181,6 +195,7 @@ class TextUtils {
181195 required List <VariableData > variablesOverrides,
182196 required NullSubstitutionMode nullSubstitutionMode,
183197 required bool replaceVariablesWithSymbol,
198+ bool hasMissingFont = false ,
184199 Map <String , TapGestureRecognizer > tapGestureRecognizers = const {},
185200 }) {
186201 final spans = buildTextSpansForProps (
@@ -192,6 +207,7 @@ class TextUtils {
192207 nullSubstitutionMode: nullSubstitutionMode,
193208 replaceVariablesWithSymbol: replaceVariablesWithSymbol,
194209 tapGestureRecognizers: tapGestureRecognizers,
210+ hasMissingFont: hasMissingFont,
195211 );
196212
197213 return Text .rich (
@@ -224,6 +240,7 @@ class TextUtils {
224240 required List <VariableData > variablesOverrides,
225241 required NullSubstitutionMode nullSubstitutionMode,
226242 required bool replaceVariablesWithSymbol,
243+ bool hasMissingFont = false ,
227244 }) {
228245 final span = buildTextSpan (
229246 context,
@@ -238,6 +255,7 @@ class TextUtils {
238255 variablesOverrides: variablesOverrides,
239256 nullSubstitutionMode: nullSubstitutionMode,
240257 replaceVariableWithSymbol: replaceVariablesWithSymbol,
258+ hasMissingFont: hasMissingFont,
241259 tapGestureRecognizer: tapGestureRecognizers,
242260 node: node,
243261 );
0 commit comments