Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

[auth] fix icons not showing

Aman Raj3a413524f8d1
diff --git a/auth/lib/ui/custom_icon_page.dart b/auth/lib/ui/custom_icon_page.dart
index 85d229a628..4a5b6cd42b 100644
--- a/auth/lib/ui/custom_icon_page.dart
+++ b/auth/lib/ui/custom_icon_page.dart
@@ -136,11 +136,11 @@ class _CustomIconPageState extends State<CustomIconPage> {
IconType iconType = iconData.type;
String? color = iconData.color;
String? slug = iconData.slug;
-
Widget iconWidget;
if (iconType == IconType.simpleIcon) {
+ final simpleIconPath = normalizeSimpleIconName(title);
iconWidget = IconUtils.instance.getSVGIcon(
- "assets/simple-icons/icons/$title.svg",
+ "assets/simple-icons/icons/$simpleIconPath.svg",
title,
color,
40,
@@ -157,6 +157,7 @@ class _CustomIconPageState extends State<CustomIconPage> {
}
return GestureDetector(
+ key: ValueKey(title),
onTap: () {
final newIcon = AllIconData(
title: title,
diff --git a/auth/lib/ui/utils/icon_utils.dart b/auth/lib/ui/utils/icon_utils.dart
index 76896a7b36..98806964b3 100644
--- a/auth/lib/ui/utils/icon_utils.dart
+++ b/auth/lib/ui/utils/icon_utils.dart
@@ -121,8 +121,9 @@ class IconUtils {
context,
);
} else if (_simpleIcons.containsKey(title)) {
+ final simpleIconPath = normalizeSimpleIconName(title);
return getSVGIcon(
- "assets/simple-icons/icons/$title.svg",
+ "assets/simple-icons/icons/$simpleIconPath.svg",
title,
_simpleIcons[title],
width,
@@ -245,3 +246,40 @@ class CustomIconData {
CustomIconData(this.slug, this.color);
}
+
+String normalizeSimpleIconName(String input) {
+ final charMap = {
+ 'á': 'a',
+ 'à': 'a',
+ 'â': 'a',
+ 'ä': 'a',
+ 'é': 'e',
+ 'è': 'e',
+ 'ê': 'e',
+ 'ë': 'e',
+ 'í': 'i',
+ 'ì': 'i',
+ 'î': 'i',
+ 'ï': 'i',
+ 'ó': 'o',
+ 'ò': 'o',
+ 'ô': 'o',
+ 'ö': 'o',
+ 'ú': 'u',
+ 'ù': 'u',
+ 'û': 'u',
+ 'ü': 'u',
+ 'ç': 'c',
+ 'ñ': 'n',
+ '.': 'dot',
+ '-': 'dash',
+ '&': 'and',
+ };
+
+ final buffer = StringBuffer();
+
+ for (var char in input.characters) {
+ buffer.write(charMap[char] ?? char);
+ }
+ return buffer.toString().trim();
+}