diff --git a/lib/src/auto_size_text.dart b/lib/src/auto_size_text.dart index ec43838..f1aaaae 100644 --- a/lib/src/auto_size_text.dart +++ b/lib/src/auto_size_text.dart @@ -32,6 +32,7 @@ class AutoSizeText extends StatefulWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, + this.textHeightBehavior, }) : textSpan = null, super(key: key); @@ -57,6 +58,7 @@ class AutoSizeText extends StatefulWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, + this.textHeightBehavior, }) : data = null, super(key: key); @@ -215,6 +217,20 @@ class AutoSizeText extends StatefulWidget { /// ``` final String? semanticsLabel; + /// Defines how to apply [TextStyle.height] over and under text. + /// + /// [TextHeightBehavior.applyHeightToFirstAscent] and + /// [TextHeightBehavior.applyHeightToLastDescent] represent whether the + /// [TextStyle.height] modifier will be applied to the corresponding metric. By + /// default both properties are true, and [TextStyle.height] is applied as + /// normal. When set to false, the font's default ascent will be used. + /// + /// [TextHeightBehavior.leadingDistribution] determines how the + /// leading is distributed over and under text. This + /// property applies before [TextHeightBehavior.applyHeightToFirstAscent] and + /// [TextHeightBehavior.applyHeightToLastDescent]. + final TextHeightBehavior? textHeightBehavior; + @override _AutoSizeTextState createState() => _AutoSizeTextState(); } @@ -425,6 +441,7 @@ class _AutoSizeTextState extends State { textScaleFactor: 1, maxLines: maxLines, semanticsLabel: widget.semanticsLabel, + textHeightBehavior: widget.textHeightBehavior, ); } else { return Text.rich( @@ -440,6 +457,7 @@ class _AutoSizeTextState extends State { textScaleFactor: fontSize / style.fontSize!, maxLines: maxLines, semanticsLabel: widget.semanticsLabel, + textHeightBehavior: widget.textHeightBehavior, ); } }