@@ -10,6 +10,8 @@ const bold = FontWeight.w700;
10
10
11
11
enum TextAlign { left, right, center }
12
12
13
+ enum TextBaseline { alphabetic, ideographic }
14
+
13
15
enum TextDecoration { none, underline, overline, lineThrough }
14
16
const underline = const < TextDecoration > [TextDecoration .underline];
15
17
const overline = const < TextDecoration > [TextDecoration .overline];
@@ -24,6 +26,7 @@ class TextStyle {
24
26
this .fontSize,
25
27
this .fontWeight,
26
28
this .textAlign,
29
+ this .textBaseline,
27
30
this .height,
28
31
this .decoration,
29
32
this .decorationColor,
@@ -35,6 +38,7 @@ class TextStyle {
35
38
final double fontSize; // in pixels
36
39
final FontWeight fontWeight;
37
40
final TextAlign textAlign;
41
+ final TextBaseline textBaseline;
38
42
final double height; // multiple of fontSize
39
43
final List <TextDecoration > decoration; // TODO(ianh): Switch this to a Set<> once Dart supports constant Sets
40
44
final Color decorationColor;
@@ -46,6 +50,7 @@ class TextStyle {
46
50
double fontSize,
47
51
FontWeight fontWeight,
48
52
TextAlign textAlign,
53
+ TextBaseline textBaseline,
49
54
double height,
50
55
List <TextDecoration > decoration,
51
56
Color decorationColor,
@@ -57,6 +62,7 @@ class TextStyle {
57
62
fontSize: fontSize != null ? fontSize : this .fontSize,
58
63
fontWeight: fontWeight != null ? fontWeight : this .fontWeight,
59
64
textAlign: textAlign != null ? textAlign : this .textAlign,
65
+ textBaseline: textBaseline != null ? textBaseline : this .textBaseline,
60
66
height: height != null ? height : this .height,
61
67
decoration: decoration != null ? decoration : this .decoration,
62
68
decorationColor: decorationColor != null ? decorationColor : this .decorationColor,
@@ -71,6 +77,7 @@ class TextStyle {
71
77
fontSize: other.fontSize,
72
78
fontWeight: other.fontWeight,
73
79
textAlign: other.textAlign,
80
+ textBaseline: other.textBaseline,
74
81
height: other.height,
75
82
decoration: other.decoration,
76
83
decorationColor: other.decorationColor,
@@ -157,10 +164,11 @@ class TextStyle {
157
164
return true ;
158
165
return other is TextStyle &&
159
166
color == other.color &&
160
- fontFamily == other.fontFamily &&
167
+ fontFamily == other.fontFamily &&
161
168
fontSize == other.fontSize &&
162
169
fontWeight == other.fontWeight &&
163
- textAlign == other.textAlign &&
170
+ textAlign == other.textAlign &&
171
+ textBaseline == other.textBaseline &&
164
172
decoration == other.decoration &&
165
173
decorationColor == other.decorationColor &&
166
174
decorationStyle == other.decorationStyle;
@@ -174,6 +182,7 @@ class TextStyle {
174
182
value = 37 * value + fontSize.hashCode;
175
183
value = 37 * value + fontWeight.hashCode;
176
184
value = 37 * value + textAlign.hashCode;
185
+ value = 37 * value + textBaseline.hashCode;
177
186
value = 37 * value + decoration.hashCode;
178
187
value = 37 * value + decorationColor.hashCode;
179
188
value = 37 * value + decorationStyle.hashCode;
@@ -193,6 +202,8 @@ class TextStyle {
193
202
result.add ('${prefix }fontWeight: $fontWeight ' );
194
203
if (textAlign != null )
195
204
result.add ('${prefix }textAlign: $textAlign ' );
205
+ if (textBaseline != null )
206
+ result.add ('${prefix }textBaseline: $textBaseline ' );
196
207
if (decoration != null )
197
208
result.add ('${prefix }decoration: $decoration ' );
198
209
if (decorationColor != null )
0 commit comments