@@ -10,6 +10,8 @@ const bold = FontWeight.w700;
1010
1111enum TextAlign { left, right, center }
1212
13+ enum TextBaseline { alphabetic, ideographic }
14+
1315enum TextDecoration { none, underline, overline, lineThrough }
1416const underline = const < TextDecoration > [TextDecoration .underline];
1517const overline = const < TextDecoration > [TextDecoration .overline];
@@ -24,6 +26,7 @@ class TextStyle {
2426 this .fontSize,
2527 this .fontWeight,
2628 this .textAlign,
29+ this .textBaseline,
2730 this .height,
2831 this .decoration,
2932 this .decorationColor,
@@ -35,6 +38,7 @@ class TextStyle {
3538 final double fontSize; // in pixels
3639 final FontWeight fontWeight;
3740 final TextAlign textAlign;
41+ final TextBaseline textBaseline;
3842 final double height; // multiple of fontSize
3943 final List <TextDecoration > decoration; // TODO(ianh): Switch this to a Set<> once Dart supports constant Sets
4044 final Color decorationColor;
@@ -46,6 +50,7 @@ class TextStyle {
4650 double fontSize,
4751 FontWeight fontWeight,
4852 TextAlign textAlign,
53+ TextBaseline textBaseline,
4954 double height,
5055 List <TextDecoration > decoration,
5156 Color decorationColor,
@@ -57,6 +62,7 @@ class TextStyle {
5762 fontSize: fontSize != null ? fontSize : this .fontSize,
5863 fontWeight: fontWeight != null ? fontWeight : this .fontWeight,
5964 textAlign: textAlign != null ? textAlign : this .textAlign,
65+ textBaseline: textBaseline != null ? textBaseline : this .textBaseline,
6066 height: height != null ? height : this .height,
6167 decoration: decoration != null ? decoration : this .decoration,
6268 decorationColor: decorationColor != null ? decorationColor : this .decorationColor,
@@ -71,6 +77,7 @@ class TextStyle {
7177 fontSize: other.fontSize,
7278 fontWeight: other.fontWeight,
7379 textAlign: other.textAlign,
80+ textBaseline: other.textBaseline,
7481 height: other.height,
7582 decoration: other.decoration,
7683 decorationColor: other.decorationColor,
@@ -157,10 +164,11 @@ class TextStyle {
157164 return true ;
158165 return other is TextStyle &&
159166 color == other.color &&
160- fontFamily == other.fontFamily &&
167+ fontFamily == other.fontFamily &&
161168 fontSize == other.fontSize &&
162169 fontWeight == other.fontWeight &&
163- textAlign == other.textAlign &&
170+ textAlign == other.textAlign &&
171+ textBaseline == other.textBaseline &&
164172 decoration == other.decoration &&
165173 decorationColor == other.decorationColor &&
166174 decorationStyle == other.decorationStyle;
@@ -174,6 +182,7 @@ class TextStyle {
174182 value = 37 * value + fontSize.hashCode;
175183 value = 37 * value + fontWeight.hashCode;
176184 value = 37 * value + textAlign.hashCode;
185+ value = 37 * value + textBaseline.hashCode;
177186 value = 37 * value + decoration.hashCode;
178187 value = 37 * value + decorationColor.hashCode;
179188 value = 37 * value + decorationStyle.hashCode;
@@ -193,6 +202,8 @@ class TextStyle {
193202 result.add ('${prefix }fontWeight: $fontWeight ' );
194203 if (textAlign != null )
195204 result.add ('${prefix }textAlign: $textAlign ' );
205+ if (textBaseline != null )
206+ result.add ('${prefix }textBaseline: $textBaseline ' );
196207 if (decoration != null )
197208 result.add ('${prefix }decoration: $decoration ' );
198209 if (decorationColor != null )
0 commit comments