π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Usage card
AmanRajSinghMourya569c2655ca71
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex 5bec230b2b..35b1aab771 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -781,5 +781,20 @@"example": "3"}}+ },+ "usage": "Usage",+ "fileCount": "{used} / {max}",+ "@fileCount": {+ "description": "Display file count usage in the format 'used / max'",+ "placeholders": {+ "used": {+ "type": "String",+ "example": "8"+ },+ "max": {+ "type": "String",+ "example": "1,000"+ }+ }}}diff --git a/mobile/apps/locker/lib/ui/components/usage_card_widget.dart b/mobile/apps/locker/lib/ui/components/usage_card_widget.dartnew file mode 100644index 0000000000..a44521f96e--- /dev/null+++ b/mobile/apps/locker/lib/ui/components/usage_card_widget.dart@@ -0,0 +1,123 @@+import 'dart:async';++import "package:ente_accounts/ente_accounts.dart";+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';+import "package:hugeicons/hugeicons.dart";+import 'package:intl/intl.dart';+import "package:locker/l10n/l10n.dart";++class UsageCardWidget extends StatefulWidget {+ const UsageCardWidget({+ super.key,+ });++ @override+ State<UsageCardWidget> createState() => _UsageCardWidgetState();+}++class _UsageCardWidgetState extends State<UsageCardWidget> {+ static const maxFileCount = 1000;+ int? _fileCount;++ @override+ void initState() {+ super.initState();+ _loadFileCount();+ }++ Future<void> _loadFileCount() async {+ final userDetails = await UserService.instance.getUserDetailsV2(+ memoryCount: true,+ shouldCache: true,+ );+ setState(() {+ _fileCount = userDetails.fileCount;+ });+ }++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final usedCount = _fileCount ?? 0;+ final progress = maxFileCount > 0 ? usedCount / maxFileCount : 0.0;++ return Container(+ padding: const EdgeInsets.symmetric(+ horizontal: 12,+ vertical: 14,+ ),+ decoration: BoxDecoration(+ color: colorScheme.primary700,+ borderRadius: BorderRadius.circular(20),+ ),+ child: Row(+ children: [+ Container(+ width: 40,+ height: 40,+ decoration: BoxDecoration(+ color: Colors.black.withValues(alpha: 0.04),+ borderRadius: BorderRadius.circular(12),+ ),+ padding: const EdgeInsets.all(8.0),+ child: const HugeIcon(+ icon: HugeIcons.strokeRoundedCloudUpload,+ ),+ ),+ const SizedBox(width: 12),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ Text(+ context.l10n.usage,+ style: textTheme.bodyBold.copyWith(+ color: Colors.white,+ ),+ ),+ _fileCount != null+ ? Text(+ context.l10n.fileCount(+ NumberFormat().format(usedCount),+ NumberFormat().format(maxFileCount),+ ),+ style: textTheme.smallMuted,+ )+ : SizedBox(+ width: 60,+ height: 12,+ child: EnteLoadingWidget(+ color: Colors.white.withValues(alpha: 0.6),+ ),+ ),+ ],+ ),+ const SizedBox(height: 8),+ ClipRRect(+ borderRadius: BorderRadius.circular(2),+ child: SizedBox(+ height: 6,+ child: LinearProgressIndicator(+ value: progress,+ backgroundColor: Colors.white.withValues(alpha: 0.2),+ valueColor: const AlwaysStoppedAnimation<Color>(+ Colors.white,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/settings_page.dart b/mobile/apps/locker/lib/ui/pages/settings_page.dartindex 60bf1cd3f6..fdd3ed7745 100644--- a/mobile/apps/locker/lib/ui/pages/settings_page.dart+++ b/mobile/apps/locker/lib/ui/pages/settings_page.dart@@ -6,14 +6,15 @@ import "package:ente_ui/theme/ente_theme.dart";import "package:flutter/foundation.dart";import "package:flutter/material.dart";import "package:locker/services/configuration.dart";+import "package:locker/ui/components/usage_card_widget.dart";import "package:locker/ui/settings/about_section_widget.dart";import 'package:locker/ui/settings/account_section_widget.dart';import "package:locker/ui/settings/app_version_widget.dart";import "package:locker/ui/settings/security_section_widget.dart";+import "package:locker/ui/settings/settings_title_bar_widget.dart";import "package:locker/ui/settings/social_section_widget.dart";import "package:locker/ui/settings/support_section_widget.dart";import "package:locker/ui/settings/theme_switch_widget.dart";-import "package:locker/ui/settings/title_bar_widget.dart";class SettingsPage extends StatelessWidget {final ValueNotifier<String?> emailNotifier;@@ -70,6 +71,8 @@ class SettingsPage extends StatelessWidget {),);contents.addAll([+ const SizedBox(height: 12),+ const UsageCardWidget(),const SizedBox(height: 12),const AccountSectionWidget(),sectionSpacing,diff --git a/mobile/apps/locker/lib/ui/settings/title_bar_widget.dart b/mobile/apps/locker/lib/ui/settings/settings_title_bar_widget.dartsimilarity index 100%rename from mobile/apps/locker/lib/ui/settings/title_bar_widget.dartrename to mobile/apps/locker/lib/ui/settings/settings_title_bar_widget.dart