diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6bdca5c5..3904ed1f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -738,5 +738,6 @@ const Map> localizedValues = { 'en': "A Sick leave is on Hold status for this patient", 'ar': "الإجازة المرضية في حالة الانتظار لهذا المريض" }, - 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"} + 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"}, + 'otherStatistic': {'en': "Other Statistics", 'ar': "دیگر شماریات"}, }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index c16bf7ea..5797b0c1 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -63,6 +63,7 @@ class _DashboardScreenState extends State { bool isExpanded = false; String isInpatient = ""; var clinicName = []; + var clinicId; void didChangeDependencies() async { super.didChangeDependencies(); @@ -146,48 +147,81 @@ class _DashboardScreenState extends State { width: MediaQuery.of(context).size.width * .6, // height: 100, child: projectsProvider.doctorClinicsList.length > 0 - ? DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.white, - isExpanded: true, - value: clinicId == null - ? projectsProvider - .doctorClinicsList[0].clinicID - : clinicId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return projectsProvider.doctorClinicsList - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( + ? Stack( + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.white, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[0].clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return projectsProvider.doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item.clinicName, + fontSize: + SizeConfig.textMultiplier * + 2.1, + color: Colors.white, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + }, + items: projectsProvider.doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( item.clinicName, - fontSize: - SizeConfig.textMultiplier * 2.1, + textAlign: TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + Positioned( + right: projectsProvider.isArabic ? 35 : 0, + top: 0, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + projectsProvider + .doctorClinicsList.length + .toString(), + style: new TextStyle( color: Colors.white, + fontSize: projectsProvider.isArabic + ? 10 + : 11, ), - ], - ); - }).toList(); - }, - onChanged: (newValue) { - clinicId = newValue; - changeClinic(newValue, context); - }, - items: projectsProvider.doctorClinicsList - .map((item) { - return DropdownMenuItem( - child: Text( - item.clinicName, - textAlign: TextAlign.end, + textAlign: TextAlign.center, + ), ), - value: item.clinicID, - ); - }).toList(), - )) + ) + ], + ) : AppText(TranslationBase.of(context).noClinic), ), ), @@ -284,7 +318,7 @@ class _DashboardScreenState extends State { // ), Container( color: Colors.white, - height: MediaQuery.of(context).size.height * 0.22, + height: MediaQuery.of(context).size.height * 0.23, ), ], ), @@ -293,14 +327,68 @@ class _DashboardScreenState extends State { left: 9, top: MediaQuery.of(context).size.height * .1, child: Container( - height: MediaQuery.of(context).size.height * 0.30, + height: MediaQuery.of(context).size.height * 0.28, child: model.dashboardItemsList.length > 0 ? new Swiper( itemBuilder: (BuildContext context, int index) { return getSwiperWidget(model)[index]; }, - itemCount: 2, - // pagination: new SwiperPagination(), + itemCount: 3, + + pagination: new SwiperCustomPagination(builder: + (BuildContext context, + SwiperPluginConfig config) { + return new Stack( + alignment: Alignment.bottomCenter, + children: [ + Positioned( + bottom: -5, + child: Center( + child: InkWell( + onTap: () {}, + child: Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all( + 2), + color: config + .activeIndex == + 0 + ? Colors.black + : Colors.grey), + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all( + 2), + color: config + .activeIndex == + 1 + ? Colors.black + : Colors.grey), + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all( + 2), + color: config + .activeIndex == + 2 + ? Colors.black + : Colors.grey), + ], + ))))) + ]); + }), viewportFraction: 0.9, // scale: 0.9, // control: new SwiperControl(), @@ -738,119 +826,6 @@ class _DashboardScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.lab_results, - size: 40, - color: Colors.white, - ), - ), - Container( - // margin: EdgeInsets.only(bottom: 10), - child: Column( - children: [ - AppText( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[5]) - : "", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context) - .targetPatient, - textAlign: TextAlign.center, - color: Colors.white, - ) - ], - ), - ), - ], - ), - imageName: '1.png', - opacity: 0.82, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.radiology, - size: 40, - color: Colors.white, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10), - child: Column( - children: [ - AppText( - clinicName.length.toString(), - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).clinic, - color: Colors.white, - ) - ], - ), - ), - ], - ), - imageName: '2.png', - opacity: 0.9, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.referral, - size: 40, - color: Colors.white, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10), - child: Column( - children: [ - AppText( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[2]) - : "", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).referral, - color: Colors.white, - ) - ], - ), - ), - ], - ), - imageName: '3.png', - opacity: 0.9, - ), - ], - ), SizedBox( height: 15, ), @@ -873,32 +848,27 @@ class _DashboardScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Center( - child: Icon( - DoctorApp.search_patient_1, - size: 50, - color: Colors.black, - ), + Icon( + DoctorApp.referred, + size: 50, + color: Colors.black, ), - Column( - children: [ - AppText( - TranslationBase.of(context).searchAbout, - color: Colors.black, - textAlign: TextAlign.center, - ), - AppText( - TranslationBase.of(context).patient, - color: Colors.black, - textAlign: TextAlign.center, - ) - ], + AppText( + TranslationBase.of(context).myReferredPatient, + color: Colors.black, + textAlign: TextAlign.center, ) ], ), hasBorder: true, onTap: () { - Navigator.of(context).pushNamed(PATIENT_SEARCH); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ReferredPatientScreen(), + // MyReferredPatient(), + ), + ); }, ), DashboardItem( @@ -906,23 +876,14 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - DoctorApp.mail, + DoctorApp.referral, size: 50, color: Colors.black, ), - Column( - children: [ - AppText( - TranslationBase.of(context).theDoctor, - textAlign: TextAlign.center, - color: Colors.black, - ), - AppText( - TranslationBase.of(context).reply, - textAlign: TextAlign.center, - color: Colors.black, - ), - ], + AppText( + TranslationBase.of(context).myReferralPatient, + textAlign: TextAlign.center, + color: Colors.black, ) ], ), @@ -931,7 +892,8 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => DoctorReplyScreen(), + builder: (context) => + MyReferralPatientScreen(), ), ); }, @@ -941,12 +903,11 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - DoctorApp.medicine_search, + DoctorApp.patient, size: 50, - color: Colors.black, ), AppText( - TranslationBase.of(context).searchMedicine, + TranslationBase.of(context).arrived, color: Colors.black, textAlign: TextAlign.center, ) @@ -954,14 +915,13 @@ class _DashboardScreenState extends State { ), hasBorder: true, onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicineSearchScreen(), - ), - ); + Navigator.of(context) + .pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": "7" + }); }, - ), + ) ], ), SizedBox( @@ -975,35 +935,32 @@ class _DashboardScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Icon( - DoctorApp.qr_code, - size: 50, - color: Colors.black, + Center( + child: Icon( + DoctorApp.search_patient_1, + size: 50, + color: Colors.black, + ), ), Column( children: [ AppText( - projectsProvider.isArabic - ? TranslationBase.of(context).reader - : TranslationBase.of(context).qr, + TranslationBase.of(context).searchAbout, color: Colors.black, textAlign: TextAlign.center, ), AppText( - projectsProvider.isArabic - ? TranslationBase.of(context).qr - : TranslationBase.of(context).reader, + TranslationBase.of(context).patient, color: Colors.black, textAlign: TextAlign.center, - ), + ) ], ) ], ), -// imageName: '1.png', hasBorder: true, onTap: () { - Navigator.of(context).pushNamed(QR_READER); + Navigator.of(context).pushNamed(PATIENT_SEARCH); }, ), DashboardItem( @@ -1011,14 +968,14 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - DoctorApp.referral, + DoctorApp.medicine_search, size: 50, color: Colors.black, ), AppText( - TranslationBase.of(context).myReferralPatient, - textAlign: TextAlign.center, + TranslationBase.of(context).searchMedicine, color: Colors.black, + textAlign: TextAlign.center, ) ], ), @@ -1027,8 +984,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MyReferralPatientScreen(), + builder: (context) => MedicineSearchScreen(), ), ); }, @@ -1038,26 +994,34 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - DoctorApp.referred, + DoctorApp.qr_code, size: 50, color: Colors.black, ), - AppText( - TranslationBase.of(context).myReferredPatient, - color: Colors.black, - textAlign: TextAlign.center, + Column( + children: [ + AppText( + projectsProvider.isArabic + ? TranslationBase.of(context).reader + : TranslationBase.of(context).qr, + color: Colors.black, + textAlign: TextAlign.center, + ), + AppText( + projectsProvider.isArabic + ? TranslationBase.of(context).qr + : TranslationBase.of(context).reader, + color: Colors.black, + textAlign: TextAlign.center, + ), + ], ) ], ), +// imageName: '1.png', hasBorder: true, onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ReferredPatientScreen(), - // MyReferredPatient(), - ), - ); + Navigator.of(context).pushNamed(QR_READER); }, ), ], @@ -1104,23 +1068,34 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - DoctorApp.patient, + DoctorApp.mail, size: 50, - ), - AppText( - TranslationBase.of(context).arrived, color: Colors.black, - textAlign: TextAlign.center, + ), + Column( + children: [ + AppText( + TranslationBase.of(context).theDoctor, + textAlign: TextAlign.center, + color: Colors.black, + ), + AppText( + TranslationBase.of(context).reply, + textAlign: TextAlign.center, + color: Colors.black, + ), + ], ) ], ), hasBorder: true, onTap: () { - Navigator.of(context) - .pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": "7" - }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DoctorReplyScreen(), + ), + ); }, ) ], @@ -1218,72 +1193,72 @@ class _DashboardScreenState extends State { return value == 0 ? 1 : value; } - showCupertinoPicker( - {context, List actionList, decKey, onSelectFun}) { - showModalBottomSheet( - isDismissible: false, - isScrollControlled: true, - context: context, - builder: (BuildContext builder) { - return Container( - // height: 500, - height: SizeConfig.realScreenHeight * 0.4, - color: Color(0xfff7f7f7), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - color: Color(0xfff7f7f7), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - CupertinoButton( - child: AppText(TranslationBase.of(context).cancel - // style: TextStyle(context) - ), - onPressed: () { - Navigator.pop(context); - }, - ), - CupertinoButton( - child: AppText(TranslationBase.of(context).done - // style: textStyle(context), - ), - onPressed: () { - Navigator.pop(context); - // onSelectFun(cupertinoPickerIndex); - }, - ) - ], - ), - ), - Container( - height: SizeConfig.realScreenHeight * 0.3, - color: Color(0xfff7f7f7), - child: Column( - children: actionList - .map((e) => Flexible( - child: Container( - height: 50, - child: InkWell( - onTap: () => - changeClinic(e.clinicID, context), - child: AppText( - e.clinicName, - fontSize: - SizeConfig.textMultiplier * 1.9, - )), - ), - )) - .toList(), - )) - ], - ), - ); - }); - } + // showCupertinoPicker( + // {context, List actionList, decKey, onSelectFun}) { + // showModalBottomSheet( + // isDismissible: false, + // isScrollControlled: true, + // context: context, + // builder: (BuildContext builder) { + // return Container( + // // height: 500, + // height: SizeConfig.realScreenHeight * 0.4, + // color: Color(0xfff7f7f7), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Container( + // color: Color(0xfff7f7f7), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // CupertinoButton( + // child: AppText(TranslationBase.of(context).cancel + // // style: TextStyle(context) + // ), + // onPressed: () { + // Navigator.pop(context); + // }, + // ), + // CupertinoButton( + // child: AppText(TranslationBase.of(context).done + // // style: textStyle(context), + // ), + // onPressed: () { + // Navigator.pop(context); + // // onSelectFun(cupertinoPickerIndex); + // }, + // ) + // ], + // ), + // ), + // Container( + // height: SizeConfig.realScreenHeight * 0.3, + // color: Color(0xfff7f7f7), + // child: Column( + // children: actionList + // .map((e) => Flexible( + // child: Container( + // height: 50, + // child: InkWell( + // onTap: () => changeClinic( + // e.clinicID, context, model), + // child: AppText( + // e.clinicName, + // fontSize: + // SizeConfig.textMultiplier * 1.9, + // )), + // ), + // )) + // .toList(), + // )) + // ], + // ), + // ); + // }); + // } - changeClinic(clinicId, BuildContext context) async { + changeClinic(clinicId, BuildContext context, model) async { // Navigator.pop(context); changeIsLoading(true); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -1300,6 +1275,7 @@ class _DashboardScreenState extends State { authProvider.getDocProfiles(docInfo.toJson()).then((res) async { changeIsLoading(false); sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); + model.getDashboard(); }).catchError((err) { changeIsLoading(false); helpers.showErrorToast(err); @@ -1420,7 +1396,7 @@ class _DashboardScreenState extends State { AppText( getPatientCount(model.dashboardItemsList[0]) .toString(), - fontSize: 11, + fontSize: 18, fontWeight: FontWeight.bold, ) ], @@ -1502,18 +1478,166 @@ class _DashboardScreenState extends State { AppText( getPatientCount(model.dashboardItemsList[1]) .toString(), - fontSize: 11, + fontSize: 18, fontWeight: FontWeight.bold, ) ], ), top: MediaQuery.of(context).size.height * 0.12, - left: MediaQuery.of(context).size.width * 0.11) + left: MediaQuery.of(context).size.width * 0.10) ]), ), ], )), - ])) + ])), + RoundedContainer( + height: MediaQuery.of(context).size.height * 0.24, + margin: 5, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: AppText(TranslationBase.of(context).otherStatistic)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + DashboardItem( + width: MediaQuery.of(context).size.width * 0.25, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.36, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + child: Icon( + DoctorApp.lab_results, + size: 40, + color: Colors.black, + ), + ), + Container( + // margin: EdgeInsets.only(bottom: 10), + child: Column( + children: [ + AppText( + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[5]) + : "", + fontSize: SizeConfig.textMultiplier * 6, + color: Colors.black, + ), + AppText( + TranslationBase.of(context).targetPatient, + textAlign: TextAlign.center, + color: Colors.black, + ) + ], + ), + ), + ], + ), + //imageName: '1.png', + opacity: 0, + ), + Container( + color: Colors.black12, + height: MediaQuery.of(context).size.height * 0.18, + width: 1, + ), + DashboardItem( + width: MediaQuery.of(context).size.width * 0.25, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.36, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + child: Icon( + DoctorApp.radiology, + size: 40, + color: Colors.black, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 5), + child: Column( + children: [ + AppText( + clinicName.length.toString(), + fontSize: SizeConfig.textMultiplier * 6, + color: Colors.black, + ), + AppText( + TranslationBase.of(context).clinic, + color: Colors.black, + ) + ], + ), + ), + ], + ), + //imageName: '2.png', + opacity: 0, + ), + Container( + color: Colors.black12, + height: MediaQuery.of(context).size.height * 0.18, + width: 1, + ), + DashboardItem( + width: MediaQuery.of(context).size.width * 0.25, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.36, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + child: Icon( + DoctorApp.referral, + size: 40, + color: Colors.black, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 5), + child: Column( + children: [ + AppText( + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[2]) + : "", + fontSize: SizeConfig.textMultiplier * 6, + color: Colors.black, + ), + AppText( + TranslationBase.of(context).referral, + color: Colors.black, + ) + ], + ), + ), + ], + ), + //imageName: '3.png', + opacity: 0, + ), + ], + ) + ], + )) ]; } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 3f672218..789d2d0a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1123,6 +1123,9 @@ class TranslationBase { String get sickleaveonhold => localizedValues['sickleaveonhold'][locale.languageCode]; String get noClinic => localizedValues['no-clinic'][locale.languageCode]; + + String get otherStatistic => + localizedValues['otherStatistic'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {