diff --git a/lib/features/manage_account/presentation/storage/storage_view.dart b/lib/features/manage_account/presentation/storage/storage_view.dart index d9ecfb8dc..ab1ae82d2 100644 --- a/lib/features/manage_account/presentation/storage/storage_view.dart +++ b/lib/features/manage_account/presentation/storage/storage_view.dart @@ -59,32 +59,37 @@ class StorageView extends GetWidget { textAlign: TextAlign.center, ), Expanded( - child: Padding( - padding: _getPadding(isMobile: isMobile, isDesktop: isDesktop), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Obx(() { - final octetsQuota = controller.octetsQuota.value; - if (octetsQuota != null && octetsQuota.storageAvailable) { - return StorageProgressBarWidget( - imagePaths: controller.imagePaths, - quota: octetsQuota, - isMobile: isMobile, - ); - } else { - return const SizedBox.shrink(); - } - }), - UpgradeStorageWidget( - imagePaths: controller.imagePaths, - isMobile: isMobile, - onUpgradeStorageAction: controller.onUpgradeStorage, - ) - ], - ), - ), + child: Obx(() { + final octetsQuota = controller.octetsQuota.value; + if (octetsQuota != null && octetsQuota.storageAvailable) { + return SingleChildScrollView( + child: Padding( + padding: _getPadding( + isMobile: isMobile, + isDesktop: isDesktop, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + StorageProgressBarWidget( + imagePaths: controller.imagePaths, + quota: octetsQuota, + isMobile: isMobile, + ), + UpgradeStorageWidget( + imagePaths: controller.imagePaths, + isMobile: isMobile, + onUpgradeStorageAction: controller.onUpgradeStorage, + ) + ], + ), + ), + ); + } else { + return const SizedBox.shrink(); + } + }), ), ], ), diff --git a/lib/features/quotas/domain/extensions/quota_extensions.dart b/lib/features/quotas/domain/extensions/quota_extensions.dart index 457c76a1e..3cf04437a 100644 --- a/lib/features/quotas/domain/extensions/quota_extensions.dart +++ b/lib/features/quotas/domain/extensions/quota_extensions.dart @@ -15,9 +15,7 @@ extension QuotasExtensions on Quota { String get hardLimitStorageAsString => presentationHardLimit != null ? filesize(presentationHardLimit!.value) : ''; String get quotaAvailableStorageAsString { - if (used != null && - presentationHardLimit != null && - presentationHardLimit!.value > used!.value) { + if (storageAvailable && presentationHardLimit!.value > used!.value) { return filesize(presentationHardLimit!.value - used!.value); } return '0 B'; @@ -25,14 +23,14 @@ extension QuotasExtensions on Quota { bool get isWarnLimitReached { if (used != null && warnLimit != null) { - return used!.value >= warnLimit!.value * 0.9; + return used!.value >= warnLimit!.value; } else { return false; } } bool get isHardLimitReached { - if (used != null && presentationHardLimit != null) { + if (storageAvailable) { return used!.value >= presentationHardLimit!.value; } else { return false; @@ -40,8 +38,8 @@ extension QuotasExtensions on Quota { } double get usedStoragePercent { - if (used != null && hardLimit != null && hardLimit!.value > 0) { - return used!.value / hardLimit!.value; + if (storageAvailable && presentationHardLimit!.value > 0) { + return used!.value / presentationHardLimit!.value; } else { return 0; } @@ -51,6 +49,14 @@ extension QuotasExtensions on Quota { bool get storageAvailable => used != null && presentationHardLimit != null; + bool get isStorageUsageIndicatorAppear { + if (storageAvailable) { + return used!.value <= presentationHardLimit!.value * 0.8; + } else { + return false; + } + } + String getQuotasStateTitle(BuildContext context) { if (isHardLimitReached) { return '${AppLocalizations.of(context).textQuotasOutOfStorage}' @@ -87,14 +93,4 @@ extension QuotasExtensions on Quota { return ''; } } - - Color getQuotaBannerMessageColor() { - if (isHardLimitReached) { - return AppColor.colorQuotaError; - } else if (isWarnLimitReached) { - return AppColor.colorQuotaWarning; - } else { - return Colors.black; - } - } } \ No newline at end of file diff --git a/lib/features/quotas/presentation/quotas_view.dart b/lib/features/quotas/presentation/quotas_view.dart index 4884fe146..152932c23 100644 --- a/lib/features/quotas/presentation/quotas_view.dart +++ b/lib/features/quotas/presentation/quotas_view.dart @@ -20,7 +20,7 @@ class QuotasView extends GetWidget { final octetQuota = controller.octetsQuota.value; bool isDesktop = controller.responsiveUtils.isDesktop(context); - if (octetQuota != null && octetQuota.storageAvailable) { + if (octetQuota != null && octetQuota.isStorageUsageIndicatorAppear) { return Container( padding: isDesktop ? const EdgeInsetsDirectional.only(