π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fall back to letter avatar when issuer SVGs fail
Prateek Sunale9664a2a252a
diff --git a/mobile/apps/auth/lib/ui/utils/icon_utils.dart b/mobile/apps/auth/lib/ui/utils/icon_utils.dartindex 3476e73c74..c495cc5345 100644--- a/mobile/apps/auth/lib/ui/utils/icon_utils.dart+++ b/mobile/apps/auth/lib/ui/utils/icon_utils.dart@@ -132,26 +132,7 @@ class IconUtils {}}if (providerTitle.isNotEmpty) {- bool showLargeIcon = width > 24;- return CircleAvatar(- radius: width / 2,- backgroundColor: getEnteColorScheme(context).avatarColors[- providerTitle.hashCode %- getEnteColorScheme(context).avatarColors.length],- child: Text(- providerTitle.toUpperCase()[0],- // fixed color- style: showLargeIcon- ? getEnteTextTheme(context).h3Bold.copyWith(- color: Colors.white,- fontSize: width * 0.6,- )- : getEnteTextTheme(context).body.copyWith(- color: Colors.white,- fontSize: width * 0.6,- ),- ),- );+ return _fallbackAvatar(provider, width, context);} else {return const SizedBox.shrink();}@@ -175,6 +156,31 @@ class IconUtils {BlendMode.srcIn,): null,+ errorBuilder: (context, error, stackTrace) {+ Logger("IconUtils")+ .warning("Failed to load icon $path", error, stackTrace);+ return _fallbackAvatar(title, width, context);+ },+ );+ }++ Widget _fallbackAvatar(String provider, double width, BuildContext context) {+ final providerTitle = _getProviderTitle(provider);+ if (providerTitle.isEmpty) return const SizedBox.shrink();+ final bool showLargeIcon = width > 24;+ return CircleAvatar(+ radius: width / 2,+ backgroundColor: getEnteColorScheme(context).avatarColors[+ providerTitle.hashCode %+ getEnteColorScheme(context).avatarColors.length],+ child: Text(+ providerTitle.toUpperCase()[0],+ style: showLargeIcon+ ? getEnteTextTheme(context).h3Bold+ .copyWith(color: Colors.white, fontSize: width * 0.6)+ : getEnteTextTheme(context).body+ .copyWith(color: Colors.white, fontSize: width * 0.6),+ ),);}