From 8a9ece0f6f7f94543973e28d7210f77664f1aa83 Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Thu, 26 Sep 2024 15:31:32 +0200 Subject: [PATCH] fix(app): fix overflow of long drug names on cards --- .../drug_list/drug_items/drug_cards.dart | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/lib/common/widgets/drug_list/drug_items/drug_cards.dart b/app/lib/common/widgets/drug_list/drug_items/drug_cards.dart index e4d31046..5238c36f 100644 --- a/app/lib/common/widgets/drug_list/drug_items/drug_cards.dart +++ b/app/lib/common/widgets/drug_list/drug_items/drug_cards.dart @@ -56,19 +56,25 @@ class DrugCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Icon( - drug.warningLevel.icon, - color: PharMeTheme.onSurfaceText, + Text.rich( + TextSpan( + style: PharMeTheme.textTheme.titleMedium!.copyWith( + fontWeight: FontWeight.bold, ), - SizedBox(width: 4), - Text( - drugName, - style: PharMeTheme.textTheme.titleMedium! - .copyWith(fontWeight: FontWeight.bold), - ), - ], + children: [ + WidgetSpan( + child: Icon( + drug.warningLevel.icon, + color: PharMeTheme.onSurfaceText, + ), + alignment: PlaceholderAlignment.middle, + ), + TextSpan(text: ' '), + TextSpan(text: drugName), + ], + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), SizedBox(height: PharMeTheme.smallSpace / 2), if (drug.annotations.brandNames.isNotEmpty) ...[