From ec03ac743914d43eacbfbb991ccdfb3204d3e8d9 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Wed, 9 Jul 2025 14:43:41 +0300 Subject: [PATCH 1/2] consumer on welcome & language & font --- assets/images/svg/login1.svg | 4 + lib/config/localized_values.dart | 2 + lib/pages/login/welcome.dart | 269 ++++++++++---------- lib/uitl/translations_delegate_base.dart | 2 + lib/widgets/drawer/langauge_picker.dart | 53 ++-- lib/widgets/others/app_scaffold_widget.dart | 12 +- 6 files changed, 177 insertions(+), 165 deletions(-) create mode 100644 assets/images/svg/login1.svg diff --git a/assets/images/svg/login1.svg b/assets/images/svg/login1.svg new file mode 100644 index 00000000..b3ee7550 --- /dev/null +++ b/assets/images/svg/login1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 786baadc..8c2ccb4e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2327,4 +2327,6 @@ const Map localizedValues = { "liveCareTermsConditions47": {"en": "Our Telehealth Services will be for specific medical specialties or follow-up or medication refill appointments.", "ar": "خدمات الرعاية الصحية عن بُعد الخاصة بنا سوف تكون لتخصصات طبية محددة أو لمواعيد المتابعة أو إعادة صرف الدواء. "}, "liveCareTermsConditions48": {"en": "If you have any complaints or concerns about the Application and or the Website, Our Services, or how we handle your personal information please contact us on: EServices.HMG@drsulaimanalhabib.com or call 011 525 9553", "ar": "إذا كانت لديك أي شكاوى أو مخاوف بشأن التطبيق و/أو موقع الويب أو خدماتنا أو كيفية تعاملنا مع معلوماتك الشخصية، فيرجى التواصل معنا على: EServices.HMG@drsulaimanalhabib.com أو الاتصال على الرقم: 9553 525 011"}, "clickPrivacyPolicy": {"en": "Please click here to view the privacy policy", "ar": "الرجاء الضغط هنا لعرض سياسة الخصوصية"}, + "welcomeToDrSulaiman": {"en": "Welcome to Dr. Sulaiman Al Habib Medical Group", "ar": "مرحباً بكم في مجموعة الدكتور سليمان الحبيب الطبية"}, + "dontHaveAccount": {"en": "Don’t have an account?", "ar": "ليس لديك حساب؟"} }; diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 57be605c..91787062 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -93,7 +93,6 @@ class _WelcomeLogin extends State { var healthId; int _selectedLanguage = 0; - @override void initState() { isLoading = true; @@ -104,12 +103,12 @@ class _WelcomeLogin extends State { sharedPref.setBool(IS_ROBOT_INIT, false); sharedPref.remove(CLINICS_LIST); if (projectViewModel.isArabic) { - _selectedLanguage = value; + _selectedLanguage = 1; projectViewModel.changeLanguage('en'); locator().hamburgerMenu.logMenuItemClick('change language to english'); } else { - _selectedLanguage = value; + _selectedLanguage = 0; projectViewModel.changeLanguage('ar'); locator().hamburgerMenu.logMenuItemClick('change language to arabic'); } @@ -119,98 +118,103 @@ class _WelcomeLogin extends State { @override Widget build(BuildContext context) { - final initialProjectViewModel = Provider.of(context, listen: false); + projectViewModel = context.read(); + // final initialProjectViewModel = Provider.of(context, listen: false); // _selectedLanguage = initialProjectViewModel.isArabic ? 0 : 1; - return Consumer2( - builder: (context, projectViewModel, toDoProvider, child) { - _selectedLanguage = projectViewModel.isArabic ? 0 : 1; - return AppScaffold( - appBarTitle: TranslationBase.of(context).welcome, - isShowDecPage: false, - isShowAppBar: true, - isshowBackButton: false, - showNewAppBar: true, - backgroundColor: Color(0xffF8F8F8), - showNewAppBarTitle: false, - showDropDown: true, - isShowLanguageChanger: true, - appBarIcons: [], - dropDownList: [ - TranslationBase.of(context).arabicChange, - TranslationBase.of(context).english, - ], - dropDownIndexChange: (value) { - changeLanguage(projectViewModel, value!); - }, - dropdownIndexValue: _selectedLanguage, - // Use the state variable - body: Column( - children: [ - Expanded( - child: ListView( - padding: EdgeInsets.only(left: 21, right: 21), - physics: BouncingScrollPhysics(), - children: [ - SizedBox(height: 30), - Row( - children: [ - SvgPicture.asset( - "assets/images/new/hmg_icon.svg", - height: 62, - width: 62, - ), - ], - ), - // Example of using toDoProvider: - // if (toDoProvider.count > 0) Text("To-Do items: ${toDoProvider.count}"), - ], - ), - ), - Spacer(), - Expanded( - child: Container( - padding: EdgeInsets.only(top: 30, bottom: 0, right: 21, left: 21), - child: Text( - "Welcome to Dr. Sulaiman Al Habib Medical Group", - style: TextStyle(fontSize: 36, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 47 / 36), + return SafeArea( + child: AppScaffold( + appBarTitle: TranslationBase.of(context).welcome, + isShowDecPage: false, + isShowAppBar: true, + isshowBackButton: false, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: false, + showDropDown: true, + isShowLanguageChanger: true, + appBarIcons: [], + dropDownList: [ + // TranslationBase.of(context).arabicChange, + // TranslationBase.of(context).english, + ], + dropDownIndexChange: (value) { + changeLanguage(projectViewModel, value!); + }, + dropdownIndexValue: _selectedLanguage, + // Use the state variable + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.only(left: 21, right: 21), + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 30), + Row( + children: [ + SvgPicture.asset( + "assets/images/new/hmg_icon.svg", + height: 62, + width: 62, + ), + ], ), - ), + // Example of using toDoProvider: + // if (toDoProvider.count > 0) Text("To-Do items: ${toDoProvider.count}"), + ], ), - Container( - padding: EdgeInsets.only(top: 16, bottom: 10, right: 21, left: 21), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Directionality( - textDirection: TextDirection.ltr, // Consider making this dynamic based on language - child: inputWidget( - "National ID. or File No", - "1xxxxxxxx", - nationIdController, // Assumed to be a TextEditingController in your State class - isEnable: true, - prefix: null, - hasSelection: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - leadingIcon: "assets/images/svg/student-card.svg", - ), - ), - ], + ), + Spacer(), + Container( + padding: EdgeInsets.only(top: 30, bottom: 0, right: 21, left: 21), + child: Text( + TranslationBase.of(context).welcomeToDrSulaiman, + style: TextStyle( + fontSize: 36, + fontFamily: (projectViewModel.currentLanguage == 'ar' ? 'Cairo' : 'Poppins'), + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.4, + height: 47 / 36, ), ), - SizedBox( - height: 15, + ), + Container( + padding: EdgeInsets.only(top: 16, bottom: 10, right: 21, left: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Directionality( + textDirection: TextDirection.ltr, // Consider making this dynamic based on language + child: inputWidget( + "National ID. or File No", + "1xxxxxxxx", + nationIdController, // Assumed to be a TextEditingController in your State class + isEnable: true, + prefix: null, + hasSelection: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + leadingIcon: "assets/images/svg/student-card.svg", + ), + ), + ], ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(top: 0, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).login, - () { + ), + SizedBox( + height: 15, + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(10.0), + child: CustomButton( + text: TranslationBase.of(context).login, + icon: "assets/images/svg/login1.svg", + onPressed: () { bool isValid = validateIqama(nationIdController.text); print("Iqama is valid: $isValid"); @@ -280,53 +284,56 @@ class _WelcomeLogin extends State { } else { Utils.showErrorToast("Please enter a valid Iqama number."); } - }, - textColor: Colors.white, - ), - ), + }), ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - color: Colors.black, - fontSize: 16, - height: 26 / 16, - fontFamily: 'poppins', - fontWeight: FontWeight.w500, + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle( + color: Colors.black, + fontSize: 16, + height: 26 / 16, + fontFamily: 'poppins', + fontWeight: FontWeight.w500, + ), + children: [ + TextSpan( + text: TranslationBase.of(context).dontHaveAccount, ), - children: [ - TextSpan(text: 'Don’t have an account? '), - TextSpan( - text: 'Register now', - style: const TextStyle( - color: Colors.red, - fontSize: 16, - height: 26 / 16, - fontFamily: 'poppins', - fontWeight: FontWeight.w500, - ), - recognizer: TapGestureRecognizer() - ..onTap = () { - Navigator.of(context).push(FadePage(page: RegisterNew())); - locator().loginRegistration.visited_alhabib_group(true); - }, + TextSpan(text: " "), + TextSpan( + text: TranslationBase.of(context).registerNow, + style: const TextStyle( + color: Colors.red, + fontSize: 16, + height: 26 / 16, + fontFamily: 'poppins', + fontWeight: FontWeight.w500, ), - ], - ), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.of(context).push(FadePage(page: RegisterNew())); + locator().loginRegistration.visited_alhabib_group(true); + }, + ), + ], ), - ], - ) - ], - ), - ); - }, + ), + ], + ), + SizedBox( + height: 10, + ), + ], + ), + ), ); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index af935b2c..b19943a2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -3474,6 +3474,8 @@ class TranslationBase { String get liveCareTermsConditions47 => localizedValues["liveCareTermsConditions47"][locale.languageCode]; String get liveCareTermsConditions48 => localizedValues["liveCareTermsConditions48"][locale.languageCode]; String get clickPrivacyPolicy => localizedValues["clickPrivacyPolicy"][locale.languageCode]; + String get welcomeToDrSulaiman => localizedValues["welcomeToDrSulaiman"][locale.languageCode]; + String get dontHaveAccount => localizedValues["dontHaveAccount"][locale.languageCode]; } diff --git a/lib/widgets/drawer/langauge_picker.dart b/lib/widgets/drawer/langauge_picker.dart index 0d7bb380..85a7a331 100644 --- a/lib/widgets/drawer/langauge_picker.dart +++ b/lib/widgets/drawer/langauge_picker.dart @@ -31,35 +31,34 @@ class _LanguageSelectorState extends State { borderRadius: BorderRadius.circular(12), color: Color(0xFFFEE9EA), ), - height: 40, - width: 93, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - InkWell( - onTap: () { - final newLanguage = widget.currentLanguage == 'ar' ? 'en' : 'ar'; - widget.onLanguageChanged(newLanguage); - }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - SvgPicture.asset("assets/images/svg/language.svg", width: 24), - const SizedBox(width: 8), - Text( - currentLangData['name']?.toUpperCase() ?? 'EN', - style: const TextStyle(fontWeight: FontWeight.w500, fontFamily: 'GESSTwo', fontSize: 14, color: Color(0xFFED1C2B)), - ), - ], + child: InkWell( + onTap: () { + final newLanguage = widget.currentLanguage == 'ar' ? 'en' : 'ar'; + widget.onLanguageChanged(newLanguage); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset("assets/images/svg/language.svg", width: 24), + const SizedBox(width: 6), + Text( + currentLangData['name']?.toUpperCase() ?? 'EN', + style: TextStyle( + fontWeight: FontWeight.w500, + // fontFamily: 'GESSTwo', + fontFamily: (widget.currentLanguage == 'ar' ? 'Cairo' : 'Poppins'), + fontSize: 14, + color: const Color(0xFFED1C2B), + letterSpacing: 0.1), ), - ), + ], ), - ], + ), ), ), ]); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index b611c761..17833dc7 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -387,6 +387,8 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { titleSpacing: -8, // centerTitle: false, title: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, children: [ if (showTitle) Expanded( @@ -438,19 +440,15 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Directionality( - textDirection: TextDirection.ltr, + textDirection: TextDirection.rtl, child: LanguageSelector( currentLanguage: dropdownIndexValue == 0 ? 'ar' : 'en', onLanguageChanged: (String value) { - print(value); - print(value); dropDownIndexChange!(value == 'ar' ? 0 : 1); - // dropdownIndexValue = value == 'ar' ? 0 : 1; - }, languages: [ - {'code': 'ar', 'name': '${TranslationBase.of(context).arabicChange}'}, - {'code': 'en', 'name': '${TranslationBase.of(context).english}'} + {'code': 'ar', 'name': '${TranslationBase.of(context).lanEnglish}'}, + {'code': 'en', 'name': '${TranslationBase.of(context).lanArabic}'} ], ), ), From 4245804949374312d121117ad21323bf4c3793e0 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Wed, 9 Jul 2025 14:50:30 +0300 Subject: [PATCH 2/2] consumer on welcome & language & font --- lib/widgets/drawer/langauge_picker.dart | 2 ++ lib/widgets/others/app_scaffold_widget.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/widgets/drawer/langauge_picker.dart b/lib/widgets/drawer/langauge_picker.dart index 85a7a331..b4cc024b 100644 --- a/lib/widgets/drawer/langauge_picker.dart +++ b/lib/widgets/drawer/langauge_picker.dart @@ -34,7 +34,9 @@ class _LanguageSelectorState extends State { child: InkWell( onTap: () { final newLanguage = widget.currentLanguage == 'ar' ? 'en' : 'ar'; + print(newLanguage); widget.onLanguageChanged(newLanguage); + }, child: Container( padding: EdgeInsets.all(8), diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 17833dc7..188e9ebd 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -440,7 +440,7 @@ class NewAppBarWidget extends StatelessWidget implements PreferredSizeWidget { Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Directionality( - textDirection: TextDirection.rtl, + textDirection: TextDirection.ltr, child: LanguageSelector( currentLanguage: dropdownIndexValue == 0 ? 'ar' : 'en', onLanguageChanged: (String value) {