From 0bbcb4fe97163d3cbc5f116fb3caed41f19594a7 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Tue, 11 Mar 2025 14:25:53 +0200 Subject: [PATCH] add dymanic text for instal and update MIH --- .../about_mih/app_tools/mih_info.dart | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Frontend/lib/mih_packages/about_mih/app_tools/mih_info.dart b/Frontend/lib/mih_packages/about_mih/app_tools/mih_info.dart index ed5854ad..1f26774c 100644 --- a/Frontend/lib/mih_packages/about_mih/app_tools/mih_info.dart +++ b/Frontend/lib/mih_packages/about_mih/app_tools/mih_info.dart @@ -549,6 +549,25 @@ class _MihInfoState extends State { } } + String getInstallButtonText() { + final isWebAndroid = + kIsWeb && (defaultTargetPlatform == TargetPlatform.android); + final isWebIos = kIsWeb && (defaultTargetPlatform == TargetPlatform.iOS); + + if (isWebAndroid) { + return "Install MIH (Play Store)"; + } else if (isWebIos) { + return "Install MIH (PWA)"; + } else if (MzanziInnovationHub.of(context)!.theme.getPlatform() == + "Android") { + return "Update MIH (Play Store)"; + } else if (MzanziInnovationHub.of(context)!.theme.getPlatform() == "iOS") { + return "Update MIH (App Store)"; + } else { + return "Install MIH (PWA)"; + } + } + @override Widget build(BuildContext context) { return MihAppToolBody( @@ -611,7 +630,7 @@ class _MihInfoState extends State { onTap: () { installMihTrigger(); }, - buttonText: "Install MIH", + buttonText: getInstallButtonText(), buttonColor: MzanziInnovationHub.of(context)! .theme .secondaryColor(),