Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Reuse Locker icon tile utilities

aman-pilotaec566be7276
diff --git a/mobile/apps/locker/lib/utils/file_icon_utils.dart b/mobile/apps/locker/lib/utils/file_icon_utils.dart
index 3155e97be2..c79a34e9ab 100644
--- a/mobile/apps/locker/lib/utils/file_icon_utils.dart
+++ b/mobile/apps/locker/lib/utils/file_icon_utils.dart
@@ -87,29 +87,10 @@ class FileIconUtils {
return icon;
}
- return Container(
- decoration: BoxDecoration(
- color: backgroundColor ?? _backgroundColor(config.colorRole, colors),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Padding(padding: const EdgeInsets.all(8.0), child: icon),
- );
- }
-
- static Color getFileIconColor(BuildContext context, String fileName) {
- return _foregroundColor(
- _getFileConfig(fileName).colorRole,
- context.componentColors,
- );
- }
-
- static Color getFileIconBackgroundColor(
- BuildContext context,
- String fileName,
- ) {
- return _backgroundColor(
- _getFileConfig(fileName).colorRole,
- context.componentColors,
+ return IconTile(
+ icon: icon,
+ backgroundColor:
+ backgroundColor ?? _backgroundColor(config.colorRole, colors),
);
}
@@ -131,3 +112,46 @@ class FileIconUtils {
};
}
}
+
+class IconTile extends StatelessWidget {
+ final Widget icon;
+ final Color backgroundColor;
+
+ const IconTile({
+ super.key,
+ required this.icon,
+ required this.backgroundColor,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ decoration: BoxDecoration(
+ color: backgroundColor,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Padding(padding: const EdgeInsets.all(8.0), child: icon),
+ );
+ }
+}
+
+class SelectionCheckBadge extends StatelessWidget {
+ const SelectionCheckBadge({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ return Container(
+ width: 18,
+ height: 18,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(color: colors.primary, shape: BoxShape.circle),
+ child: const HugeIcon(
+ icon: HugeIcons.strokeRoundedTick02,
+ color: Colors.white,
+ size: 12,
+ strokeWidth: 2,
+ ),
+ );
+ }
+}
diff --git a/mobile/apps/locker/lib/utils/info_item_utils.dart b/mobile/apps/locker/lib/utils/info_item_utils.dart
index 71800c4e71..9ba8a8706f 100644
--- a/mobile/apps/locker/lib/utils/info_item_utils.dart
+++ b/mobile/apps/locker/lib/utils/info_item_utils.dart
@@ -2,6 +2,7 @@ import 'package:ente_components/ente_components.dart';
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
import 'package:locker/models/info/info_item.dart';
+import 'package:locker/utils/file_icon_utils.dart';
enum InfoIconColorRole { caution, purple, primary, warning }
@@ -58,12 +59,10 @@ class InfoItemUtils {
return icon;
}
- return Container(
- decoration: BoxDecoration(
- color: backgroundColor ?? _backgroundColor(config.colorRole, colors),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Padding(padding: const EdgeInsets.all(8.0), child: icon),
+ return IconTile(
+ icon: icon,
+ backgroundColor:
+ backgroundColor ?? _backgroundColor(config.colorRole, colors),
);
}