Skip to content

Commit

Permalink
chore: add overflow rule for button label
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-orion committed Feb 13, 2024
1 parent b44ce38 commit a6fedd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/app/components/button/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Button extends StatelessWidget {
required Widget icon,
ButtonType type,
ButtonStyle style,
Color? tintColor,
double size,
}) = _ButtonWithIcon;

Expand Down Expand Up @@ -82,6 +83,7 @@ class Button extends StatelessWidget {
child: IconTheme(
data: IconThemeData(color: _getIconTintColor(context, type)),
child: DefaultTextStyle(
overflow: TextOverflow.ellipsis,
style: context.theme.appTextThemes.body
.copyWith(color: _getLabelColor(context, type)),
child: Row(
Expand All @@ -90,13 +92,16 @@ class Button extends StatelessWidget {
children: <Widget>[
if (leadingIcon != null) leadingIcon!,
if (label != null)
Padding(
padding: EdgeInsets.only(
left:
leadingIcon == null ? 0 : 8.0.s, // 8 move to constants
right: trailingIcon == null ? 0 : 8.0.s,
Flexible(
child: Padding(
padding: EdgeInsets.only(
left: leadingIcon == null
? 0
: 8.0.s, // 8 move to constants
right: trailingIcon == null ? 0 : 8.0.s,
),
child: label,
),
child: label,
),
if (trailingIcon != null) trailingIcon!,
],
Expand Down
1 change: 1 addition & 0 deletions lib/app/components/button/variants/button_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class _ButtonWithIcon extends Button {
_ButtonWithIcon({
super.key,
super.type,
super.tintColor,
required super.onPressed,
required Widget icon,
ButtonStyle style = const ButtonStyle(),
Expand Down
1 change: 1 addition & 0 deletions lib/app/components/button/widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Widget iconButtonUseCase(BuildContext context) {
),
Button.icon(
size: 40.0.s,
tintColor: context.theme.appColors.attentionRed,
type: ButtonType.outlined,
icon: ImageIcon(
AssetImage(Assets.images.filter.path),
Expand Down

0 comments on commit a6fedd4

Please sign in to comment.