2024-01-05 05:20:55 +00:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2022-07-06 16:12:55 -05:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2023-11-09 16:19:53 +00:00
|
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
2024-05-02 15:59:14 -05:00
|
|
|
import 'package:immich_mobile/providers/backup/error_backup_list.provider.dart';
|
2024-09-18 17:15:52 +02:00
|
|
|
import 'package:immich_mobile/providers/image/immich_local_thumbnail_provider.dart';
|
2022-07-06 16:12:55 -05:00
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
2024-01-15 16:50:33 +00:00
|
|
|
@RoutePage()
|
2022-07-06 16:12:55 -05:00
|
|
|
class FailedBackupStatusPage extends HookConsumerWidget {
|
2024-01-27 16:14:32 +00:00
|
|
|
const FailedBackupStatusPage({super.key});
|
2022-07-06 16:12:55 -05:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final errorBackupList = ref.watch(errorBackupListProvider);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
title: Text(
|
|
|
|
|
"Failed Backup (${errorBackupList.length})",
|
|
|
|
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
leading: IconButton(
|
2022-07-13 07:23:48 -05:00
|
|
|
onPressed: () {
|
2024-05-14 19:07:31 +00:00
|
|
|
context.maybePop(true);
|
2022-07-13 07:23:48 -05:00
|
|
|
},
|
|
|
|
|
splashRadius: 24,
|
2025-07-29 00:34:03 +05:30
|
|
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
2022-07-13 07:23:48 -05:00
|
|
|
),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
body: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: errorBackupList.length,
|
|
|
|
|
itemBuilder: ((context, index) {
|
|
|
|
|
var errorAsset = errorBackupList.elementAt(index);
|
|
|
|
|
|
|
|
|
|
return Padding(
|
2025-07-29 00:34:03 +05:30
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4),
|
2022-07-06 16:12:55 -05:00
|
|
|
child: Card(
|
2025-06-25 13:06:24 +05:30
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(15), // if you need this
|
|
|
|
|
),
|
2025-07-29 00:34:03 +05:30
|
|
|
side: BorderSide(color: Colors.black12, width: 1),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
elevation: 0,
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
ConstrainedBox(
|
2025-07-29 00:34:03 +05:30
|
|
|
constraints: const BoxConstraints(minWidth: 100, minHeight: 100, maxWidth: 100, maxHeight: 150),
|
2022-07-06 16:12:55 -05:00
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius: const BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(15),
|
|
|
|
|
topLeft: Radius.circular(15),
|
|
|
|
|
),
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
child: Image(
|
|
|
|
|
fit: BoxFit.cover,
|
2025-07-29 00:34:03 +05:30
|
|
|
image: ImmichLocalThumbnailProvider(asset: errorAsset.asset, height: 512, width: 512),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
2023-02-20 18:23:00 +01:00
|
|
|
DateFormat.yMMMMd().format(
|
2025-07-29 00:34:03 +05:30
|
|
|
DateTime.parse(errorAsset.fileCreatedAt.toString()).toLocal(),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
style: TextStyle(
|
2022-07-13 07:23:48 -05:00
|
|
|
fontWeight: FontWeight.w600,
|
2025-07-25 08:07:22 +05:30
|
|
|
color: context.isDarkTheme ? Colors.white70 : Colors.grey[800],
|
2022-07-13 07:23:48 -05:00
|
|
|
),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
2025-07-29 00:34:03 +05:30
|
|
|
Icon(Icons.error, color: Colors.red.withAlpha(200), size: 18),
|
2022-07-06 16:12:55 -05:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
errorAsset.fileName,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
2025-07-29 00:34:03 +05:30
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, color: context.primaryColor),
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
errorAsset.errorMessage,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w500,
|
2025-07-25 08:07:22 +05:30
|
|
|
color: context.isDarkTheme ? Colors.white70 : Colors.grey[800],
|
2022-07-06 16:12:55 -05:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2023-08-18 18:52:40 -04:00
|
|
|
),
|
2022-07-06 16:12:55 -05:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|