From 4ad43ff1fdd873d44eff42c8a7b1b84be52fbc0d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 Apr 2024 23:38:24 +0400 Subject: [PATCH 1/4] feat(backups): Show how much space a service uses on backup - Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/434 --- .../pages/backups/create_backups_modal.dart | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/ui/pages/backups/create_backups_modal.dart b/lib/ui/pages/backups/create_backups_modal.dart index f78e1075..eb201f40 100644 --- a/lib/ui/pages/backups/create_backups_modal.dart +++ b/lib/ui/pages/backups/create_backups_modal.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:selfprivacy/logic/bloc/backups/backups_bloc.dart'; import 'package:selfprivacy/logic/bloc/server_jobs/server_jobs_bloc.dart'; +import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; import 'package:selfprivacy/logic/models/service.dart'; @@ -103,6 +104,23 @@ class _CreateBackupsModalState extends State { ...widget.services.map( (final Service service) { final bool busy = busyServices.contains(service.id); + String description; + if (busy) { + description = 'backup.service_busy'.tr(); + } else { + description = service.backupDescription; + description += '\n'; + description += 'service_page.uses'.tr( + namedArgs: { + 'usage': service.storageUsage.used.toString(), + 'volume': context + .read() + .state + .getVolume(service.storageUsage.volume ?? '') + .displayName, + }, + ); + } return CheckboxListTile.adaptive( onChanged: !busy ? (final bool? value) { @@ -123,7 +141,7 @@ class _CreateBackupsModalState extends State { service.displayName, ), subtitle: Text( - busy ? 'backup.service_busy'.tr() : service.backupDescription, + description, ), secondary: SvgPicture.string( service.svgIcon, -- 2.42.0 From 8a757a70ea8e9787317cb93de97100bb73afe53c Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 17 Apr 2024 20:13:06 +0400 Subject: [PATCH 2/4] fix(backups): Remove '\n' and replace with a list of widgets - Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/434 --- .../pages/backups/create_backups_modal.dart | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/ui/pages/backups/create_backups_modal.dart b/lib/ui/pages/backups/create_backups_modal.dart index eb201f40..b2e3e414 100644 --- a/lib/ui/pages/backups/create_backups_modal.dart +++ b/lib/ui/pages/backups/create_backups_modal.dart @@ -104,21 +104,29 @@ class _CreateBackupsModalState extends State { ...widget.services.map( (final Service service) { final bool busy = busyServices.contains(service.id); - String description; + final List 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() - .state - .getVolume(service.storageUsage.volume ?? '') - .displayName, - }, + descriptionWidgets.add( + Text( + 'service_page.uses'.tr( + namedArgs: { + 'usage': service.storageUsage.used.toString(), + 'volume': context + .read() + .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 { title: Text( service.displayName, ), - subtitle: Text( - description, - ), + subtitle: Column(children: descriptionWidgets), secondary: SvgPicture.string( service.svgIcon, height: 24, -- 2.42.0 From 0de6afd2d138ecee8fbf281648bb5a5f6c8104c2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 17 Apr 2024 21:48:28 +0400 Subject: [PATCH 3/4] fix(backups): Add text alignment to the left - Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/434 --- lib/ui/pages/backups/create_backups_modal.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ui/pages/backups/create_backups_modal.dart b/lib/ui/pages/backups/create_backups_modal.dart index b2e3e414..1ee03ace 100644 --- a/lib/ui/pages/backups/create_backups_modal.dart +++ b/lib/ui/pages/backups/create_backups_modal.dart @@ -122,9 +122,6 @@ class _CreateBackupsModalState extends State { ), ), ); - descriptionWidgets.add( - const SizedBox(height: 4), - ); descriptionWidgets.add( Text(service.backupDescription), ); @@ -148,7 +145,10 @@ class _CreateBackupsModalState extends State { title: Text( service.displayName, ), - subtitle: Column(children: descriptionWidgets), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: descriptionWidgets, + ), secondary: SvgPicture.string( service.svgIcon, height: 24, -- 2.42.0 From b2b11e89a7c06dad2990362a91bf48730d5b815b Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 24 Apr 2024 13:17:00 +0300 Subject: [PATCH 4/4] chore: Apply style to storage usage on backup creation --- lib/ui/pages/backups/create_backups_modal.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ui/pages/backups/create_backups_modal.dart b/lib/ui/pages/backups/create_backups_modal.dart index 1ee03ace..455976a7 100644 --- a/lib/ui/pages/backups/create_backups_modal.dart +++ b/lib/ui/pages/backups/create_backups_modal.dart @@ -120,6 +120,7 @@ class _CreateBackupsModalState extends State { .displayName, }, ), + style: Theme.of(context).textTheme.labelMedium, ), ); descriptionWidgets.add( -- 2.42.0