Make timeago in new settings list line wrap

This commit is contained in:
Hillel Coren 2023-03-17 14:11:37 +02:00
parent 92a1cfef2b
commit 3bb348000f
2 changed files with 34 additions and 12 deletions

View File

@ -122,11 +122,15 @@ class _HistoryListTileState extends State<HistoryListTile> {
].contains(history.entityType)) { ].contains(history.entityType)) {
title = Text(localization.lookup(history.entityType.toString())); title = Text(localization.lookup(history.entityType.toString()));
if (history.entityType == EntityType.reports) { if (history.entityType == EntityType.reports) {
subtitle = subtitle = Text(
Text(localization.lookup(state.uiState.reportsUIState.report)); localization.lookup(state.uiState.reportsUIState.report),
style: Theme.of(context).textTheme.bodySmall,
);
} else if (history.entityType == EntityType.settings) { } else if (history.entityType == EntityType.settings) {
subtitle = subtitle = Text(
Text(localization.lookup(history.id ?? kSettingsCompanyDetails)); localization.lookup(history.id ?? kSettingsCompanyDetails),
style: Theme.of(context).textTheme.bodySmall,
);
} }
} else { } else {
entity = state.getEntityMap(history.entityType)[history.id] as BaseEntity; entity = state.getEntityMap(history.entityType)[history.id] as BaseEntity;
@ -158,7 +162,7 @@ class _HistoryListTileState extends State<HistoryListTile> {
key: ValueKey('__${history.id}_${history.entityType}__'), key: ValueKey('__${history.id}_${history.entityType}__'),
leading: Icon(getEntityIcon(history.entityType)), leading: Icon(getEntityIcon(history.entityType)),
title: Row( title: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
@ -168,6 +172,7 @@ class _HistoryListTileState extends State<HistoryListTile> {
subtitle, subtitle,
], ],
)), )),
SizedBox(width: 8),
Flexible( Flexible(
child: LiveText( child: LiveText(
() => timeago.format(history.dateTime, () => timeago.format(history.dateTime,

View File

@ -697,17 +697,34 @@ class SettingsSearch extends StatelessWidget {
.toLowerCase() .toLowerCase()
.contains(filter.toLowerCase())) .contains(filter.toLowerCase()))
ListTile( ListTile(
title: Text(localization.lookup(parts[1])), title: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(localization.lookup(parts[1])),
Text(
localization.lookup(parts[2]),
style: Theme.of(context).textTheme.bodySmall,
),
],
),
),
SizedBox(width: 8),
if (parts[0].isNotEmpty)
Flexible(
child: Text(timeago.format(DateTime.parse(parts[0]),
locale:
localeSelector(store.state, twoLetter: true) +
'_short'))),
],
),
leading: Padding( leading: Padding(
padding: const EdgeInsets.only(left: 6, top: 10), padding: const EdgeInsets.only(left: 6, top: 10),
child: Icon(getSettingIcon(parts[2]), size: 22), child: Icon(getSettingIcon(parts[2]), size: 22),
), ),
trailing: parts[0].isEmpty
? null
: Text(timeago.format(DateTime.parse(parts[0]),
locale: localeSelector(store.state, twoLetter: true) +
'_short')),
subtitle: Text(localization.lookup(parts[2])),
onTap: () => onTap: () =>
viewModel.loadSection(context, parts[2], parseInt(parts[3])), viewModel.loadSection(context, parts[2], parseInt(parts[3])),
), ),