From 7d974159a238e1041e0a37c3d45cfb5c291f1713 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 3 Jul 2023 23:37:23 +0300 Subject: [PATCH] style(backups): Fix some UI issues of backup_details.dart --- lib/ui/pages/backups/backup_details.dart | 28 ++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/lib/ui/pages/backups/backup_details.dart b/lib/ui/pages/backups/backup_details.dart index 0e23e2fe..e3fe427b 100644 --- a/lib/ui/pages/backups/backup_details.dart +++ b/lib/ui/pages/backups/backup_details.dart @@ -20,35 +20,25 @@ import 'package:selfprivacy/ui/pages/backups/create_backups_modal.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/extensions/duration.dart'; -GlobalKey navigatorKey = GlobalKey(); - @RoutePage() -class BackupDetailsPage extends StatefulWidget { +class BackupDetailsPage extends StatelessWidget { const BackupDetailsPage({super.key}); - @override - State createState() => _BackupDetailsPageState(); -} - -class _BackupDetailsPageState extends State - with SingleTickerProviderStateMixin { @override Widget build(final BuildContext context) { final bool isReady = context.watch().state is ServerInstallationFinished; - final bool isBackupInitialized = - context.watch().state.isInitialized; + final BackupsState backupsState = context.watch().state; + final bool isBackupInitialized = backupsState.isInitialized; final StateType providerState = isReady && isBackupInitialized ? StateType.stable : StateType.uninitialized; - final bool preventActions = - context.watch().state.preventActions; - final List backups = context.watch().state.backups; - final bool refreshing = context.watch().state.refreshing; + final bool preventActions = backupsState.preventActions; + final List backups = backupsState.backups; + final bool refreshing = backupsState.refreshing; final List services = context.watch().state.servicesThatCanBeBackedUp; - final Duration? autobackupPeriod = - context.watch().state.autobackupPeriod; + final Duration? autobackupPeriod = backupsState.autobackupPeriod; final List backupJobs = context .watch() .state @@ -121,7 +111,6 @@ class _BackupDetailsPageState extends State onTap: preventActions ? null : () { - // await context.read().createBackup(); showModalBottomSheet( useRootNavigator: true, context: context, @@ -177,9 +166,6 @@ class _BackupDetailsPageState extends State ), ], ), - // Card with a list of existing backups - // Each list item has a date - // When clicked, starts the restore action if (isBackupInitialized) Column( crossAxisAlignment: CrossAxisAlignment.start,