Skip to content

Commit

Permalink
add text scaler information to expand text widget
Browse files Browse the repository at this point in the history
  • Loading branch information
veronikalaskova committed May 1, 2024
1 parent 9672770 commit fcaacec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/src/expand_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class ExpandText extends StatefulWidget {
/// Corresponds to the style parameter of the text view.
final TextStyle? style;

/// Corresponds to the textScaler parameter of the text view.
/// Default value is: [TextScaler.noScaling].
/// If user has information about scale factor, it can be passed here
/// To better determine whether widget overflows or not when accessibility affects text size.
final TextScaler textScaler;

/// Corresponds to the aling parameter of the text view.
final TextAlign textAlign;

Expand Down Expand Up @@ -91,6 +97,7 @@ class ExpandText extends StatefulWidget {
this.maxLines = 8,
this.style,
this.textAlign = TextAlign.justify,
this.textScaler = TextScaler.noScaling,
this.overflow = TextOverflow.fade,
this.expandWidth = false,
this.expandOnGesture = false,
Expand Down Expand Up @@ -191,6 +198,7 @@ class _ExpandTextState extends State<ExpandText>
style: defaultTextStyle,
),
textDirection: TextDirection.ltr,
textScaler: widget.textScaler,
maxLines: widget.maxLines,
)..layout(maxWidth: size.maxWidth);

Expand Down

0 comments on commit fcaacec

Please sign in to comment.