fix: handle really long template names by adding textoverflow.ellipsis everywhere

This commit is contained in:
Freek van de Ven 2024-07-25 11:20:24 +02:00 committed by Bart Ribbers
parent ae950ce5df
commit c31ca03806
4 changed files with 47 additions and 14 deletions

View file

@ -217,8 +217,14 @@ class _TemplateListSectionItem extends StatelessWidget {
width: 20, width: 20,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text(template.name, style: theme.textTheme.bodyLarge), Expanded(
const Spacer(), child: Text(
template.name,
style: theme.textTheme.bodyLarge,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 4),
InkWell( InkWell(
onTap: () => onEditTemplate(template), onTap: () => onEditTemplate(template),
child: const Icon(Icons.edit), child: const Icon(Icons.edit),

View file

@ -182,7 +182,13 @@ class _WeekTemplateModificationScreenState
var overviewPage = _WeekTemplateSidePadding( var overviewPage = _WeekTemplateSidePadding(
child: Column( child: Column(
children: [ children: [
Text(translations.templateTitleLabel, style: textTheme.titleMedium), Align(
alignment: Alignment.centerLeft,
child: Text(
translations.templateTitleLabel,
style: textTheme.titleMedium,
),
),
const SizedBox(height: 8), const SizedBox(height: 8),
Container( Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
@ -204,7 +210,13 @@ class _WeekTemplateModificationScreenState
height: 20, height: 20,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(_viewModel.name ?? "", style: textTheme.bodyLarge), Expanded(
child: Text(
_viewModel.name ?? "",
style: textTheme.bodyLarge,
overflow: TextOverflow.ellipsis,
),
),
], ],
), ),
), ),

View file

@ -103,17 +103,20 @@ class _TemplateList extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
for (var template in selectedTemplates) ...[ children: [
_TemplateListItem(template: template), for (var template in selectedTemplates) ...[
if (template != selectedTemplates.last) ...[ _TemplateListItem(template: template),
const SizedBox(height: 12), if (template != selectedTemplates.last) ...[
const SizedBox(height: 12),
],
], ],
], ],
], ),
), ),
const SizedBox(width: 8),
InkWell( InkWell(
onTap: onTemplatesRemoved, onTap: onTemplatesRemoved,
child: const Icon(Icons.remove), child: const Icon(Icons.remove),
@ -146,7 +149,13 @@ class _TemplateListItem extends StatelessWidget {
height: 20, height: 20,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(template.name, style: theme.textTheme.bodyLarge), Expanded(
child: Text(
template.name,
style: theme.textTheme.bodyLarge,
overflow: TextOverflow.ellipsis,
),
),
], ],
); );
} }

View file

@ -230,7 +230,13 @@ class _TemplateLegendItem extends StatelessWidget {
height: 20, height: 20,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text(name, style: theme.textTheme.bodyLarge), Expanded(
child: Text(
name,
style: theme.textTheme.bodyLarge,
overflow: TextOverflow.ellipsis,
),
),
], ],
); );
} }