From 887302f93656ff7a787e7bfe83dfef53115c31e3 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sat, 16 Sep 2023 01:41:02 -0300 Subject: [PATCH] refactor(ui): Add measure units to 'Extending volume' page - Resolves https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/301 --- assets/translations/en.json | 3 ++- lib/ui/pages/server_storage/extending_volume.dart | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 5fb1ce5c..07ffe375 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -304,6 +304,7 @@ "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.", "extending_volume_error": "Couldn't initialize volume extending.", "size": "Size", + "price": "Price", "data_migration_title": "Data migration", "data_migration_notice": "During migration all services will be turned off.", "start_migration_button": "Start migration", @@ -625,4 +626,4 @@ "reset_onboarding_description": "Reset onboarding switch to show onboarding screen again", "cubit_statuses": "Cubit loading statuses" } -} +} \ No newline at end of file diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 95325d0c..81414bdb 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -79,10 +79,12 @@ class _ExtendingVolumePageState extends State { } final price = snapshot.data as Price; _pricePerGb = price.value; - _sizeController.text = _currentSliderGbValue.truncate().toString(); + final currentSizeValue = _currentSliderGbValue.truncate().toString(); + _sizeController.text = 'storage.gb'.tr(args: [currentSizeValue]); _priceController.text = - (_pricePerGb * double.parse(_sizeController.text)) - .toStringAsFixed(2); + '${(_pricePerGb * double.parse(currentSizeValue)).toStringAsFixed(2)}' + ' ' + '${price.currency.shortcode}'; minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(3); if (_currentSliderGbValue < 0) { @@ -130,7 +132,7 @@ class _ExtendingVolumePageState extends State { decoration: InputDecoration( border: const OutlineInputBorder(), errorText: _isError ? ' ' : null, - labelText: price.currency.shortcode, + labelText: 'storage.price'.tr(), ), ), ),