style(backups): Fix some UI issues of backup_details.dart

This commit is contained in:
Inex Code 2023-07-03 23:37:23 +03:00
parent a4dbba0968
commit 7d974159a2

View file

@ -20,35 +20,25 @@ import 'package:selfprivacy/ui/pages/backups/create_backups_modal.dart';
import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/ui/router/router.dart';
import 'package:selfprivacy/utils/extensions/duration.dart'; import 'package:selfprivacy/utils/extensions/duration.dart';
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
@RoutePage() @RoutePage()
class BackupDetailsPage extends StatefulWidget { class BackupDetailsPage extends StatelessWidget {
const BackupDetailsPage({super.key}); const BackupDetailsPage({super.key});
@override
State<BackupDetailsPage> createState() => _BackupDetailsPageState();
}
class _BackupDetailsPageState extends State<BackupDetailsPage>
with SingleTickerProviderStateMixin {
@override @override
Widget build(final BuildContext context) { Widget build(final BuildContext context) {
final bool isReady = context.watch<ServerInstallationCubit>().state final bool isReady = context.watch<ServerInstallationCubit>().state
is ServerInstallationFinished; is ServerInstallationFinished;
final bool isBackupInitialized = final BackupsState backupsState = context.watch<BackupsCubit>().state;
context.watch<BackupsCubit>().state.isInitialized; final bool isBackupInitialized = backupsState.isInitialized;
final StateType providerState = isReady && isBackupInitialized final StateType providerState = isReady && isBackupInitialized
? StateType.stable ? StateType.stable
: StateType.uninitialized; : StateType.uninitialized;
final bool preventActions = final bool preventActions = backupsState.preventActions;
context.watch<BackupsCubit>().state.preventActions; final List<Backup> backups = backupsState.backups;
final List<Backup> backups = context.watch<BackupsCubit>().state.backups; final bool refreshing = backupsState.refreshing;
final bool refreshing = context.watch<BackupsCubit>().state.refreshing;
final List<Service> services = final List<Service> services =
context.watch<ServicesCubit>().state.servicesThatCanBeBackedUp; context.watch<ServicesCubit>().state.servicesThatCanBeBackedUp;
final Duration? autobackupPeriod = final Duration? autobackupPeriod = backupsState.autobackupPeriod;
context.watch<BackupsCubit>().state.autobackupPeriod;
final List<ServerJob> backupJobs = context final List<ServerJob> backupJobs = context
.watch<ServerJobsCubit>() .watch<ServerJobsCubit>()
.state .state
@ -121,7 +111,6 @@ class _BackupDetailsPageState extends State<BackupDetailsPage>
onTap: preventActions onTap: preventActions
? null ? null
: () { : () {
// await context.read<BackupsCubit>().createBackup();
showModalBottomSheet( showModalBottomSheet(
useRootNavigator: true, useRootNavigator: true,
context: context, context: context,
@ -177,9 +166,6 @@ class _BackupDetailsPageState extends State<BackupDetailsPage>
), ),
], ],
), ),
// Card with a list of existing backups
// Each list item has a date
// When clicked, starts the restore action
if (isBackupInitialized) if (isBackupInitialized)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,