Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add type-specific icons for info files in list view

vishnukvmd101322d85931
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index 9d6430faea..2339457676 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -618,12 +618,7 @@ class FileRowWidget extends StatelessWidget {
children: [
Row(
children: [
- Icon(
- FileIconUtils.getFileIcon(file.displayName),
- color:
- FileIconUtils.getFileIconColor(file.displayName),
- size: 20,
- ),
+ _buildFileIcon(),
const SizedBox(width: 12),
Flexible(
child: Text(
@@ -1039,6 +1034,57 @@ class FileRowWidget extends StatelessWidget {
}
}
+ Widget _buildFileIcon() {
+ // Check if this is an info file
+ if (InfoFileService.instance.isInfoFile(file)) {
+ try {
+ final infoItem = InfoFileService.instance.extractInfoFromFile(file);
+ if (infoItem != null) {
+ return Icon(
+ _getInfoTypeIcon(infoItem.type),
+ color: _getInfoTypeColor(infoItem.type),
+ size: 20,
+ );
+ }
+ } catch (e) {
+ // Fallback to default icon if extraction fails
+ }
+ }
+
+ // For non-info files or if extraction fails, use the original logic
+ return Icon(
+ FileIconUtils.getFileIcon(file.displayName),
+ color: FileIconUtils.getFileIconColor(file.displayName),
+ size: 20,
+ );
+ }
+
+ IconData _getInfoTypeIcon(InfoType type) {
+ switch (type) {
+ case InfoType.note:
+ return Icons.note;
+ case InfoType.accountCredential:
+ return Icons.key;
+ case InfoType.physicalRecord:
+ return Icons.inventory;
+ case InfoType.emergencyContact:
+ return Icons.emergency;
+ }
+ }
+
+ Color _getInfoTypeColor(InfoType type) {
+ switch (type) {
+ case InfoType.note:
+ return Colors.blue;
+ case InfoType.accountCredential:
+ return Colors.orange;
+ case InfoType.physicalRecord:
+ return Colors.green;
+ case InfoType.emergencyContact:
+ return Colors.red;
+ }
+ }
+
Future<void> _openFile(BuildContext context) async {
// Check if this is an info file
if (InfoFileService.instance.isInfoFile(file)) {