failed_backup_status_page.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import 'package:auto_route/auto_route.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:hooks_riverpod/hooks_riverpod.dart';
  4. import 'package:immich_mobile/modules/backup/providers/error_backup_list.provider.dart';
  5. import 'package:intl/intl.dart';
  6. import 'package:photo_manager/photo_manager.dart';
  7. class FailedBackupStatusPage extends HookConsumerWidget {
  8. const FailedBackupStatusPage({Key? key}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context, WidgetRef ref) {
  11. final errorBackupList = ref.watch(errorBackupListProvider);
  12. return Scaffold(
  13. appBar: AppBar(
  14. elevation: 0,
  15. title: Text(
  16. "Failed Backup (${errorBackupList.length})",
  17. style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
  18. ),
  19. leading: IconButton(
  20. onPressed: () {
  21. AutoRouter.of(context).pop(true);
  22. },
  23. splashRadius: 24,
  24. icon: const Icon(
  25. Icons.arrow_back_ios_rounded,
  26. )),
  27. ),
  28. body: ListView.builder(
  29. shrinkWrap: true,
  30. itemCount: errorBackupList.length,
  31. itemBuilder: ((context, index) {
  32. var errorAsset = errorBackupList.elementAt(index);
  33. return Padding(
  34. padding: const EdgeInsets.symmetric(
  35. horizontal: 12.0,
  36. vertical: 4,
  37. ),
  38. child: Card(
  39. shape: RoundedRectangleBorder(
  40. borderRadius: BorderRadius.circular(15), // if you need this
  41. side: const BorderSide(
  42. color: Colors.black12,
  43. width: 1,
  44. ),
  45. ),
  46. elevation: 0,
  47. child: Row(
  48. crossAxisAlignment: CrossAxisAlignment.center,
  49. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  50. children: [
  51. ConstrainedBox(
  52. constraints: const BoxConstraints(
  53. minWidth: 100,
  54. minHeight: 150,
  55. maxWidth: 100,
  56. maxHeight: 200,
  57. ),
  58. child: ClipRRect(
  59. borderRadius: const BorderRadius.only(
  60. bottomLeft: Radius.circular(15),
  61. topLeft: Radius.circular(15),
  62. ),
  63. clipBehavior: Clip.hardEdge,
  64. child: Image(
  65. fit: BoxFit.cover,
  66. image: AssetEntityImageProvider(
  67. errorAsset.asset,
  68. isOriginal: false,
  69. thumbnailSize: const ThumbnailSize.square(512),
  70. thumbnailFormat: ThumbnailFormat.jpeg,
  71. ),
  72. ),
  73. ),
  74. ),
  75. Expanded(
  76. child: Padding(
  77. padding: const EdgeInsets.all(16.0),
  78. child: Column(
  79. crossAxisAlignment: CrossAxisAlignment.start,
  80. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  81. children: [
  82. Row(
  83. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  84. children: [
  85. Text(
  86. DateFormat.yMMMMd('en_US').format(
  87. DateTime.parse(
  88. errorAsset.createdAt.toString(),
  89. ),
  90. ),
  91. style: TextStyle(
  92. fontSize: 12,
  93. fontWeight: FontWeight.w600,
  94. color: Colors.grey[700]),
  95. ),
  96. Icon(
  97. Icons.error,
  98. color: Colors.red.withAlpha(200),
  99. size: 18,
  100. ),
  101. ],
  102. ),
  103. Padding(
  104. padding: const EdgeInsets.symmetric(vertical: 8.0),
  105. child: Text(
  106. errorAsset.fileName,
  107. maxLines: 1,
  108. overflow: TextOverflow.ellipsis,
  109. style: TextStyle(
  110. fontWeight: FontWeight.bold,
  111. fontSize: 12,
  112. color: Theme.of(context).primaryColor,
  113. ),
  114. ),
  115. ),
  116. Text(
  117. errorAsset.errorMessage,
  118. style: TextStyle(
  119. fontSize: 12,
  120. fontWeight: FontWeight.w500,
  121. color: Colors.grey[800],
  122. ),
  123. ),
  124. ],
  125. ),
  126. ),
  127. )
  128. ],
  129. ),
  130. ),
  131. );
  132. }),
  133. ),
  134. );
  135. }
  136. }