diff --git a/lib/core/viewModels/dashboard_view_model.dart b/lib/core/viewModels/dashboard_view_model.dart index 4f261c65..e085e476 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -19,7 +19,7 @@ class DashboardViewModel extends BaseViewModel { getPatientRadOrders() async { if (isLogin && _vitalSignService.weightKg.isEmpty) { - setState(ViewState.Busy); + setState(ViewState.Busy); await _vitalSignService.getPatientRadOrders(); if (_vitalSignService.hasError) { error = _vitalSignService.error; diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 7a28b3f9..154b45f4 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -709,19 +709,21 @@ class _MyFamily extends State with TickerProviderStateMixin { result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); var mainUser = await sharedPref.getObject(MAIN_USER); + var bloodType = await sharedPref.getString(BLOOD_TYPE); this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } this.sharedPref.setString(APP_LANGUAGE, currentLang); this.sharedPref.setObject(MAIN_USER, mainUser); - //sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']); + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); await authenticatedUserObject.getUser(getUser: true); - Provider.of(context, listen: false).setUser( authenticatedUserObject.user); + Provider.of(context, listen: false) + .setUser(authenticatedUserObject.user); //this.checkIfUserAgreedBefore(result), Navigator.of(context).pushNamed( diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 03c803b7..b6049c0b 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -43,7 +43,6 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { ToDoCountProviderModel toDoProvider; - AuthenticatedUserObject authenticatedUserObject = locator(); @@ -81,15 +80,19 @@ class _HomePageState extends State { left: 5, right: 5, child: Container( - width: MediaQuery.of(context).size.width * 0.8, + width: + MediaQuery.of(context).size.width * 0.8, child: Container(), ), ) ], ), - ), - Container(width: double.infinity, height:projectViewModel.isArabic ? MediaQuery.of(context).size.width * 0.3 :110), + Container( + width: double.infinity, + height: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.3 + : 110), ], ), Positioned( @@ -104,7 +107,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin ) + child: (!model.isLogin) ? Container( width: double.infinity, height: 160, @@ -173,7 +176,6 @@ class _HomePageState extends State { color: Theme.of(context) .primaryColor, fontSize: 14, - ), ), ), @@ -207,7 +209,8 @@ class _HomePageState extends State { children: [ Row( children: [ - if (projectViewModel.user != null && model.isLogin) + if (projectViewModel.user != null && + model.isLogin) Expanded( child: Column( crossAxisAlignment: @@ -217,9 +220,11 @@ class _HomePageState extends State { height: 8, ), Texts( - projectViewModel.user.firstName + + projectViewModel + .user.firstName + " " + - projectViewModel.user.lastName, + projectViewModel + .user.lastName, color: Colors.grey[100], bold: true, fontSize: 15, @@ -265,7 +270,8 @@ class _HomePageState extends State { ), child: Center( child: Texts( - TranslationBase.of(context).myMedicalFile, + TranslationBase.of(context) + .myMedicalFile, color: Theme.of(context) .primaryColor, fontSize: 12, @@ -300,7 +306,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).height, + TranslationBase.of( + context) + .height, color: Colors.white, fontSize: 10, ), @@ -332,7 +340,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).weight, + TranslationBase.of( + context) + .weight, color: Colors.white, fontSize: 10, ) @@ -346,8 +356,10 @@ class _HomePageState extends State { ), Expanded( child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( 'assets/images/blood-drop.png', @@ -359,9 +371,14 @@ class _HomePageState extends State { Texts( '${model.booldType}', color: Colors.white, + fontSize: 14, + fontWeight: + FontWeight.bold, ), Texts( - TranslationBase.of(context).bloodType, + TranslationBase.of( + context) + .bloodType, color: Colors.white, fontSize: 10, ) @@ -400,28 +417,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), - + SizedBox( + height: 15, + ), Container( width: 60, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/medical/vital_sign_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/medical/vital_sign_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( - TranslationBase.of(context) - .vitalSigns, + TranslationBase.of(context).vitalSigns, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -449,26 +473,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( width: 50, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/search_medicine_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/search_medicine_icon.png', width: 50, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( TranslationBase.of(context).searchMedicine, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -480,8 +513,9 @@ class _HomePageState extends State { ), ), Expanded( - child: DashboardItem(opacity: 1.0, - onTap: (){ + child: DashboardItem( + opacity: 1.0, + onTap: () { Navigator.push( context, FadePage( @@ -494,25 +528,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/online_payment_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/online_payment_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 15, ), - SizedBox(height: 15,), Texts( - TranslationBase.of(context).onlinePaymentService, + TranslationBase.of(context) + .onlinePaymentService, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -526,7 +570,9 @@ class _HomePageState extends State { ], ), ), - SizedBox(height: 8,), + SizedBox( + height: 8, + ), // Padding( // padding: const EdgeInsets.all(8.0), // child: LineChartSample1(), @@ -553,34 +599,33 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, + title: + TranslationBase.of(context).myAppointments, imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, + subTitle: TranslationBase.of(context) + .myAppointmentsList, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: LabsHomePage())), child: MedicalProfileItem( title: TranslationBase.of(context).lab, imagePath: 'lab_result_icon.png', - subTitle: - TranslationBase.of(context).lab, + subTitle: TranslationBase.of(context).lab, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: RadiologyHomePage())), child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, + title: TranslationBase.of(context).radiology, imagePath: 'radiology_icon.png', subTitle: TranslationBase.of(context) .radiologySubtitle, @@ -603,8 +648,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, + title: TranslationBase.of(context).medicines, imagePath: 'prescription_icon.png', subTitle: TranslationBase.of(context) .medicinesSubtitle, @@ -623,8 +667,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, + title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context) .myDoctorSubtitle, @@ -635,12 +678,11 @@ class _HomePageState extends State { flex: 1, child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); + Navigator.push( + context, FadePage(page: InsuranceCard())); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, + title: TranslationBase.of(context).insurance, imagePath: 'insurance_card_icon.png', subTitle: TranslationBase.of(context) .insuranceSubtitle, @@ -649,7 +691,6 @@ class _HomePageState extends State { ), ], ), - ], ), ), @@ -662,7 +703,7 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ DashboardItem( - opacity:1.0, + opacity: 1.0, child: Container( width: double.infinity, padding: EdgeInsets.all(10), @@ -675,7 +716,8 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -693,13 +735,17 @@ class _HomePageState extends State { ), height: 112, imageName: 'ask_doctor_bg.png', - //color: Colors.grey[700], + //color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, onTap: () => Navigator.push( - context, FadePage(page: AllHabibMedicalService(goToMyProfile: widget.goToMyProfile,))), + context, + FadePage( + page: AllHabibMedicalService( + goToMyProfile: widget.goToMyProfile, + ))), ), DashboardItem( - opacity:1.0, + opacity: 1.0, onTap: () { Navigator.push( context, FadePage(page: ContactUsPage())); @@ -719,7 +765,7 @@ class _HomePageState extends State { TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.0 , + fontSize: SizeConfig.textMultiplier * 1.0, ), Expanded( child: Container(), diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 5c2d3a3c..c3799425 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -20,7 +20,8 @@ class LocationUtils { Geolocator.checkPermission().then((permission) { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getLastKnownPosition().then((value) => setLocation(value)); + Geolocator.getLastKnownPosition() + .then((value) => setLocation(value)); } if (permission == LocationPermission.denied || @@ -57,9 +58,12 @@ class LocationUtils { } void setLocation(Position position) { - print(position); - this.sharedPref.setDouble(USER_LAT, position.latitude ?? 0.0); - this.sharedPref.setDouble(USER_LONG, position.longitude ?? 0.0); + this + .sharedPref + .setDouble(USER_LAT, position != null ? position.latitude : 0.0); + this + .sharedPref + .setDouble(USER_LONG, position != null ? position.longitude : 0.0); } void setZeroLocation() { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 09a1fa33..da227d96 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -567,19 +567,21 @@ class _AppDrawerState extends State { var familyFile = await sharedPref.getObject(FAMILY_FILE); var currentLang = await sharedPref.getString(APP_LANGUAGE); var mainUser = await sharedPref.getObject(MAIN_USER); + var bloodType = await sharedPref.getString(BLOOD_TYPE); this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } this.sharedPref.setString(APP_LANGUAGE, currentLang); - // sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']); + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setObject(MAIN_USER, mainUser); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); await authenticatedUserObject.getUser(getUser: true); - Provider.of(context, listen: false).setUser( authenticatedUserObject.user); + Provider.of(context, listen: false) + .setUser(authenticatedUserObject.user); appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => {