mirror of
https://github.com/immich-app/immich.git
synced 2025-07-15 20:38:26 +02:00
refactor(mobile): backup info box (#14171)
split up backup info box into separate widgets
This commit is contained in:
parent
6729782c3f
commit
caf6c0996d
9 changed files with 383 additions and 283 deletions
mobile/lib/widgets/backup
102
mobile/lib/widgets/backup/asset_info_table.dart
Normal file
102
mobile/lib/widgets/backup/asset_info_table.dart
Normal file
|
@ -0,0 +1,102 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
||||
import 'package:immich_mobile/models/backup/backup_state.model.dart';
|
||||
import 'package:immich_mobile/models/backup/current_upload_asset.model.dart';
|
||||
import 'package:immich_mobile/providers/backup/backup.provider.dart';
|
||||
import 'package:immich_mobile/providers/backup/manual_upload.provider.dart';
|
||||
|
||||
class BackupAssetInfoTable extends ConsumerWidget {
|
||||
const BackupAssetInfoTable({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final isManualUpload = ref.watch(
|
||||
backupProvider.select(
|
||||
(value) => value.backupProgress == BackUpProgressEnum.manualInProgress,
|
||||
),
|
||||
);
|
||||
|
||||
final asset = isManualUpload
|
||||
? ref.watch(
|
||||
manualUploadProvider.select((value) => value.currentUploadAsset),
|
||||
)
|
||||
: ref.watch(backupProvider.select((value) => value.currentUploadAsset));
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Table(
|
||||
border: TableBorder.all(
|
||||
color: context.colorScheme.outlineVariant,
|
||||
width: 1,
|
||||
),
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
'backup_controller_page_filename',
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.onSurfaceSecondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10.0,
|
||||
),
|
||||
).tr(
|
||||
args: [asset.fileName, asset.fileType.toLowerCase()],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
"backup_controller_page_created",
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.onSurfaceSecondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10.0,
|
||||
),
|
||||
).tr(
|
||||
args: [_getAssetCreationDate(asset)],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
"backup_controller_page_id",
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.onSurfaceSecondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10.0,
|
||||
),
|
||||
).tr(args: [asset.id]),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
String _getAssetCreationDate(CurrentUploadAsset asset) {
|
||||
return DateFormat.yMMMMd().format(asset.fileCreatedAt.toLocal());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue