Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][settings] Refactor SessionsPage and ApplyCodeSheet UI components for consistency

AmanRajSinghMouryaee0fe2e86acb
diff --git a/mobile/apps/photos/lib/ui/account/sessions_page.dart b/mobile/apps/photos/lib/ui/account/sessions_page.dart
index be057b243f..5b76aedc4d 100644
--- a/mobile/apps/photos/lib/ui/account/sessions_page.dart
+++ b/mobile/apps/photos/lib/ui/account/sessions_page.dart
@@ -1,15 +1,14 @@
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
-import 'package:photos/ente_theme_data.dart';
import 'package:photos/gateways/users/models/sessions.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/services/account/user_service.dart';
-import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/common/loading_widget.dart';
-import "package:photos/ui/components/alert_bottom_sheet.dart";
import 'package:photos/ui/notification/toast.dart';
+import "package:photos/ui/settings/components/settings_page_scaffold.dart";
import 'package:photos/utils/dialog_util.dart';
class SessionsPage extends StatefulWidget {
@@ -36,34 +35,34 @@ class _SessionsPageState extends State<SessionsPage> {
@override
Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(AppLocalizations.of(context).activeSessions),
- ),
- body: _getBody(),
+ return SettingsPageScaffold(
+ title: AppLocalizations.of(context).activeSessions,
+ padding: EdgeInsets.zero,
+ children: _getBodyChildren(context),
);
}
- Widget _getBody() {
+ List<Widget> _getBodyChildren(BuildContext context) {
if (_sessions == null) {
- return const Center(child: EnteLoadingWidget());
- }
- final List<Widget> rows = [];
- rows.add(const Padding(padding: EdgeInsets.all(4)));
- for (final session in _sessions!.sessions) {
- rows.add(_getSessionWidget(session));
+ return [
+ SizedBox(
+ height: MediaQuery.sizeOf(context).height / 2,
+ child: const Center(child: EnteLoadingWidget()),
+ ),
+ ];
}
- return SingleChildScrollView(
- child: Column(
- children: rows,
- ),
- );
+
+ return [
+ const SizedBox(height: Spacing.xs),
+ for (final session in _sessions!.sessions) _getSessionWidget(session),
+ ];
}
Widget _getSessionWidget(Session session) {
- final lastUsedTime =
- DateTime.fromMicrosecondsSinceEpoch(session.lastUsedTime);
+ final colors = context.componentColors;
+ final lastUsedTime = DateTime.fromMicrosecondsSinceEpoch(
+ session.lastUsedTime,
+ );
return Column(
children: [
InkWell(
@@ -83,12 +82,8 @@ class _SessionsPageState extends State<SessionsPage> {
Flexible(
child: Text(
session.ip,
- style: TextStyle(
- color: Theme.of(context)
- .colorScheme
- .onSurface
- .withValues(alpha: 0.8),
- fontSize: 14,
+ style: TextStyles.body.copyWith(
+ color: colors.textLight,
),
),
),
@@ -96,12 +91,8 @@ class _SessionsPageState extends State<SessionsPage> {
Flexible(
child: Text(
getFormattedTime(lastUsedTime, context: context),
- style: TextStyle(
- color: Theme.of(context)
- .colorScheme
- .onSurface
- .withValues(alpha: 0.8),
- fontSize: 12,
+ style: TextStyles.mini.copyWith(
+ color: colors.textLight,
),
),
),
@@ -112,15 +103,17 @@ class _SessionsPageState extends State<SessionsPage> {
),
),
Divider(
- color: getEnteColorScheme(context).strokeFaint,
+ color: colors.strokeFaint,
),
],
);
}
Future<void> _terminateSession(Session session) async {
- final dialog =
- createProgressDialog(context, AppLocalizations.of(context).pleaseWait);
+ final dialog = createProgressDialog(
+ context,
+ AppLocalizations.of(context).pleaseWait,
+ );
await dialog.show();
try {
await UserService.instance.terminateSession(session.token);
@@ -130,11 +123,11 @@ class _SessionsPageState extends State<SessionsPage> {
await dialog.hide();
_logger.severe('failed to terminate');
// ignore: unawaited_futures
- showAlertBottomSheet(
- context,
+ showErrorBottomSheetComponent<void>(
+ context: context,
title: AppLocalizations.of(context).oops,
message: AppLocalizations.of(context).somethingWentWrongPleaseTryAgain,
- assetPath: 'assets/warning-green.png',
+ illustration: Image.asset("assets/warning-grey.png"),
);
}
}
@@ -155,85 +148,54 @@ class _SessionsPageState extends State<SessionsPage> {
}
void _showSessionTerminationDialog(Session session) {
+ final l10n = AppLocalizations.of(context);
final isLoggingOutFromThisDevice =
session.token == Configuration.instance.getToken();
- Widget text;
- if (isLoggingOutFromThisDevice) {
- text = Text(
- AppLocalizations.of(context).thisWillLogYouOutOfThisDevice,
- );
- } else {
- text = SingleChildScrollView(
- child: Column(
- children: [
- Text(
- AppLocalizations.of(context)
- .thisWillLogYouOutOfTheFollowingDevice,
- ),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- session.ua,
- style: Theme.of(context).textTheme.bodySmall,
- ),
- ],
- ),
- );
- }
- final AlertDialog alert = AlertDialog(
- title: Text(AppLocalizations.of(context).terminateSession),
- content: text,
- actions: [
- TextButton(
- child: Text(
- AppLocalizations.of(context).terminate,
- style: const TextStyle(
- color: Colors.red,
- ),
- ),
- onPressed: () async {
- Navigator.of(context).pop('dialog');
- if (isLoggingOutFromThisDevice) {
- await UserService.instance.logout(context);
- } else {
- await _terminateSession(session);
- }
- },
- ),
- TextButton(
- child: Text(
- AppLocalizations.of(context).cancel,
- style: TextStyle(
- color: isLoggingOutFromThisDevice
- ? Theme.of(context).colorScheme.greenAlternative
- : Theme.of(context).colorScheme.defaultTextColor,
- ),
- ),
- onPressed: () {
- Navigator.of(context).pop('dialog');
- },
- ),
- ],
- );
+ final message = isLoggingOutFromThisDevice
+ ? l10n.thisWillLogYouOutOfThisDevice
+ : "${l10n.thisWillLogYouOutOfTheFollowingDevice}\n\n${session.ua}";
- showDialog(
- useRootNavigator: false,
+ showBottomSheetComponent<void>(
context: context,
- builder: (BuildContext context) {
- return alert;
+ builder: (sheetContext) {
+ return BottomSheetComponent(
+ title: l10n.terminateSession,
+ message: message,
+ illustration: Image.asset("assets/warning-grey.png"),
+ actions: [
+ ButtonComponent(
+ label: l10n.terminate,
+ variant: ButtonComponentVariant.critical,
+ onTap: () async {
+ Navigator.of(sheetContext).pop();
+ if (isLoggingOutFromThisDevice) {
+ await UserService.instance.logout(context);
+ } else {
+ await _terminateSession(session);
+ }
+ },
+ ),
+ ],
+ );
},
);
}
Widget _getUAWidget(Session session) {
+ final colors = context.componentColors;
if (session.token == Configuration.instance.getToken()) {
return Text(
AppLocalizations.of(context).thisDevice,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Theme.of(context).colorScheme.greenAlternative,
+ style: TextStyles.bodyBold.copyWith(
+ color: colors.primary,
),
);
}
- return Text(session.prettyUA);
+ return Text(
+ session.prettyUA,
+ style: TextStyles.bodyBold.copyWith(
+ color: colors.textBase,
+ ),
+ );
}
}
diff --git a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
index 5b5f54cf34..906d5175f8 100644
--- a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
@@ -1,4 +1,5 @@
import "package:dio/dio.dart";
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:logging/logging.dart";
@@ -6,8 +7,6 @@ import "package:photos/gateways/storage_bonus/models/storage_bonus.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/user_details.dart";
import "package:photos/service_locator.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/components/base_bottom_sheet.dart";
import "package:photos/ui/growth/code_success_screen.dart";
Future<bool?> showApplyCodeSheet(
@@ -15,13 +14,15 @@ Future<bool?> showApplyCodeSheet(
required ReferralView referralView,
required UserDetails userDetails,
}) {
- return showBaseBottomSheet<bool>(
- context,
- title: AppLocalizations.of(context).applyCodeTitle,
- headerSpacing: 20,
- child: _ApplyCodeContent(
- referralView: referralView,
- userDetails: userDetails,
+ return showBottomSheetComponent<bool>(
+ context: context,
+ builder: (_) => BottomSheetComponent(
+ title: AppLocalizations.of(context).applyCodeTitle,
+ isKeyboardAware: true,
+ content: _ApplyCodeContent(
+ referralView: referralView,
+ userDetails: userDetails,
+ ),
),
);
}
@@ -42,7 +43,6 @@ class _ApplyCodeContent extends StatefulWidget {
class _ApplyCodeContentState extends State<_ApplyCodeContent> {
late TextEditingController _controller;
late FocusNode _codeFocusNode;
- bool _isLoading = false;
String? _errorMessage;
@override
@@ -82,10 +82,7 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
return;
}
- setState(() {
- _isLoading = true;
- _errorMessage = null;
- });
+ setState(() => _errorMessage = null);
try {
await storageBonusService.applyCode(code);
@@ -120,96 +117,34 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
_errorMessage = errorMessage;
});
}
- } finally {
- if (mounted) {
- setState(() {
- _isLoading = false;
- });
- }
}
}
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final isDarkMode = Theme.of(context).brightness == Brightness.dark;
-
- final inputBackgroundColor =
- isDarkMode ? const Color(0xFF1C1C1C) : const Color(0xFFFAFAFA);
-
- const greenColor = Color(0xFF08C225);
- const warningRedColor = Color(0xFFF63A3A);
+ final l10n = AppLocalizations.of(context);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- // Text input field
- Container(
- decoration: BoxDecoration(
- color: inputBackgroundColor,
- borderRadius: BorderRadius.circular(16),
- ),
- child: TextField(
- controller: _controller,
- focusNode: _codeFocusNode,
- inputFormatters: [UpperCaseTextFormatter()],
- textCapitalization: TextCapitalization.characters,
- style: textTheme.body,
- decoration: InputDecoration(
- border: InputBorder.none,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 20,
- ),
- hintText: AppLocalizations.of(context).enterReferralCode,
- hintStyle: textTheme.body.copyWith(color: colorScheme.textMuted),
- ),
- ),
+ TextInputComponent(
+ controller: _controller,
+ focusNode: _codeFocusNode,
+ inputFormatters: [UpperCaseTextFormatter()],
+ textCapitalization: TextCapitalization.characters,
+ hintText: l10n.enterReferralCode,
+ message: _errorMessage ?? l10n.enterCodeDescription,
+ messageType: _errorMessage == null
+ ? TextInputComponentMessageType.helper
+ : TextInputComponentMessageType.error,
+ autocorrect: false,
),
- const SizedBox(height: 9),
- // Helper/error text
- Text(
- _errorMessage ?? AppLocalizations.of(context).enterCodeDescription,
- style: textTheme.mini.copyWith(
- color:
- _errorMessage != null ? warningRedColor : colorScheme.textMuted,
- ),
- ),
- const SizedBox(height: 20),
- // Apply button
- SizedBox(
- width: double.infinity,
- height: 56,
- child: ElevatedButton(
- onPressed: _isLoading || !_isValid ? null : _applyCode,
- style: ElevatedButton.styleFrom(
- backgroundColor: _isValid ? greenColor : colorScheme.fillMuted,
- foregroundColor: Colors.white,
- disabledBackgroundColor: colorScheme.fillMuted,
- disabledForegroundColor: colorScheme.textMuted,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
- ),
- elevation: 0,
- ),
- child: _isLoading
- ? SizedBox(
- width: 24,
- height: 24,
- child: CircularProgressIndicator(
- strokeWidth: 2,
- color: colorScheme.textMuted,
- ),
- )
- : Text(
- AppLocalizations.of(context).apply,
- style: textTheme.bodyBold.copyWith(
- color: _isValid ? Colors.white : colorScheme.textMuted,
- ),
- ),
- ),
+ const SizedBox(height: Spacing.lg),
+ ButtonComponent(
+ label: l10n.apply,
+ isDisabled: !_isValid,
+ onTap: _applyCode,
),
],
);
diff --git a/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart b/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
index 3fe29a78e2..fa972ad771 100644
--- a/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
@@ -2,11 +2,11 @@ import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/service_locator.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/web_page.dart";
-import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/settings/app_update_dialog.dart";
+import "package:photos/ui/settings/components/settings_item.dart";
+import "package:photos/ui/settings/components/settings_page_scaffold.dart";
import "package:photos/utils/dialog_util.dart";
import "package:url_launcher/url_launcher.dart";
@@ -15,152 +15,77 @@ class AboutUsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final isDarkMode = Theme.of(context).brightness == Brightness.dark;
+ final l10n = AppLocalizations.of(context);
- final pageBackgroundColor =
- isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
-
- return Scaffold(
- backgroundColor: pageBackgroundColor,
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 24),
- GestureDetector(
- onTap: () => Navigator.of(context).pop(),
- child: Icon(
- Icons.arrow_back,
- color: colorScheme.strokeBase,
- size: 24,
- ),
+ return SettingsPageScaffold(
+ title: l10n.about,
+ children: [
+ SettingsItem(
+ title: l10n.weAreOpenSource,
+ icon: HugeIcons.strokeRoundedGithub,
+ showOnlyLoadingState: true,
+ onTap: () async {
+ await launchUrl(Uri.parse("https://github.com/ente-io/ente"));
+ },
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.blog,
+ icon: HugeIcons.strokeRoundedPencilEdit01,
+ showOnlyLoadingState: true,
+ onTap: () async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return WebPage(l10n.blog, "https://ente.com/blog");
+ },
),
- const SizedBox(height: 24),
- Text(
- AppLocalizations.of(context).about,
- style: textTheme.h3Bold,
+ );
+ },
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.privacy,
+ icon: HugeIcons.strokeRoundedShield01,
+ showOnlyLoadingState: true,
+ onTap: () async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return WebPage(l10n.privacy, "https://ente.com/privacy");
+ },
),
- const SizedBox(height: 24),
- Expanded(
- child: SingleChildScrollView(
- child: Column(
- children: [
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).weAreOpenSource,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedGithub,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await launchUrl(
- Uri.parse("https://github.com/ente-io/ente"),
- );
- },
- ),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).blog,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedPencilEdit01,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return WebPage(
- AppLocalizations.of(context).blog,
- "https://ente.com/blog",
- );
- },
- ),
- );
- },
- ),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).privacy,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedShield01,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return WebPage(
- AppLocalizations.of(context).privacy,
- "https://ente.com/privacy",
- );
- },
- ),
- );
- },
- ),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title:
- AppLocalizations.of(context).termsOfServicesTitle,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedFile01,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return WebPage(
- AppLocalizations.of(context)
- .termsOfServicesTitle,
- "https://ente.com/terms",
- );
- },
- ),
- );
- },
- ),
- if (updateService.isIndependent()) ...[
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).checkForUpdates,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedDownload04,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async => _checkForUpdates(context),
- ),
- ],
- ],
- ),
- ),
+ );
+ },
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.termsOfServicesTitle,
+ icon: HugeIcons.strokeRoundedFile01,
+ showOnlyLoadingState: true,
+ onTap: () async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return WebPage(
+ l10n.termsOfServicesTitle,
+ "https://ente.com/terms",
+ );
+ },
),
- ],
- ),
+ );
+ },
),
- ),
- );
- }
-
- Widget _buildIconWidget(BuildContext context, List<List<dynamic>> icon) {
- final colorScheme = getEnteColorScheme(context);
- return HugeIcon(
- icon: icon,
- color: colorScheme.menuItemIconStroke,
- size: 20,
+ if (updateService.isIndependent()) ...[
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.checkForUpdates,
+ icon: HugeIcons.strokeRoundedDownload04,
+ showOnlyLoadingState: true,
+ onTap: () async => _checkForUpdates(context),
+ ),
+ ],
+ ],
);
}
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
index 5032e492df..cc3e6c41be 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
@@ -3,7 +3,9 @@ import "dart:async";
import "dart:collection";
import "package:collection/collection.dart";
+import "package:ente_components/ente_components.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/backup_updated_event.dart";
import "package:photos/events/file_uploaded_event.dart";
@@ -12,7 +14,6 @@ import "package:photos/models/backup/backup_item.dart";
import "package:photos/models/backup/backup_item_status.dart";
import "package:photos/models/file/extensions/file_props.dart";
import "package:photos/services/search_service.dart";
-import "package:photos/ui/components/title_bar_widget.dart";
import "package:photos/ui/settings/backup/backup_item_card.dart";
import "package:photos/utils/file_uploader.dart";
@@ -56,8 +57,9 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
(a, b) => (b.file.uploadedFileID!).compareTo(a.file.uploadedFileID!),
)
.toList();
- _fileUploadedSubscription =
- Bus.instance.on<FileUploadedEvent>().listen((event) {
+ _fileUploadedSubscription = Bus.instance.on<FileUploadedEvent>().listen((
+ event,
+ ) {
result!.insert(
0,
BackupItem(
@@ -73,8 +75,9 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
}
void checkBackupUpdatedEvent() {
- _backupUpdatedSubscription =
- Bus.instance.on<BackupUpdatedEvent>().listen((event) {
+ _backupUpdatedSubscription = Bus.instance.on<BackupUpdatedEvent>().listen((
+ event,
+ ) {
items = event.items;
safeSetState();
});
@@ -96,8 +99,8 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
@override
Widget build(BuildContext context) {
final List<BackupItem> items = this.items.values.toList().sorted(
- (a, b) => a.status.index.compareTo(b.status.index),
- );
+ (a, b) => a.status.index.compareTo(b.status.index),
+ );
final allItems = <BackupItem>[
...items.where(
@@ -107,54 +110,21 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
];
return Scaffold(
- appBar: AppBar(
- leadingWidth: 32,
- title: TitleWidget(
- title: AppLocalizations.of(context).backupStatus,
- caption: null,
- isTitleH2WithoutLeading: false,
- ),
- ),
- body: allItems.isEmpty
- ? Padding(
+ backgroundColor: context.componentColors.backgroundBase,
+ body: AppBarComponent(
+ title: AppLocalizations.of(context).backupStatus,
+ slivers: [
+ if (allItems.isEmpty)
+ const SliverFillRemaining(
+ hasScrollBody: false,
+ child: _EmptyBackupStatus(),
+ )
+ else
+ SliverPadding(
padding: const EdgeInsets.symmetric(
- horizontal: 60,
- vertical: 12,
+ horizontal: Spacing.lg,
),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Icon(
- Icons.cloud_upload_outlined,
- color: Theme.of(context).brightness == Brightness.light
- ? const Color.fromRGBO(0, 0, 0, 0.6)
- : const Color.fromRGBO(255, 255, 255, 0.6),
- ),
- const SizedBox(height: 16),
- Text(
- AppLocalizations.of(context).backupStatusDescription,
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16,
- height: 20 / 16,
- color: Theme.of(context).brightness == Brightness.light
- ? const Color(0xFF000000).withValues(alpha: 0.7)
- : const Color(0xFFFFFFFF).withValues(alpha: 0.7),
- ),
- ),
- const SizedBox(height: 48),
- ],
- ),
- )
- : Scrollbar(
- child: ListView.builder(
- padding: const EdgeInsets.symmetric(
- vertical: 20,
- horizontal: 16,
- ),
- shrinkWrap: false,
- primary: true,
- prototypeItem: Container(height: 70),
+ sliver: SliverList.builder(
itemBuilder: (context, index) {
return BackupItemCard(
item: allItems[index],
@@ -164,6 +134,40 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
itemCount: allItems.length,
),
),
+ ],
+ ),
+ );
+ }
+}
+
+class _EmptyBackupStatus extends StatelessWidget {
+ const _EmptyBackupStatus();
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ return Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 60,
+ vertical: Spacing.md,
+ ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ HugeIcon(
+ icon: HugeIcons.strokeRoundedCloudUpload,
+ color: colors.textLight,
+ size: IconSizes.medium,
+ ),
+ const SizedBox(height: Spacing.lg),
+ Text(
+ AppLocalizations.of(context).backupStatusDescription,
+ textAlign: TextAlign.center,
+ style: TextStyles.large.copyWith(color: colors.textLight),
+ ),
+ const SizedBox(height: 48),
+ ],
+ ),
);
}
}