Skip to content

armgit / ente

Public Imported from GitHub
0

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

Support slugs

vishnukvmd42d2b17b985d
diff --git a/lib/ui/utils/icon_utils.dart b/lib/ui/utils/icon_utils.dart
index a6555be0e3..a1a9246585 100644
--- a/lib/ui/utils/icon_utils.dart
+++ b/lib/ui/utils/icon_utils.dart
@@ -12,7 +12,7 @@ class IconUtils {
// Map of icon-title to the color code in HEX
final Map<String, String> _simpleIcons = {};
- final Map<String, String?> _customIcons = {};
+ final Map<String, CustomIconData> _customIcons = {};
Future<void> init() async {
await _loadJson();
@@ -25,9 +25,9 @@ class IconUtils {
final title = _getProviderTitle(provider);
if (_customIcons.containsKey(title)) {
return _getSVGIcon(
- "assets/custom-icons/icons/$title.svg",
+ "assets/custom-icons/icons/${_customIcons[title]!.slug ?? title}.svg",
title,
- _customIcons[title],
+ _customIcons[title]!.color,
width,
);
} else if (_simpleIcons.containsKey(title)) {
@@ -72,7 +72,10 @@ class IconUtils {
.loadString('assets/custom-icons/_data/custom-icons.json');
final customIcons = json.decode(customIconData);
for (final icon in customIcons["icons"]) {
- _customIcons[icon["title"].toString().toLowerCase()] = icon["hex"];
+ _customIcons[icon["title"].toString().toLowerCase()] = CustomIconData(
+ icon["slug"],
+ icon["hex"],
+ );
}
}
@@ -80,3 +83,10 @@ class IconUtils {
return provider.split(RegExp(r'[.(]'))[0].trim().toLowerCase();
}
}
+
+class CustomIconData {
+ final String? slug;
+ final String? color;
+
+ CustomIconData(this.slug, this.color);
+}