fix(backups): Remove '\n' and replace with a list of widgets

- Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/434
This commit is contained in:
NaiJi 2024-04-17 20:13:06 +04:00
parent 4ad43ff1fd
commit 8a757a70ea

View file

@ -104,21 +104,29 @@ class _CreateBackupsModalState extends State<CreateBackupsModal> {
...widget.services.map(
(final Service service) {
final bool busy = busyServices.contains(service.id);
String description;
final List<Widget> descriptionWidgets = [];
if (busy) {
description = 'backup.service_busy'.tr();
descriptionWidgets.add(Text('backup.service_busy'.tr()));
} else {
description = service.backupDescription;
description += '\n';
description += 'service_page.uses'.tr(
namedArgs: {
'usage': service.storageUsage.used.toString(),
'volume': context
.read<VolumesBloc>()
.state
.getVolume(service.storageUsage.volume ?? '')
.displayName,
},
descriptionWidgets.add(
Text(
'service_page.uses'.tr(
namedArgs: {
'usage': service.storageUsage.used.toString(),
'volume': context
.read<VolumesBloc>()
.state
.getVolume(service.storageUsage.volume ?? '')
.displayName,
},
),
),
);
descriptionWidgets.add(
const SizedBox(height: 4),
);
descriptionWidgets.add(
Text(service.backupDescription),
);
}
return CheckboxListTile.adaptive(
@ -140,9 +148,7 @@ class _CreateBackupsModalState extends State<CreateBackupsModal> {
title: Text(
service.displayName,
),
subtitle: Text(
description,
),
subtitle: Column(children: descriptionWidgets),
secondary: SvgPicture.string(
service.svgIcon,
height: 24,