@@ -24,6 +24,7 @@ public class TextStyle : Diagnosticable, IEquatable<TextStyle> {
24
24
public readonly Paint foreground ;
25
25
public readonly Paint background ;
26
26
public readonly string fontFamily ;
27
+ public readonly List < BoxShadow > shadows ;
27
28
28
29
public List < string > fontFamilyFallback {
29
30
get { return this . _fontFamilyFallback ; }
@@ -58,6 +59,7 @@ public TextStyle(bool inherit = true,
58
59
float ? decorationThickness = null ,
59
60
string fontFamily = null ,
60
61
List < string > fontFamilyFallback = null ,
62
+ List < BoxShadow > shadows = null ,
61
63
string debugLabel = null ) {
62
64
D . assert ( color == null || foreground == null , ( ) => _kColorForegroundWarning ) ;
63
65
D . assert ( backgroundColor == null || background == null , ( ) => _kColorBackgroundWarning ) ;
@@ -80,22 +82,22 @@ public TextStyle(bool inherit = true,
80
82
this . debugLabel = debugLabel ;
81
83
this . foreground = foreground ;
82
84
this . background = background ;
85
+ this . shadows = shadows ;
83
86
}
84
87
85
88
public RenderComparison compareTo ( TextStyle other ) {
86
- if ( this . inherit != other . inherit || this . fontFamily != other . fontFamily
87
- || this . fontSize != other . fontSize || this . fontWeight != other . fontWeight
88
- || this . fontStyle != other . fontStyle ||
89
- this . letterSpacing != other . letterSpacing
90
- || this . wordSpacing != other . wordSpacing ||
91
- this . textBaseline != other . textBaseline
92
- || this . height != other . height || this . background != other . background ) {
89
+ if ( this . inherit != other . inherit || this . fontFamily != other . fontFamily ||
90
+ this . fontSize != other . fontSize || this . fontWeight != other . fontWeight ||
91
+ this . fontStyle != other . fontStyle || this . letterSpacing != other . letterSpacing ||
92
+ this . wordSpacing != other . wordSpacing || this . textBaseline != other . textBaseline ||
93
+ this . height != other . height || this . background != other . background ||
94
+ this . shadows . equalsList ( other . shadows ) ) {
93
95
return RenderComparison . layout ;
94
96
}
95
97
96
98
if ( this . color != other . color || this . decoration != other . decoration ||
97
- this . decorationColor != other . decorationColor
98
- || this . decorationStyle != other . decorationStyle ) {
99
+ this . decorationColor != other . decorationColor ||
100
+ this . decorationStyle != other . decorationStyle ) {
99
101
return RenderComparison . paint ;
100
102
}
101
103
@@ -122,6 +124,7 @@ public TextStyle apply(
122
124
float decorationThicknessDelta = 0.0f ,
123
125
string fontFamily = null ,
124
126
List < string > fontFamilyFallback = null ,
127
+ List < BoxShadow > shadows = null ,
125
128
float fontSizeFactor = 1.0f ,
126
129
float fontSizeDelta = 0.0f ,
127
130
int fontWeightDelta = 0 ,
@@ -172,6 +175,7 @@ public TextStyle apply(
172
175
decorationThickness : this . decorationThickness == null
173
176
? null
174
177
: this . decorationThickness * decorationThicknessFactor + decorationThicknessDelta ,
178
+ shadows : shadows ?? this . shadows ,
175
179
debugLabel : modifiedDebugLabel
176
180
) ;
177
181
}
@@ -213,6 +217,7 @@ public TextStyle merge(TextStyle other) {
213
217
decorationColor : other . decorationColor ,
214
218
decorationStyle : other . decorationStyle ,
215
219
decorationThickness : other . decorationThickness ,
220
+ shadows : other . shadows ,
216
221
debugLabel : mergedDebugLabel
217
222
) ;
218
223
}
@@ -236,6 +241,7 @@ public TextStyle copyWith(
236
241
Color decorationColor = null ,
237
242
TextDecorationStyle ? decorationStyle = null ,
238
243
float ? decorationThickness = null ,
244
+ List < BoxShadow > shadows = null ,
239
245
string debugLabel = null ) {
240
246
D . assert ( color == null || foreground == null , ( ) => _kColorForegroundWarning ) ;
241
247
D . assert ( backgroundColor == null || background == null , ( ) => _kColorBackgroundWarning ) ;
@@ -267,6 +273,7 @@ public TextStyle copyWith(
267
273
decorationThickness : decorationThickness ?? this . decorationThickness ,
268
274
foreground : foreground ?? this . foreground ,
269
275
background : background ?? this . background ,
276
+ shadows : shadows ?? this . shadows ,
270
277
debugLabel : newDebugLabel
271
278
) ;
272
279
}
@@ -304,6 +311,7 @@ public static TextStyle lerp(TextStyle a, TextStyle b, float t) {
304
311
decorationColor : Color . lerp ( null , b . decorationColor , t ) ,
305
312
decorationStyle : t < 0.5f ? null : b . decorationStyle ,
306
313
decorationThickness : t < 0.5f ? null : b . decorationThickness ,
314
+ shadows : t < 0.5f ? null : b . shadows ,
307
315
debugLabel : lerpDebugLabel
308
316
) ;
309
317
}
@@ -328,6 +336,7 @@ public static TextStyle lerp(TextStyle a, TextStyle b, float t) {
328
336
decorationColor : Color . lerp ( a . decorationColor , null , t ) ,
329
337
decorationStyle : t < 0.5f ? a . decorationStyle : null ,
330
338
decorationThickness : t < 0.5f ? a . decorationThickness : null ,
339
+ shadows : t < 0.5f ? a . shadows : null ,
331
340
debugLabel : lerpDebugLabel
332
341
) ;
333
342
}
@@ -365,6 +374,7 @@ public static TextStyle lerp(TextStyle a, TextStyle b, float t) {
365
374
decorationThickness : MathUtils . lerpFloat (
366
375
a . decorationThickness ?? b . decorationThickness ?? 0.0f ,
367
376
b . decorationThickness ?? a . decorationThickness ?? 0.0f , t ) ,
377
+ shadows : t < 0.5f ? a . shadows : b . shadows ,
368
378
debugLabel : lerpDebugLabel
369
379
) ;
370
380
}
@@ -471,7 +481,8 @@ public bool Equals(TextStyle other) {
471
481
this . decorationThickness == other . decorationThickness &&
472
482
Equals ( this . foreground , other . foreground ) &&
473
483
Equals ( this . background , other . background ) &&
474
- CollectionUtils . equalsList ( this . fontFamilyFallback , other . fontFamilyFallback ) &&
484
+ this . fontFamilyFallback . equalsList ( other . fontFamilyFallback ) &&
485
+ this . shadows . equalsList ( other . shadows ) &&
475
486
string . Equals ( this . fontFamily , other . fontFamily ) ;
476
487
}
477
488
@@ -512,6 +523,7 @@ public override int GetHashCode() {
512
523
hashCode = ( hashCode * 397 ) ^ ( this . fontFamily != null ? this . fontFamily . GetHashCode ( ) : 0 ) ;
513
524
hashCode = ( hashCode * 397 ) ^
514
525
( this . fontFamilyFallback != null ? this . fontFamilyFallback . GetHashCode ( ) : 0 ) ;
526
+ hashCode = ( hashCode * 397 ) ^ ( this . shadows != null ? this . shadows . GetHashCode ( ) : 0 ) ;
515
527
return hashCode ;
516
528
}
517
529
}
0 commit comments