From 604e503e52859d80595f377b990a6b323d1b800d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 24 Sep 2025 15:29:22 +0300 Subject: [PATCH 1/2] flow improvement & translation added. --- assets/langs/ar-SA.json | 11 ++-- assets/langs/en-US.json | 8 ++- lib/core/cache_consts.dart | 1 + lib/core/utils/utils.dart | 13 ++++- .../onboarding/onboarding_screen.dart | 16 ++++-- lib/splashPage.dart | 50 ++----------------- 6 files changed, 45 insertions(+), 54 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 32ab221..8945fee 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -126,7 +126,7 @@ "gregorianDate": "التاريخ الميلادي", "verifyLoginWith": "يرجى اختيار واحدة من الخيارات التالية للتحقق", "registerUser": "تسجيل", - "verifyWithFingerprint":"البيومترية", + "verifyWithFingerprint": "البيومترية", "verifyWithFaceid": "معرف الوجه", "verifyWithSms": "رسالة قصيرة", "verifyWithWhatsapp": "واتساب", @@ -850,6 +850,11 @@ "pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح", "selectCountry": "اختر الدولة", "forLoginVerification": "للتحقق من تسجيل الدخول", - "searchHospital": "بحث في المستشفى" - + "searchHospital": "بحث في المستشفى", + "skip": "تخطي", + "getStarted": "ابدأ الآن", + "onboardingHeading1": "حجز المواعيد لم يكن أسهل من قبل", + "onboardingBody1": "ببضع نقرات فقط يمكنك استشارة الطبيب الذي تختاره.", + "onboardingHeading2": "الوصول إلى السجل الطبي بين يديك", + "onboardingBody2": "تتبع تاريخك الطبي بما في ذلك الفحوصات المخبرية، الوصفات الطبية، التأمين، وغيرها." } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 15d74a9..843daf8 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -846,5 +846,11 @@ "selectCountry": "Select Country", "forLoginVerification": "for login verification", "lastLoginBy": "Last login by", - "searchHospital": "Search Hospital" + "searchHospital": "Search Hospital", + "skip": "Skip", + "getStarted": "Get Started", + "onboardingHeading1": "Booking appointment has never been easy", + "onboardingBody1": "In few clicks find yourself having consultation with the doctor of your choice.", + "onboardingHeading2": "Access the medical history on finger tips", + "onboardingBody2": "Keep track on your medical history including labs, prescription, insurance, etc" } \ No newline at end of file diff --git a/lib/core/cache_consts.dart b/lib/core/cache_consts.dart index bbf5402..66b38d4 100644 --- a/lib/core/cache_consts.dart +++ b/lib/core/cache_consts.dart @@ -11,6 +11,7 @@ class CacheConst { static const String lastLoginDate = "lastLoginDate"; static const String lastLoginTime = "lastLoginTime"; static const String memberModel = "memberModel"; + static const String firstLaunch = "firstLaunch"; static const String isShowOnboarding = "is_show_onboarding"; static const String appAuthToken = "app_auth_token"; diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index 698075d..35b99bf 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -162,6 +162,16 @@ class Utils { } } + static Future getBoolFromPrefs(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getBool(key) ?? true; + } + + static Future saveBoolFromPrefs(String key, bool value) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return await prefs.setBool(key, value); + } + static Future getStringFromPrefs(String key) async { SharedPreferences prefs = await SharedPreferences.getInstance(); return prefs.getString(key) ?? ""; @@ -671,7 +681,8 @@ class Utils { ); } - static Widget getPaymentAmountWithSymbol2(num habibWalletAmount, {double iconSize = 14, Color iconColor = AppColors.textColor, Color textColor = AppColors.blackColor, bool isSaudiCurrency = true, bool isExpanded = true}) { + static Widget getPaymentAmountWithSymbol2(num habibWalletAmount, + {double iconSize = 14, Color iconColor = AppColors.textColor, Color textColor = AppColors.blackColor, bool isSaudiCurrency = true, bool isExpanded = true}) { return RichText( maxLines: 1, text: TextSpan( diff --git a/lib/presentation/onboarding/onboarding_screen.dart b/lib/presentation/onboarding/onboarding_screen.dart index 0394a98..9d13488 100644 --- a/lib/presentation/onboarding/onboarding_screen.dart +++ b/lib/presentation/onboarding/onboarding_screen.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; @@ -10,6 +13,8 @@ import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:lottie/lottie.dart'; +import '../../core/dependencies.dart'; + class OnboardingScreen extends StatefulWidget { OnboardingScreen({Key? key}) : super(key: key); @@ -24,7 +29,10 @@ class _OnboardingScreenState extends State { late PageController pageController; - void goToHomePage() => Navigator.of(context).pushReplacement(FadePage(page: LandingNavigation())); + void goToHomePage() { + Utils.saveBoolFromPrefs(CacheConst.firstLaunch, false); + Navigator.of(context).pushReplacement(FadePage(page: LandingNavigation())); + } @override void initState() { @@ -118,7 +126,7 @@ class _OnboardingScreenState extends State { transitionBuilder: (child, anim) => FadeTransition(opacity: anim, child: child), child: selectedIndex == 0 ? CustomButton( - icon: AppAssets.arrow_forward, + icon: getIt.get().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward, iconSize: 32.h, width: 86.h, height: 56.h, @@ -156,7 +164,9 @@ class _OnboardingScreenState extends State { children: [ Align( alignment: Alignment.bottomCenter, - child: Lottie.asset(icon, repeat: true, reverse: false, frameRate: FrameRate(60), width: MediaQuery.sizeOf(context).width - 50, height: MediaQuery.sizeOf(context).width - 50)) + child: Transform.flip( + flipX: getIt.get().isArabic() ? true : false, + child: Lottie.asset(icon, repeat: true, reverse: false, frameRate: FrameRate(60), width: MediaQuery.sizeOf(context).width - 50, height: MediaQuery.sizeOf(context).width - 50))) .expanded, // 12.height, Text( diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 0470e03..bc22dee 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -36,8 +36,6 @@ class SplashPage extends StatefulWidget { class _SplashScreenState extends State { late AuthenticationViewModel authVm; - bool isNewDesign = true; - Future initializeStuff() async { Timer( Duration(milliseconds: 500), @@ -50,15 +48,10 @@ class _SplashScreenState extends State { Timer(Duration(seconds: 2, milliseconds: 500), () async { LocalNotification.init(onNotificationClick: (payload) {}); - if (isNewDesign) { + if (!await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen()))); } else { - Navigator.of(context).pushReplacement( - CustomPageRoute( - page: LandingNavigation(), - // page: LoginScreen(), - ), - ); + Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); } }); var zoom = ZoomVideoSdk(); @@ -97,42 +90,7 @@ class _SplashScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: AppColors.whiteColor, - body: isNewDesign - ? Lottie.asset(AppAnimations.loadingAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 80.h, height: 80.h, fit: BoxFit.fill).center - : Stack( - alignment: Alignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 53), - child: Image.asset(AppAssets.hmg_logo, fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width), - ), - Align( - alignment: Alignment.bottomCenter, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Powered by", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: AppColors.textColor, letterSpacing: -0.56, height: 16 / 14), - ), - SizedBox( - height: 5, - ), - Utils.buildSvgWithAssets(icon: AppAssets.cloud_logo, width: 40, height: 40), - SizedBox(height: 7), - // Text( - // "Version 1.1.0", - // style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10), - // ), - SizedBox( - height: 18, - ) - ], - ), - ) - ], - ), - ); + backgroundColor: AppColors.whiteColor, + body: Lottie.asset(AppAnimations.loadingAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 80.h, height: 80.h, fit: BoxFit.fill).center); } } From 7c90d966c1238c126ffc281520095441afe1817b Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 24 Sep 2025 15:31:44 +0300 Subject: [PATCH 2/2] improvement --- lib/splashPage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/splashPage.dart b/lib/splashPage.dart index bc22dee..3e70742 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -48,7 +48,7 @@ class _SplashScreenState extends State { Timer(Duration(seconds: 2, milliseconds: 500), () async { LocalNotification.init(onNotificationClick: (payload) {}); - if (!await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { + if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen()))); } else { Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation())));