2022-02-03 18:06:44 +02:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2022-07-07 20:40:54 +02:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-07-06 23:12:55 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/providers/error_backup_list.provider.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/modules/login/models/authentication_state.model.dart';
|
2022-05-06 14:22:23 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/models/backup_state.model.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
2022-05-06 14:22:23 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/providers/backup.provider.dart';
|
|
|
|
import 'package:immich_mobile/routing/router.dart';
|
2022-04-03 19:31:45 +02:00
|
|
|
import 'package:immich_mobile/shared/providers/websocket.provider.dart';
|
2022-05-06 14:22:23 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/ui/backup_info_card.dart';
|
2022-07-06 23:12:55 +02:00
|
|
|
import 'package:intl/intl.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:percent_indicator/linear_percent_indicator.dart';
|
|
|
|
|
|
|
|
class BackupControllerPage extends HookConsumerWidget {
|
|
|
|
const BackupControllerPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-05-06 14:22:23 +02:00
|
|
|
BackUpState backupState = ref.watch(backupProvider);
|
2022-06-22 07:23:35 +02:00
|
|
|
AuthenticationState authenticationState = ref.watch(authenticationProvider);
|
|
|
|
bool shouldBackup = backupState.allUniqueAssets.length -
|
|
|
|
backupState.selectedAlbumsBackupAssetsIds.length ==
|
|
|
|
0
|
|
|
|
? false
|
|
|
|
: true;
|
2022-02-03 18:06:44 +02:00
|
|
|
|
|
|
|
useEffect(() {
|
2022-05-06 14:22:23 +02:00
|
|
|
if (backupState.backupProgress != BackUpProgressEnum.inProgress) {
|
2022-06-25 22:12:47 +02:00
|
|
|
ref.watch(backupProvider.notifier).getBackupInfo();
|
2022-02-03 18:06:44 +02:00
|
|
|
}
|
2022-02-13 23:10:42 +02:00
|
|
|
|
2022-06-22 07:23:35 +02:00
|
|
|
ref
|
|
|
|
.watch(websocketProvider.notifier)
|
|
|
|
.stopListenToEvent('on_upload_success');
|
2022-02-13 23:10:42 +02:00
|
|
|
return null;
|
2022-02-03 18:06:44 +02:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
Widget _buildStorageInformation() {
|
|
|
|
return ListTile(
|
|
|
|
leading: Icon(
|
|
|
|
Icons.storage_rounded,
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
),
|
|
|
|
title: const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_server_storage",
|
2022-02-03 18:06:44 +02:00
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-02-03 18:06:44 +02:00
|
|
|
subtitle: Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-05-29 05:35:45 +02:00
|
|
|
Padding(
|
2022-02-03 18:06:44 +02:00
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
2022-05-29 05:35:45 +02:00
|
|
|
child: LinearPercentIndicator(
|
2022-06-22 07:23:35 +02:00
|
|
|
padding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
2022-05-29 05:35:45 +02:00
|
|
|
barRadius: const Radius.circular(2),
|
2022-07-06 23:12:55 +02:00
|
|
|
lineHeight: 10.0,
|
2022-05-29 05:35:45 +02:00
|
|
|
percent: backupState.serverInfo.diskUsagePercentage / 100.0,
|
|
|
|
backgroundColor: Colors.grey,
|
|
|
|
progressColor: Theme.of(context).primaryColor,
|
|
|
|
),
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 12.0),
|
2022-07-07 20:40:54 +02:00
|
|
|
child: const Text('backup_controller_page_storage_format').tr(
|
|
|
|
args: [
|
|
|
|
backupState.serverInfo.diskUse,
|
|
|
|
backupState.serverInfo.diskSize
|
|
|
|
]),
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ListTile _buildBackupController() {
|
2022-07-07 20:40:54 +02:00
|
|
|
var backUpOption = authenticationState.deviceInfo.isAutoBackup
|
|
|
|
? "backup_controller_page_status_on".tr()
|
|
|
|
: "backup_controller_page_status_off".tr();
|
2022-06-22 07:23:35 +02:00
|
|
|
var isAutoBackup = authenticationState.deviceInfo.isAutoBackup;
|
2022-07-07 20:40:54 +02:00
|
|
|
var backupBtnText = authenticationState.deviceInfo.isAutoBackup
|
|
|
|
? "backup_controller_page_turn_off".tr()
|
|
|
|
: "backup_controller_page_turn_on".tr();
|
2022-02-03 18:06:44 +02:00
|
|
|
return ListTile(
|
|
|
|
isThreeLine: true,
|
|
|
|
leading: isAutoBackup
|
|
|
|
? Icon(
|
|
|
|
Icons.cloud_done_rounded,
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
)
|
|
|
|
: const Icon(Icons.cloud_off_rounded),
|
|
|
|
title: Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
backUpOption,
|
2022-02-03 18:06:44 +02:00
|
|
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
|
|
|
),
|
|
|
|
subtitle: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-07-01 03:08:49 +02:00
|
|
|
if (!isAutoBackup)
|
|
|
|
const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_desc_backup",
|
2022-07-01 03:08:49 +02:00
|
|
|
style: TextStyle(fontSize: 14),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-04-05 06:37:48 +02:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: OutlinedButton(
|
2022-05-30 00:32:30 +02:00
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
side: const BorderSide(
|
|
|
|
width: 1,
|
|
|
|
color: Color.fromARGB(255, 220, 220, 220),
|
|
|
|
),
|
|
|
|
),
|
2022-04-05 06:37:48 +02:00
|
|
|
onPressed: () {
|
2022-06-25 22:12:47 +02:00
|
|
|
if (isAutoBackup) {
|
|
|
|
ref
|
|
|
|
.read(authenticationProvider.notifier)
|
|
|
|
.setAutoBackup(false);
|
|
|
|
} else {
|
|
|
|
ref
|
|
|
|
.read(authenticationProvider.notifier)
|
|
|
|
.setAutoBackup(true);
|
|
|
|
}
|
2022-04-05 06:37:48 +02:00
|
|
|
},
|
2022-07-07 20:40:54 +02:00
|
|
|
child: Text(backupBtnText,
|
2022-06-22 07:23:35 +02:00
|
|
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
2022-04-05 06:37:48 +02:00
|
|
|
),
|
2022-02-03 18:06:44 +02:00
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-05-06 14:22:23 +02:00
|
|
|
Widget _buildSelectedAlbumName() {
|
2022-07-07 20:40:54 +02:00
|
|
|
var text = "backup_controller_page_backup_selected".tr();
|
2022-05-06 14:22:23 +02:00
|
|
|
var albums = ref.watch(backupProvider).selectedBackupAlbums;
|
|
|
|
|
|
|
|
if (albums.isNotEmpty) {
|
|
|
|
for (var album in albums) {
|
|
|
|
if (album.name == "Recent" || album.name == "Recents") {
|
2022-07-07 20:40:54 +02:00
|
|
|
text += "${album.name} (${'backup_all'.tr()}), ";
|
2022-05-06 14:22:23 +02:00
|
|
|
} else {
|
|
|
|
text += "${album.name}, ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Text(
|
|
|
|
text.trim().substring(0, text.length - 2),
|
2022-06-22 07:23:35 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.bold),
|
2022-05-06 14:22:23 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_none_selected".tr(),
|
2022-06-22 07:23:35 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.bold),
|
2022-05-06 14:22:23 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _buildExcludedAlbumName() {
|
2022-07-07 20:40:54 +02:00
|
|
|
var text = "backup_controller_page_excluded".tr();
|
2022-05-06 14:22:23 +02:00
|
|
|
var albums = ref.watch(backupProvider).excludedBackupAlbums;
|
|
|
|
|
|
|
|
if (albums.isNotEmpty) {
|
|
|
|
for (var album in albums) {
|
|
|
|
text += "${album.name}, ";
|
|
|
|
}
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Text(
|
|
|
|
text.trim().substring(0, text.length - 2),
|
2022-06-22 07:23:35 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.red[300],
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.bold),
|
2022-05-06 14:22:23 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
} else {
|
2022-07-01 03:08:49 +02:00
|
|
|
return const SizedBox();
|
2022-05-06 14:22:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_buildFolderSelectionTile() {
|
|
|
|
return Card(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(5), // if you need this
|
|
|
|
side: const BorderSide(
|
|
|
|
color: Colors.black12,
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
elevation: 0,
|
|
|
|
borderOnForeground: false,
|
|
|
|
child: ListTile(
|
|
|
|
minVerticalPadding: 15,
|
2022-07-07 20:40:54 +02:00
|
|
|
title: const Text("backup_controller_page_albums",
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20))
|
|
|
|
.tr(),
|
2022-05-06 14:22:23 +02:00
|
|
|
subtitle: Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_to_backup",
|
2022-05-06 14:22:23 +02:00
|
|
|
style: TextStyle(color: Color(0xFF808080), fontSize: 12),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-05-06 14:22:23 +02:00
|
|
|
_buildSelectedAlbumName(),
|
|
|
|
_buildExcludedAlbumName()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
trailing: OutlinedButton(
|
2022-05-30 00:32:30 +02:00
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
enableFeedback: true,
|
|
|
|
side: const BorderSide(
|
|
|
|
width: 1,
|
|
|
|
color: Color.fromARGB(255, 220, 220, 220),
|
|
|
|
),
|
|
|
|
),
|
2022-05-06 14:22:23 +02:00
|
|
|
onPressed: () {
|
|
|
|
AutoRouter.of(context).push(const BackupAlbumSelectionRoute());
|
|
|
|
},
|
2022-07-07 20:40:54 +02:00
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
2022-05-06 14:22:23 +02:00
|
|
|
vertical: 16.0,
|
|
|
|
),
|
2022-07-07 20:40:54 +02:00
|
|
|
child: const Text(
|
|
|
|
"backup_controller_page_select",
|
2022-05-06 14:22:23 +02:00
|
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-05-06 14:22:23 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-06 23:12:55 +02:00
|
|
|
_buildCurrentBackupAssetInfoCard() {
|
|
|
|
return ListTile(
|
|
|
|
leading: Icon(
|
|
|
|
Icons.info_outline_rounded,
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
),
|
|
|
|
title: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(
|
2022-07-08 00:25:02 +02:00
|
|
|
"backup_controller_page_uploading_file_info",
|
2022-07-06 23:12:55 +02:00
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
2022-07-08 00:25:02 +02:00
|
|
|
).tr(),
|
2022-07-06 23:12:55 +02:00
|
|
|
if (ref.watch(errorBackupListProvider).isNotEmpty)
|
|
|
|
ActionChip(
|
|
|
|
avatar: Icon(
|
|
|
|
Icons.info,
|
|
|
|
size: 24,
|
|
|
|
color: Colors.red[400],
|
|
|
|
),
|
|
|
|
elevation: 1,
|
|
|
|
visualDensity: VisualDensity.compact,
|
|
|
|
label: Text(
|
2022-07-08 00:25:02 +02:00
|
|
|
"backup_controller_page_failed",
|
2022-07-06 23:12:55 +02:00
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.red[400],
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 11,
|
|
|
|
),
|
2022-07-08 00:25:02 +02:00
|
|
|
).tr(args: [
|
|
|
|
ref.watch(errorBackupListProvider).length.toString()
|
|
|
|
]),
|
2022-07-06 23:12:55 +02:00
|
|
|
backgroundColor: Colors.white,
|
|
|
|
onPressed: () {
|
|
|
|
AutoRouter.of(context).push(const FailedBackupStatusRoute());
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
subtitle: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: LinearPercentIndicator(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
|
|
|
barRadius: const Radius.circular(2),
|
|
|
|
lineHeight: 10.0,
|
|
|
|
trailing: Text(
|
|
|
|
" ${backupState.progressInPercentage.toStringAsFixed(0)}%",
|
|
|
|
style: const TextStyle(fontSize: 12),
|
|
|
|
),
|
|
|
|
percent: backupState.progressInPercentage / 100.0,
|
|
|
|
backgroundColor: Colors.grey,
|
|
|
|
progressColor: Theme.of(context).primaryColor,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
|
|
child: Table(
|
|
|
|
border: TableBorder.all(
|
|
|
|
color: Colors.black12,
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TableRow(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.grey[100],
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TableCell(
|
|
|
|
verticalAlignment: TableCellVerticalAlignment.middle,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(6.0),
|
2022-07-08 00:25:02 +02:00
|
|
|
child: const Text(
|
|
|
|
'backup_controller_page_filename',
|
|
|
|
style: TextStyle(
|
2022-07-06 23:12:55 +02:00
|
|
|
fontWeight: FontWeight.bold, fontSize: 10.0),
|
2022-07-08 00:25:02 +02:00
|
|
|
).tr(args: [
|
|
|
|
backupState.currentUploadAsset.fileName,
|
|
|
|
backupState.currentUploadAsset.fileType
|
|
|
|
.toLowerCase()
|
|
|
|
]),
|
2022-07-06 23:12:55 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
TableRow(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.grey[200],
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TableCell(
|
|
|
|
verticalAlignment: TableCellVerticalAlignment.middle,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(6.0),
|
2022-07-08 00:25:02 +02:00
|
|
|
child: const Text(
|
|
|
|
"backup_controller_page_created",
|
|
|
|
style: const TextStyle(
|
|
|
|
fontWeight: FontWeight.bold, fontSize: 10.0),
|
|
|
|
).tr(args: [
|
|
|
|
DateFormat.yMMMMd('en_US').format(
|
2022-07-06 23:12:55 +02:00
|
|
|
DateTime.parse(
|
|
|
|
backupState.currentUploadAsset.createdAt
|
|
|
|
.toString(),
|
|
|
|
),
|
2022-07-08 00:25:02 +02:00
|
|
|
)
|
|
|
|
]),
|
2022-07-06 23:12:55 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
TableRow(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.grey[100],
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TableCell(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(6.0),
|
2022-07-08 00:25:02 +02:00
|
|
|
child: const Text(
|
|
|
|
"backup_controller_page_id",
|
|
|
|
style: TextStyle(
|
2022-07-06 23:12:55 +02:00
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 10.0,
|
|
|
|
),
|
2022-07-08 00:25:02 +02:00
|
|
|
).tr(args: [backupState.currentUploadAsset.id]),
|
2022-07-06 23:12:55 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void startBackup() {
|
|
|
|
ref.watch(errorBackupListProvider.notifier).empty();
|
|
|
|
ref.watch(backupProvider.notifier).startBackupProcess();
|
|
|
|
}
|
|
|
|
|
2022-02-03 18:06:44 +02:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
2022-05-06 14:22:23 +02:00
|
|
|
elevation: 0,
|
2022-02-03 18:06:44 +02:00
|
|
|
title: const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_backup",
|
2022-05-06 14:22:23 +02:00
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-02-03 18:06:44 +02:00
|
|
|
leading: IconButton(
|
|
|
|
onPressed: () {
|
2022-04-03 19:31:45 +02:00
|
|
|
ref.watch(websocketProvider.notifier).listenUploadEvent();
|
2022-02-03 18:06:44 +02:00
|
|
|
AutoRouter.of(context).pop(true);
|
|
|
|
},
|
2022-05-06 14:22:23 +02:00
|
|
|
splashRadius: 24,
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.arrow_back_ios_rounded,
|
|
|
|
)),
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
body: Padding(
|
2022-07-06 23:12:55 +02:00
|
|
|
padding: const EdgeInsets.only(left: 16.0, right: 16, bottom: 32),
|
2022-02-03 18:06:44 +02:00
|
|
|
child: ListView(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-07-07 20:40:54 +02:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: const Text(
|
|
|
|
"backup_controller_page_info",
|
2022-02-03 18:06:44 +02:00
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
2022-05-06 14:22:23 +02:00
|
|
|
_buildFolderSelectionTile(),
|
2022-02-03 18:06:44 +02:00
|
|
|
BackupInfoCard(
|
2022-07-07 20:40:54 +02:00
|
|
|
title: "backup_controller_page_total".tr(),
|
|
|
|
subtitle: "backup_controller_page_total_sub".tr(),
|
2022-05-06 14:22:23 +02:00
|
|
|
info: "${backupState.allUniqueAssets.length}",
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
BackupInfoCard(
|
2022-07-07 20:40:54 +02:00
|
|
|
title: "backup_controller_page_backup".tr(),
|
|
|
|
subtitle: "backup_controller_page_backup_sub".tr(),
|
2022-05-06 14:22:23 +02:00
|
|
|
info: "${backupState.selectedAlbumsBackupAssetsIds.length}",
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
BackupInfoCard(
|
2022-07-07 20:40:54 +02:00
|
|
|
title: "backup_controller_page_remainder".tr(),
|
|
|
|
subtitle: "backup_controller_page_remainder_sub".tr(),
|
2022-06-22 07:23:35 +02:00
|
|
|
info:
|
|
|
|
"${backupState.allUniqueAssets.length - backupState.selectedAlbumsBackupAssetsIds.length}",
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
const Divider(),
|
|
|
|
_buildBackupController(),
|
|
|
|
const Divider(),
|
|
|
|
_buildStorageInformation(),
|
|
|
|
const Divider(),
|
2022-07-06 23:12:55 +02:00
|
|
|
_buildCurrentBackupAssetInfoCard(),
|
2022-02-03 18:06:44 +02:00
|
|
|
Padding(
|
2022-07-06 23:12:55 +02:00
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
top: 24,
|
|
|
|
),
|
2022-02-03 18:06:44 +02:00
|
|
|
child: Container(
|
2022-06-22 07:23:35 +02:00
|
|
|
child:
|
|
|
|
backupState.backupProgress == BackUpProgressEnum.inProgress
|
|
|
|
? ElevatedButton(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
primary: Colors.red[300],
|
|
|
|
onPrimary: Colors.grey[50],
|
2022-07-06 23:12:55 +02:00
|
|
|
padding: const EdgeInsets.all(14),
|
2022-06-22 07:23:35 +02:00
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
ref.read(backupProvider.notifier).cancelBackup();
|
|
|
|
},
|
2022-07-06 23:12:55 +02:00
|
|
|
child: const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_cancel",
|
2022-07-06 23:12:55 +02:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-06-22 07:23:35 +02:00
|
|
|
)
|
|
|
|
: ElevatedButton(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
primary: Theme.of(context).primaryColor,
|
|
|
|
onPrimary: Colors.grey[50],
|
2022-07-06 23:12:55 +02:00
|
|
|
padding: const EdgeInsets.all(14),
|
|
|
|
),
|
|
|
|
onPressed: shouldBackup ? startBackup : null,
|
|
|
|
child: const Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
"backup_controller_page_start_backup",
|
2022-07-06 23:12:55 +02:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
2022-07-07 20:40:54 +02:00
|
|
|
).tr(),
|
2022-06-22 07:23:35 +02:00
|
|
|
),
|
2022-02-03 18:06:44 +02:00
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|