Skip to content

Commit

Permalink
fix: text overflow in CosmosTextButton (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejchm authored May 6, 2022
1 parent 394cc77 commit 7c797a0
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class CosmosTextButton extends StatelessWidget {
this.textStyle,
this.iconTopSpacing,
this.color,
this.maxLines = 1,
this.overflow = TextOverflow.ellipsis,
}) : super(key: key);

static const defaultHeight = 50.0;
Expand All @@ -26,6 +28,8 @@ class CosmosTextButton extends StatelessWidget {
final TextStyle? textStyle;
final Color? color;
final double? iconTopSpacing;
final int maxLines;
final TextOverflow overflow;

@override
Widget build(BuildContext context) {
Expand All @@ -48,10 +52,9 @@ class CosmosTextButton extends StatelessWidget {
],
Text(
text,
style: textStyle ??
CosmosTextTheme.elevatedButton.copyWith(
color: color,
),
maxLines: maxLines,
overflow: overflow,
style: textStyle ?? CosmosTextTheme.elevatedButton.copyWith(color: color),
),
if (suffixIcon != null) ...[
if (text.isNotEmpty) SizedBox(width: CosmosTheme.of(context).spacingS),
Expand All @@ -74,6 +77,8 @@ class CosmosTextButton extends StatelessWidget {
..add(ColorProperty('color', color))
..add(StringProperty('text', text))
..add(DiagnosticsProperty<TextStyle?>('textStyle', textStyle))
..add(DoubleProperty('height', height));
..add(DoubleProperty('height', height))
..add(IntProperty('maxLines', maxLines))
..add(EnumProperty<TextOverflow>('overflow', overflow));
}
}

0 comments on commit 7c797a0

Please sign in to comment.