From 21ccf1ef86b54f8ce0c8433b7d260f1f101f5fb8 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 9 Dec 2020 21:48:21 +0300 Subject: [PATCH 1/2] bug fixes --- lib/core/service/client/base_app_client.dart | 10 +- lib/pages/landing/home_page.dart | 185 ++++++----- lib/pages/login/login-type.dart | 295 +++++++++--------- lib/pages/login/login.dart | 57 ++-- .../authentication/auth_provider.dart | 20 +- .../others/floating_button_search.dart | 4 +- 6 files changed, 312 insertions(+), 259 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 0e940a53..1caea0fe 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -157,9 +157,13 @@ class BaseAppClient { onFailure('Please Check The Internet Connection', -1); } } catch (e) { - print(e); - onFailure('Failed to connect to the server', -1); - // onFailure(e.toString(), -1); + //print(e); + // + if (e is String) { + onFailure(e.toString(), -1); + } else { + onFailure('Failed to connect to the server', -1); + } } } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index fbdaf906..41f9f309 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -27,7 +27,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import '../../locator.dart'; class HomePage extends StatefulWidget { @@ -49,8 +49,8 @@ class _HomePageState extends State { // }); // super.initState(); // } - AuthenticatedUserObject authenticatedUserObject = locator(); - + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { @@ -93,9 +93,10 @@ class _HomePageState extends State { ) ], ), - ), - Container(width: double.infinity, height:projectViewModel.isArabic ? 120:110), + Container( + width: double.infinity, + height: projectViewModel.isArabic ? 120 : 110), ], ), Positioned( @@ -110,7 +111,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin ) + child: (!model.isLogin) ? Container( width: double.infinity, height: 160, @@ -179,7 +180,6 @@ class _HomePageState extends State { color: Theme.of(context) .primaryColor, fontSize: 14, - ), ), ), @@ -307,7 +307,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).height, + TranslationBase.of( + context) + .height, color: Colors.white, fontSize: 10, ), @@ -339,7 +341,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).weight, + TranslationBase.of( + context) + .weight, color: Colors.white, fontSize: 10, ) @@ -353,8 +357,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', @@ -368,7 +374,9 @@ class _HomePageState extends State { color: Colors.white, ), Texts( - TranslationBase.of(context).bloodType, + TranslationBase.of( + context) + .bloodType, color: Colors.white, fontSize: 10, ) @@ -407,28 +415,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/vital_sign_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/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, ) ], ), @@ -456,26 +471,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, ) ], ), @@ -487,8 +511,9 @@ class _HomePageState extends State { ), ), Expanded( - child: DashboardItem(opacity: 1.0, - onTap: (){ + child: DashboardItem( + opacity: 1.0, + onTap: () { Navigator.push( context, FadePage( @@ -501,25 +526,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, ) ], ), @@ -555,34 +590,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, @@ -605,8 +639,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, @@ -625,8 +658,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, @@ -637,12 +669,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, @@ -651,7 +682,6 @@ class _HomePageState extends State { ), ], ), - ], ), ), @@ -664,7 +694,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), @@ -677,31 +707,38 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, ), - Expanded( - child: Container(), - ), - Texts( + // Expanded( + // child: Container(), + // ), + Text( TranslationBase.of(context).viewAll, - color: Colors.white, - bold: true, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold), + overflow: TextOverflow.ellipsis, ) ], ), ), - height: 100, + height: 106, 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())); @@ -721,7 +758,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(), @@ -786,7 +823,9 @@ class DashboardItem extends StatelessWidget { this.width, this.height, this.color, - this.opacity = 1.0,this.icon,this.margin=0}) + this.opacity = 1.0, + this.icon, + this.margin = 0}) : super(key: key); final bool hasBorder; final String imageName; diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index dcd58b9d..6113fb71 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -14,159 +14,168 @@ class LoginType extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).login, + appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, isShowDecPage: false, - body: Padding( - padding: EdgeInsets.all(20), - child: Column( - children: [ - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).logintypeRadio, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - marginBottom: 20.0, - marginTop: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + body: SingleChildScrollView( + child: Container( + padding: + EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column( + children: [ + Expanded( + flex: 4, + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: InkWell( - onTap: () => { - LoginType.loginType = 1, - Navigator.of(context) - .pushNamed(LOGIN_PAGE) - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 20, 10, 20, 10), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/id_card_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + AppText( + TranslationBase.of(context).logintypeRadio, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.start, + marginBottom: 20.0, + marginTop: 20.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 1, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 20, 10, 20, 10), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/id_card_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .idNo, + fontSize: SizeConfig + .textMultiplier * + 2, + fontWeight: FontWeight.bold, + ) + ], ), - AppText( - TranslationBase.of(context) - .idNo, - fontSize: - SizeConfig.textMultiplier * + )))), + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 2, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 25, 10, 25, 10), + child: Column( + children: [ + Image.asset( + 'assets/images/my_file_white_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .fileNo, + fontSize: SizeConfig + .textMultiplier * 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))), - Expanded( + fontWeight: FontWeight.bold, + ) + ], + ), + )))) + ], + ), + SizedBox( + height: 25, + ), + Divider( + color: Colors.grey, + height: 2, + ), + Center( child: InkWell( onTap: () => { - LoginType.loginType = 2, Navigator.of(context) - .pushNamed(LOGIN_PAGE) + .pushNamed(FORGOT_PASSWORD) }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 25, 10, 25, 10), - child: Column( - children: [ - Image.asset( - 'assets/images/my_file_white_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .fileNo, - fontSize: - SizeConfig.textMultiplier * - 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))) - ], - ), - SizedBox(height: 25,), - Divider( - color: Colors.grey, - height: 2, - ), - Center( - child: InkWell( - onTap: () => { - Navigator.of(context) - .pushNamed(FORGOT_PASSWORD) - }, - child: AppText( - TranslationBase.of(context).forgotPassword, - fontSize: SizeConfig.textMultiplier * 2.5, - marginTop: 20.0, - underline: true))) - ]), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox(height: 10,), - Row( + child: AppText( + TranslationBase.of(context) + .forgotPassword, + fontSize: + SizeConfig.textMultiplier * 2.5, + marginTop: 20.0, + underline: true))) + ]), + ), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, children: [ - - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => { - Navigator.of(context).pushNamed( - REGISTER, - ) - }, - )), + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => { + Navigator.of(context).pushNamed( + REGISTER, + ) + }, + )), + ], + ), ], - ), - ], - )) - ], - ))); + )) + ], + )))); } } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index a1540ef7..cb3ae1a4 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -93,23 +93,24 @@ class _Login extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Directionality( - textDirection:TextDirection.ltr,child:Container( - child: TextFields( - fontWeight: FontWeight.normal, - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - ))) + Directionality( + textDirection: TextDirection.ltr, + child: Container( + child: TextFields( + fontWeight: FontWeight.normal, + controller: nationalIDorFile, + onChanged: (value) => {validateForm()}, + prefixIcon: Icon( + loginType == 1 + ? Icons.chrome_reader_mode + : Icons.receipt, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: loginType == 1 + ? TranslationBase.of(context).nationalID + : TranslationBase.of(context).fileNo, + ))) ], ), ), @@ -122,7 +123,9 @@ class _Login extends State { color: Colors.grey, height: 2, ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), Row( children: [ Expanded( @@ -152,18 +155,14 @@ class _Login extends State { } void validateForm() { - //TODO fix login - if (util.validateIDBox(nationalIDorFile.text, loginType) == - true /*&& - mobileNo.length >= 9 */ - && + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } } @@ -209,15 +208,13 @@ class _Login extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - ConfirmDialog.closeAlertDialog(context), + ConfirmDialog.closeAlertDialog(context), Navigator.of(context).pushNamed( REGISTER, ), - }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - }); // SMSOTP.showLoadingDialog(context, false), } @@ -244,9 +241,9 @@ class _Login extends State { this.authService.checkActivationCode(request, code).then((result) => { sharedPref.remove(FAMILY_FILE), result = CheckActivationCode.fromJson(result), - result.list.isFamily =false, - this.sharedPref.setObject(USER_PROFILE, result.list), - this.sharedPref.setObject(MAIN_USER, result.list), + result.list.isFamily = false, + this.sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), authenticatedUserObject.getUser(), diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 59f51bfc..07e1e301 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -173,15 +173,19 @@ class AuthProvider with ChangeNotifier { request.generalid = GENERAL_ID; request.languageID = LANGUAGE_ID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; - - dynamic localRes; - await new BaseAppClient().post(CHECK_PATIENT_AUTH, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { + try { + dynamic localRes; + await new BaseAppClient().post(CHECK_PATIENT_AUTH, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request.toJson()); + return Future.value(localRes); + } catch (error) { throw error; - }, body: request.toJson()); - return Future.value(localRes); + //throw error; + } } Future getLoginInfo(request) async { diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 2bfacaea..babbf052 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -823,13 +823,13 @@ class _FloatingSearchButton extends State speak() async { if (_currentLocaleId == 'en' && results['ReturnMessage'] != null) { - await flutterTts.setVoice("en-us-x-sfg#male_2-local"); + //await flutterTts.setVoice("en-us-x-sfg#male_2-local"); await flutterTts.setLanguage("en-US"); await flutterTts.speak(results['ReturnMessage']); } else if (results['ReturnMessage_Ar'] != null) { await flutterTts.setLanguage("ar-SA"); - await flutterTts.setVoice("ar-sa-x-sfg#male_1-local"); + //await flutterTts.setVoice("ar-sa-x-sfg#male_1-local"); await flutterTts.speak(results['ReturnMessage_Ar']); } // Future.delayed(const Duration(seconds: 10), () { From eca2266f7b03d67e28d22f9d4a81dc3d92aa312a Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 9 Dec 2020 23:23:14 +0200 Subject: [PATCH 2/2] hot fixing --- lib/config/localized_values.dart | 18 +++- .../insurance/insurance_card_screen.dart | 87 +++++++++++-------- lib/pages/insurance/insurance_details.dart | 26 +++--- .../prescription_details_page.dart | 20 +++-- .../prescriptions_home_page.dart | 2 +- .../prescriptions/prescriptions_page.dart | 4 +- .../radiology/radiology_details_page.dart | 7 +- lib/uitl/translations_delegate_base.dart | 4 + .../LabResult/Lab_Result_details_wideget.dart | 3 +- .../data_display/medical/doctor_card.dart | 4 +- 10 files changed, 107 insertions(+), 68 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f7b5f234..313cbbb2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1175,5 +1175,21 @@ const Map localizedValues = { 'details':{ 'en':'Details', 'ar':'التفاصيل' - } + }, + "active-insurence": { + "en": "Active", + "ar": "نشطة" + }, + "not-active": { + "en": "Not Active", + "ar": "غير نشط" + }, + "card-detail": { + "en": "Insurance Details", + "ar": "منافعك التامينية" + }, + "Dr": { + "en": "Dr. ", + "ar": "الدكتور." + }, }; diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 5f8c6777..42357eea 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -20,18 +20,23 @@ import '../base/base_view.dart'; class InsuranceCard extends StatefulWidget { int appointmentNo; - InsuranceCard({this.appointmentNo}); @override _InsuranceCardState createState() => _InsuranceCardState(); } + class _InsuranceCardState extends State { InsuranceCardService _insuranceCardService = locator(); List imagesInfo = List(); + @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); return BaseView( onModelReady: (model) => model.getInsurance(), @@ -79,16 +84,16 @@ class _InsuranceCardState extends State { padding: EdgeInsets.all(14), width: double.infinity, decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.grey,width: 0.2), - borderRadius: BorderRadius.all(Radius.circular(2)), - boxShadow: [ - BoxShadow( - color: Colors.white70, - ), - - ] - ), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.grey, width: 0.2), + borderRadius: + BorderRadius.all(Radius.circular(2)), + boxShadow: [ + BoxShadow( + color: Colors.white70, + ), + ]), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -103,28 +108,34 @@ class _InsuranceCardState extends State { thickness: 0.5, ), Column( - crossAxisAlignment: CrossAxisAlignment.stretch, + crossAxisAlignment: + CrossAxisAlignment.stretch, children: [ Text( TranslationBase.of(context).category + - model.insurance[index].subCategoryDesc, + model.insurance[index] + .subCategoryDesc, style: TextStyle(fontSize: 18.5), ), Text( - TranslationBase.of(context).expirationDate + - convertDateFormat( - model.insurance[index].cardValidTo), + TranslationBase.of(context) + .expirationDate + + convertDateFormat(model + .insurance[index].cardValidTo), style: TextStyle(fontSize: 18.5), ), Text( - TranslationBase.of(context).patientCard + - model.insurance[index].patientCardID, + TranslationBase.of(context) + .patientCard + + model + .insurance[index].patientCardID, style: TextStyle(fontSize: 18.5), ), Text( - TranslationBase.of(context).policyNumber + - model - .insurance[index].insurancePolicyNumber, + TranslationBase.of(context) + .policyNumber + + model.insurance[index] + .insurancePolicyNumber, style: TextStyle(fontSize: 18.5), ), ], @@ -132,16 +143,18 @@ class _InsuranceCardState extends State { Column( children: [ model.insurance[index].isActive == true - ? Text('Active', - style: TextStyle( + ? Texts( + TranslationBase.of(context) + .activeInsurence, color: Colors.green, fontWeight: FontWeight.w900, - fontSize: 17.9)) - : Text('Not Active', - style: TextStyle( + fontSize: 17.9) + : Texts( + TranslationBase.of(context) + .notActive, color: Colors.red, fontWeight: FontWeight.w900, - fontSize: 17.9)) + fontSize: 17.9) ], ), SizedBox( @@ -151,7 +164,9 @@ class _InsuranceCardState extends State { Container( color: Colors.transparent, child: SecondaryButton( - onTap:()=>{ getDetails(model.insurance[index])}, + onTap: () => { + getDetails(model.insurance[index]) + }, label: TranslationBase.of(context).seeDetails, textColor: Colors.white, ), @@ -160,8 +175,6 @@ class _InsuranceCardState extends State { ], ), ), - - ], ), ], @@ -191,13 +204,13 @@ class _InsuranceCardState extends State { return newDate.toString(); } - getDetails(data){ + + getDetails(data) { GifLoaderDialogUtils.showMyDialog(context); _insuranceCardService.getInsuranceDetails(data).then((value) => { - GifLoaderDialogUtils.hideDialog(context), - Navigator.push(context, - FadePage(page: InsuranceCardDetails(data:value[0]['CheckList']))) - - }); + GifLoaderDialogUtils.hideDialog(context), + Navigator.push(context, + FadePage(page: InsuranceCardDetails(data: value[0]['CheckList']))) + }); } } diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart index d0a829be..16745e9e 100644 --- a/lib/pages/insurance/insurance_details.dart +++ b/lib/pages/insurance/insurance_details.dart @@ -1,35 +1,29 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:html/dom.dart' as dom; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class InsuranceCardDetails extends StatefulWidget { +class InsuranceCardDetails extends StatelessWidget { final String data; InsuranceCardDetails({this.data}); - @override - _InsuranceCardInsuranceCardDetailsState createState() => _InsuranceCardInsuranceCardDetailsState(); -} -//TODO fix it -class _InsuranceCardInsuranceCardDetailsState extends State { @override Widget build(BuildContext context) { - return - AppScaffold( - isShowAppBar: true, - - body: Center( - child: SingleChildScrollView( + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).cardDetail, + body: Center( + child: SingleChildScrollView( child: Html( - data:widget.data, - ) - ) + data: data, + ), + ), ), ); } - } diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 024de17c..d59bc06d 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -105,22 +105,29 @@ class PrescriptionDetailsPage extends StatelessWidget { color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).way))), + child: Center( + child: Texts(TranslationBase.of(context).way))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).average))), + child: Center( + child: + Texts(TranslationBase.of(context).average))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).dailyDoses))), + child: Center( + child: Texts( + TranslationBase.of(context).dailyDoses))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).period))), + child: Center( + child: + Texts(TranslationBase.of(context).period))), ], ), TableRow( @@ -136,7 +143,8 @@ class PrescriptionDetailsPage extends StatelessWidget { height: 50, width: double.infinity, child: Center( - child: Text(prescriptionReport.frequencyN?? ''))), + child: + Text(prescriptionReport.frequencyN ?? ''))), Container( color: Colors.white, height: 50, @@ -174,7 +182,7 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox( height: 5, ), - Texts(prescriptionReport.remarks), + Texts(prescriptionReport.remarks ?? ''), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 94484340..b13933c6 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -83,7 +83,7 @@ class _HomePrescriptionsPageState extends State controller: _tabController, indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index 6b852db9..dc842bdc 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -37,7 +37,7 @@ class PrescriptionsPage extends StatelessWidget { leading: Radio( value: FilterType.Clinic, groupValue: prescriptionsViewModel.filterType, - activeColor: Colors.red[800], + activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) { prescriptionsViewModel.setFilterType(value); }, @@ -55,7 +55,7 @@ class PrescriptionsPage extends StatelessWidget { leading: Radio( value: FilterType.Hospital, groupValue: prescriptionsViewModel.filterType, - activeColor: Colors.red[800], + activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) { prescriptionsViewModel.setFilterType(value); }, diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 9f8a0640..53057953 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_mode import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -29,7 +30,11 @@ class RadiologyDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text('${finalRadiology.reportData}',textAlign: TextAlign.center,), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts('${finalRadiology.reportData}',textAlign: TextAlign.start,fontSize: 17,), + ), + SizedBox(height: MediaQuery.of(context).size.height * 0.2,) ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 86e98b07..53ae86d4 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -945,6 +945,10 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get insurCards => localizedValues['insur-cards'][locale.languageCode]; String get labResult => localizedValues['labResult'][locale.languageCode]; String get details => localizedValues['details'][locale.languageCode]; + String get activeInsurence => localizedValues['active-insurence'][locale.languageCode]; + String get notActive => localizedValues['not-active'][locale.languageCode]; + String get cardDetail => localizedValues['card-detail'][locale.languageCode]; + String get dr => localizedValues['Dr'][locale.languageCode]; } diff --git a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart index 1f09dcf7..753f3deb 100644 --- a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart +++ b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart @@ -86,8 +86,7 @@ class _VitalSignDetailsWidgetState extends State { color: Colors.white, child: Center( child: Texts( - // '${DateUtil.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${DateUtil.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', - '${vital.sampleCollectedOn}', + '${vital.verifiedOn}', textAlign: TextAlign.center, ), ), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 732a8934..2e70f2ab 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -96,7 +96,7 @@ class DoctorCard extends StatelessWidget { Expanded( flex: 1, child: LargeAvatar( - name: name, + name:name, url: profileUrl, ), ), @@ -108,7 +108,7 @@ class DoctorCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - name, + TranslationBase.of(context).dr+" "+ name, bold: true, ), Texts(