From a6fedd4b1e17517cda193a5360697cf86123917c Mon Sep 17 00:00:00 2001 From: ice-orion <102020833+ice-orion@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:08:38 +0400 Subject: [PATCH] chore: add overflow rule for button label --- lib/app/components/button/button.dart | 17 +++++++++++------ .../components/button/variants/button_icon.dart | 1 + lib/app/components/button/widgetbook.dart | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/app/components/button/button.dart b/lib/app/components/button/button.dart index d16e54f46..79489be77 100644 --- a/lib/app/components/button/button.dart +++ b/lib/app/components/button/button.dart @@ -35,6 +35,7 @@ class Button extends StatelessWidget { required Widget icon, ButtonType type, ButtonStyle style, + Color? tintColor, double size, }) = _ButtonWithIcon; @@ -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( @@ -90,13 +92,16 @@ class Button extends StatelessWidget { children: [ 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!, ], diff --git a/lib/app/components/button/variants/button_icon.dart b/lib/app/components/button/variants/button_icon.dart index 6d514b27b..a8db2ed18 100644 --- a/lib/app/components/button/variants/button_icon.dart +++ b/lib/app/components/button/variants/button_icon.dart @@ -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(), diff --git a/lib/app/components/button/widgetbook.dart b/lib/app/components/button/widgetbook.dart index ec64124bf..4f7c6bf16 100644 --- a/lib/app/components/button/widgetbook.dart +++ b/lib/app/components/button/widgetbook.dart @@ -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),