Skip to content

Commit a209912

Browse files
committed
Conform line height default sizing to CSS spec (1.2 x font size)
1 parent 9073fd2 commit a209912

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/style.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class Style {
293293
FontSize.percent(100) : fontSize;
294294
LineHeight finalLineHeight = child.lineHeight != null ?
295295
child.lineHeight?.units == "length" ?
296-
LineHeight(child.lineHeight.size / (finalFontSize == null ? 14 : finalFontSize.size), "") : child.lineHeight
296+
LineHeight(child.lineHeight.size / (finalFontSize == null ? 14 : finalFontSize.size) * 1.2, "") : child.lineHeight
297297
: lineHeight;
298298
return child.copyWith(
299299
color: child.color ?? color,
@@ -399,7 +399,7 @@ class Style {
399399
this.letterSpacing = textStyle.letterSpacing;
400400
this.textShadow = textStyle.shadows;
401401
this.wordSpacing = textStyle.wordSpacing;
402-
this.lineHeight = LineHeight(textStyle.height ?? 1.0, "");
402+
this.lineHeight = LineHeight(textStyle.height ?? 1.2, "");
403403
}
404404
}
405405

@@ -454,22 +454,22 @@ class LineHeight {
454454
const LineHeight(this.size, this.units);
455455

456456
factory LineHeight.percent(double percent) {
457-
return LineHeight(percent / 100.0, "%");
457+
return LineHeight(percent / 100.0 * 1.2, "%");
458458
}
459459

460460
factory LineHeight.em(double em) {
461-
return LineHeight(em, "em");
461+
return LineHeight(em * 1.2, "em");
462462
}
463463

464464
factory LineHeight.rem(double rem) {
465-
return LineHeight(rem, "rem");
465+
return LineHeight(rem * 1.2, "rem");
466466
}
467467

468468
factory LineHeight.number(double num) {
469-
return LineHeight(num, "number");
469+
return LineHeight(num * 1.2, "number");
470470
}
471471

472-
static const normal = LineHeight(1.0, "");
472+
static const normal = LineHeight(1.2, "");
473473
}
474474

475475
enum ListStyleType {

0 commit comments

Comments
 (0)