From 84f329ea9cd858361b2bc2621f79d07f2755f4fb Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Wed, 12 Mar 2025 15:06:42 +0530 Subject: [PATCH] Update --- mobile/lib/ui/home/custom_icons.dart | 2 +- mobile/lib/ui/home/landing_page_widget.dart | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mobile/lib/ui/home/custom_icons.dart b/mobile/lib/ui/home/custom_icons.dart index 2922a20322..538761b192 100644 --- a/mobile/lib/ui/home/custom_icons.dart +++ b/mobile/lib/ui/home/custom_icons.dart @@ -61,7 +61,7 @@ final class IconGreen extends CustomIcon { IconGreen() : super( iOSIcon: 'IconGreen', - androidIcon: 'IconGreen', + androidIcon: 'MainActivity', previewPath: 'assets/icons/icon2.png', isDefaultIcon: true, ); diff --git a/mobile/lib/ui/home/landing_page_widget.dart b/mobile/lib/ui/home/landing_page_widget.dart index 246bf8dda2..fdaa7c0777 100644 --- a/mobile/lib/ui/home/landing_page_widget.dart +++ b/mobile/lib/ui/home/landing_page_widget.dart @@ -261,7 +261,7 @@ class _LandingPageWidgetState extends State { Logger("Icon").info("Initializing"); final iconChanger = LauncherIconSwitcher(); await iconChanger - .initialize(['IconLight', 'IconDark', 'IconGreen'], 'IconGreen'); + .initialize(['IconLight', 'IconDark', 'IconGreen'], 'IconLight'); Logger("Icon").info("Initialized"); final currentIcon = await iconChanger.getCurrentIcon(); Logger("Icon").info("Current Icon: " + currentIcon); @@ -281,8 +281,12 @@ class _LandingPageWidgetState extends State { final iconChanger = FlutterAppIconChangerPlugin( iconsSet: CustomIcons.list, ); + final defaultIcon = CustomIcons.list.firstWhere( + (element) => element.isDefaultIcon, + ); Logger("Icon").info("Initialized"); - final currentIcon = await iconChanger.getCurrentIcon() ?? "none"; + final currentIcon = + await iconChanger.getCurrentIcon() ?? defaultIcon.androidIcon; Logger("Icon").info("Current Icon: " + currentIcon); final isSupported = await iconChanger.isSupported(); Logger("Icon").info("Supported: " + isSupported.toString()); @@ -293,7 +297,8 @@ class _LandingPageWidgetState extends State { } else { await iconChanger.changeIcon(CustomIcons.list[0].androidIcon); } - final newIcon = await iconChanger.getCurrentIcon() ?? "none"; + final newIcon = + await iconChanger.getCurrentIcon() ?? defaultIcon.androidIcon; Logger("Icon").info("App icon changed to " + newIcon); return; } catch (e, s) {