From 0ea66c44838e8d733c84858da4078c4336612644 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 21 Apr 2021 11:33:00 +0300 Subject: [PATCH] bug fixes --- lib/client/base_app_client.dart | 9 +- lib/screens/home/home_screen.dart | 955 ++++++++---------- lib/screens/sick-leave/add-sickleave.dart | 3 +- lib/screens/sick-leave/show-sickleave.dart | 263 ++--- lib/widgets/dashboard/activity_button.dart | 39 + lib/widgets/dashboard/out_patient_stack.dart | 69 ++ lib/widgets/dashboard/row_count.dart | 45 + .../dashboard/swiper_rounded_pagination.dart | 24 + pubspec.lock | 7 + pubspec.yaml | 2 +- 10 files changed, 748 insertions(+), 668 deletions(-) create mode 100644 lib/widgets/dashboard/activity_button.dart create mode 100644 lib/widgets/dashboard/out_patient_stack.dart create mode 100644 lib/widgets/dashboard/row_count.dart create mode 100644 lib/widgets/dashboard/swiper_rounded_pagination.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 0ba19289..058b239d 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -88,8 +88,6 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - String req = json.encode(body); - var asd=""; if (await Helpers.checkConnection()) { final response = await http.post(url, @@ -105,7 +103,8 @@ class BaseAppClient { var parsed = json.decode(response.body.toString()); if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'],parsed['AndroidLink'],parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], + parsed['AndroidLink'], parsed['IOSLink']); } if (!parsed['IsAuthenticated']) { @@ -225,7 +224,8 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'],parsed['AndroidLink'],parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], + parsed['AndroidLink'], parsed['IOSLink']); } if (parsed['IsAuthenticated'] == null) { if (parsed['isSMSSent'] == true) { @@ -289,7 +289,6 @@ class BaseAppClient { } } - String getError(parsed) { //TODO change this fun String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 2504b59f..0626f04a 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -18,7 +18,11 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart'; import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -28,6 +32,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'package:sticky_headers/sticky_headers/widget.dart'; import '../../routes.dart'; import '../../widgets/shared/app_texts_widget.dart'; @@ -130,122 +135,125 @@ class _HomeScreenState extends State { baseViewModel: model, isShowAppBar: false, body: ListView(children: [ - Column( - children: [ - SizedBox(height: 20), - Stack(children: [ - IconButton( - icon: Image.asset('assets/images/menu.png', - height: 50, width: 50), - iconSize: 18, - color: Colors.black, - onPressed: () => Scaffold.of(context).openDrawer(), - ), - Column( - children: [ - ProfileWelcomeWidget( - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width * .6, - // // height: 100, - child: projectsProvider.doctorClinicsList.length > 0 - ? Stack( - children: [ - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - 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, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(2), - margin: EdgeInsets.all(2), - 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, + Column(children: [ + StickyHeader( + header: Container( + color: Colors.grey[100], + padding: EdgeInsets.only(top: 10), + child: Stack(children: [ + IconButton( + icon: Image.asset('assets/images/menu.png', + height: 50, width: 50), + iconSize: 18, + color: Colors.black, + onPressed: () => Scaffold.of(context).openDrawer(), + ), + Column(children: [ + ProfileWelcomeWidget( + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width * .6, + // // height: 100, + child: projectsProvider.doctorClinicsList.length > + 0 + ? Stack( + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + 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, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(2), + margin: EdgeInsets.all(2), + 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, + ), + textAlign: + TextAlign.center, ), - textAlign: TextAlign.center, ), - ), - AppText(item.clinicName, - fontSize: 12, - color: Colors.black, - fontWeight: FontWeight.bold, - textAlign: TextAlign.end), - ], + AppText(item.clinicName, + fontSize: 12, + color: Colors.black, + fontWeight: + FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic( + newValue, context, model); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.clinicName, + textAlign: TextAlign.right, + ), + value: item.clinicID, ); - }).toList(); - }, - onChanged: (newValue) { - clinicId = newValue; - changeClinic( - newValue, context, model); - }, - items: projectsProvider - .doctorClinicsList - .map((item) { - return DropdownMenuItem( - child: AppText( - item.clinicName, - textAlign: TextAlign.right, - ), - value: item.clinicID, - ); - }).toList(), - )), - ], - ) - : AppText(TranslationBase.of(context).noClinic), - ), - ], + }).toList(), + )), + ], + ) + : AppText( + TranslationBase.of(context).noClinic), + ), + ], + ), + isClilic: true, + height: 50, ), - isClilic: true, - ), - Container( - height: MediaQuery.of(context).size.height * 0.24, - ), - ], - ), - Positioned( - right: 9.0, - left: 9, - top: MediaQuery.of(context).size.height * .08, - child: Container( + ]) + ])), + content: Column( + children: [ + Container( height: MediaQuery.of(context).size.height * 0.35, child: model.dashboardItemsList.length > 0 ? new Swiper( @@ -279,19 +287,19 @@ class _HomeScreenState extends State { .spaceBetween, children: [ config.activeIndex == 0 - ? getSwiperPagiantion( + ? SwiperRoundedPagination( true) - : getSwiperPagiantion( + : SwiperRoundedPagination( false), config.activeIndex == 1 - ? getSwiperPagiantion( + ? SwiperRoundedPagination( true) - : getSwiperPagiantion( + : SwiperRoundedPagination( false), config.activeIndex == 2 - ? getSwiperPagiantion( + ? SwiperRoundedPagination( true) - : getSwiperPagiantion( + : SwiperRoundedPagination( false), ], ))))) @@ -302,59 +310,17 @@ class _HomeScreenState extends State { // control: new SwiperControl(), ) : SizedBox()), - ) - ]), - model.dashboardItemsList.length > 0 - ? FractionallySizedBox( - widthFactor: 0.90, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - sliderActiveIndex == 1 - ? Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[3].kPIName, - fontSize: - SizeConfig.textMultiplier * 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context) - .size - .height * - 0.15 - : MediaQuery.of(context) - .size - .height * - 0.20, - child: new ListView( - scrollDirection: Axis.horizontal, - children: new List.generate( - model - .dashboardItemsList[3] - .summaryoptions - .length, (int index) { - return getActivityButton(model - .dashboardItemsList[3] - .summaryoptions[index]); - }))) - ], - ) - : sliderActiveIndex == 0 + model.dashboardItemsList.length > 0 + ? FractionallySizedBox( + widthFactor: 0.90, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + sliderActiveIndex == 1 ? Column( children: [ Row( @@ -362,7 +328,7 @@ class _HomeScreenState extends State { MainAxisAlignment.start, children: [ AppText( - model.dashboardItemsList[6] + model.dashboardItemsList[3] .kPIName, fontSize: SizeConfig.textMultiplier * @@ -388,241 +354,297 @@ class _HomeScreenState extends State { Axis.horizontal, children: new List.generate( model - .dashboardItemsList[6] + .dashboardItemsList[3] .summaryoptions .length, (int index) { - return getActivityButton(model - .dashboardItemsList[6] + return GetActivityButton(model + .dashboardItemsList[3] .summaryoptions[index]); }))) ], ) - : Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[4] - .kPIName, - fontSize: - SizeConfig.textMultiplier * + : sliderActiveIndex == 0 + ? Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + model.dashboardItemsList[6] + .kPIName, + fontSize: SizeConfig + .textMultiplier * 2.2, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.bold, + ), + ], + ), + new Container( + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.15 + : MediaQuery.of(context) + .size + .height * + 0.20, + child: new ListView( + scrollDirection: Axis + .horizontal, + children: new List + .generate( + model + .dashboardItemsList[ + 6] + .summaryoptions + .length, + (int index) { + return GetActivityButton(model + .dashboardItemsList[ + 6] + .summaryoptions[index]); + }))) + ], + ) + : Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + model.dashboardItemsList[4] + .kPIName, + fontSize: SizeConfig + .textMultiplier * + 2.2, + fontWeight: FontWeight.bold, + ), + ], ), + new Container( + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.15 + : MediaQuery.of(context) + .size + .height * + 0.20, + child: new ListView( + scrollDirection: Axis + .horizontal, + children: new List + .generate( + model + .dashboardItemsList[ + 4] + .summaryoptions + .length, + (int index) { + return GetActivityButton(model + .dashboardItemsList[ + 4] + .summaryoptions[index]); + }))) ], ), - new Container( - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context) - .size - .height * - 0.15 - : MediaQuery.of(context) - .size - .height * - 0.20, - child: new ListView( - scrollDirection: - Axis.horizontal, - children: new List.generate( - model - .dashboardItemsList[4] - .summaryoptions - .length, (int index) { - return getActivityButton(model - .dashboardItemsList[4] - .summaryoptions[index]); - }))) - ], - ), - ]))) - : SizedBox(), - FractionallySizedBox( - // widthFactor: 0.90, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(50), - )), - padding: EdgeInsets.only(left: 20, top: 10, right: 20), - margin: EdgeInsets.only(top: 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Row( - children: [ - Container( - width: 150, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).patients, - style: TextStyle( - fontSize: 12, - height: .5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context).services, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - ], - )), - ], - ), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + ]))) + : SizedBox(), + FractionallySizedBox( + // widthFactor: 0.90, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(50), + )), + padding: EdgeInsets.only(left: 20, top: 10, right: 20), + margin: EdgeInsets.only(top: 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - HomePageCard( - color: Colors.red[800], - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Icon( - DoctorApp.referral_1, - size: 35, - color: Colors.white, - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .patientsreferral, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PatientReferralScreen(), - // MyReferredPatient(), + SizedBox( + height: 10, + ), + Row( + children: [ + Container( + width: 150, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).patients, + style: TextStyle( + fontSize: 12, + height: .5, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins'), + ), + Text( + TranslationBase.of(context).services, + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins'), + ), + ], + )), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + HomePageCard( + color: Colors.red[800], + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.referral_1, + size: 35, + color: Colors.white, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .patientsreferral, + color: Colors.white, + textAlign: TextAlign.start, + fontSize: 15, + )) + ], + ), + hasBorder: false, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PatientReferralScreen(), + // MyReferredPatient(), + ), + ); + }, + ), + HomePageCard( + color: Colors.grey[300], + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.arrival_patients, + size: 35, + color: Colors.black, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .arrivalpatient, + color: Colors.black, + textAlign: TextAlign.start, + fontSize: 15, + )) + ], + ), + hasBorder: false, + onTap: () { + Navigator.of(context) + .pushNamed(PATIENTS, arguments: { + "patientSearchForm": + _patientSearchFormValues, + "selectedType": "7", + "arrivalType": "1" + }); + }, + ), + HomePageCard( + color: Colors.black, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.search, + size: 32, + color: Colors.white, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .searchmedicinepatient, + color: Colors.white, + textAlign: TextAlign.start, + fontSize: 13, + )) + ], ), - ); - }, + hasBorder: false, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SearchMedicinePatientScreen(), + )); + }, + ) + ], ), - HomePageCard( - color: Colors.grey[300], - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Icon( - DoctorApp.arrival_patients, - size: 35, - color: Colors.black, - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .arrivalpatient, - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.of(context) - .pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": "7", - "arrivalType": "1" - }); - }, + SizedBox( + height: 10, ), - HomePageCard( - color: Colors.black, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Icon( - DoctorApp.search, - size: 32, - color: Colors.white, - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .searchmedicinepatient, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 13, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - SearchMedicinePatientScreen(), - )); - }, - ) - ], - ), - SizedBox( - height: 10, - ), - SizedBox( - height: 20, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ SizedBox( - width: 8, + height: 20, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 8, + ), + ], + ), + SizedBox( + height: 20, ), ], ), - SizedBox( - height: 20, - ), - ], + ), ), - ), + ], ), - ], - ), + ) + ]), ]), ), ); @@ -671,12 +693,9 @@ class _HomeScreenState extends State { projectID: doctorProfile.projectID, tokenID: '', languageID: 2); - - // authProvider.getDocProfiles(docInfo) 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); @@ -696,135 +715,6 @@ class _HomeScreenState extends State { return value.toString(); } - Widget getActivityButton(value) { - return Container( - width: MediaQuery.of(context).size.width * 0.24, - padding: EdgeInsets.all(5), - margin: EdgeInsets.all(5), - height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.15 - : MediaQuery.of(context).size.height * 0.20, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.all(10), - child: AppText(value.value.toString(), - fontSize: 28, fontWeight: FontWeight.bold)), - Expanded( - child: AppText( - value.kPIParameter, - textOverflow: TextOverflow.clip, - fontSize: 12, - textAlign: TextAlign.center, - ), - ), - ], - ), - ); - } - - Widget dot(Color c) { - return Container( - padding: EdgeInsets.all(5.0), - margin: EdgeInsets.all(5.0), - decoration: BoxDecoration(color: c, shape: BoxShape.circle)); - } - - Widget rowCount(name, int count, Color c) { - return Row( - children: [ - dot(c), - Padding( - padding: EdgeInsets.only(top: 5, bottom: 5), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - name, - color: Colors.black, - textAlign: TextAlign.center, - fontSize: 12, - textOverflow: TextOverflow.ellipsis, - ), - AppText( - ' (' + count.toString() + ')', - color: Colors.black, - textAlign: TextAlign.center, - fontSize: 14, - fontWeight: FontWeight.bold, - ) - ], - )), - ], - ); - } - - Widget getOutPatientStack(value) { - value.summaryoptions - .sort((Summaryoptions a, Summaryoptions b) => b.value - a.value); - - var list = new List(); - value.summaryoptions.forEach((result) => - {list.add(getStack(result, value.summaryoptions.first.value))}); - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - value.kPIName, - medium: true, - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) - ], - ); - } - - getStack(Summaryoptions value, max) { - return Stack(children: [ - Container( - height: 150, - margin: EdgeInsets.all(5), - width: 40, - child: SizedBox(), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.red[50]), - ), - Positioned( - bottom: 0, - child: Container( - child: SizedBox(), - margin: EdgeInsets.all(5), - padding: EdgeInsets.all(10), - height: max != 0 ? (150 * value.value) / max : 0, - width: 40, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.red[300]))), - Container( - height: 150, - margin: EdgeInsets.only(left: 5, top: 5), - padding: EdgeInsets.all(10), - child: RotatedBox( - quarterTurns: 1, - child: Center( - child: Align( - child: AppText( - value.kPIParameter + ' (' + value.value.toString() + ') ', - fontSize: 10, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - )), - ), - )) - ]); - } - List getSwipeWidget(model) { return [ RoundedContainer( @@ -832,13 +722,13 @@ class _HomeScreenState extends State { margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), child: Padding( padding: const EdgeInsets.all(5.0), - child: getOutPatientStack(model.dashboardItemsList[1]))), + child: GetOutPatientStack(model.dashboardItemsList[1]))), RoundedContainer( height: MediaQuery.of(context).size.height * 0.35, margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), child: Padding( padding: const EdgeInsets.all(5.0), - child: getOutPatientStack(model.dashboardItemsList[0]))), + child: GetOutPatientStack(model.dashboardItemsList[0]))), RoundedContainer( height: MediaQuery.of(context).size.height * 0.35, margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), @@ -892,19 +782,19 @@ class _HomeScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - rowCount( + RowCounts( model.dashboardItemsList[2] .summaryoptions[0].kPIParameter, model.dashboardItemsList[2] .summaryoptions[0].value, Colors.black), - rowCount( + RowCounts( model.dashboardItemsList[2] .summaryoptions[1].kPIParameter, model.dashboardItemsList[2] .summaryoptions[1].value, Colors.grey), - rowCount( + RowCounts( model.dashboardItemsList[2] .summaryoptions[2].kPIParameter, model.dashboardItemsList[2] @@ -942,21 +832,4 @@ class _HomeScreenState extends State { ])), ]; } - - getSwiperPagiantion(active) { - return active == true - ? Container( - height: 5, - width: 30, - // margin: EdgeInsets.only(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), color: Colors.black), - ) - : Container( - height: 5, - width: 8, - margin: EdgeInsets.all(2), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.grey)); - } } diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 45088b8d..1da646ff 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -252,7 +252,8 @@ class AddSickLeavScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('No Sick Leave Found'), + child: Texts( + TranslationBase.of(context).noSickLeave), ) ], ), diff --git a/lib/screens/sick-leave/show-sickleave.dart b/lib/screens/sick-leave/show-sickleave.dart index 6085dc19..9b035927 100644 --- a/lib/screens/sick-leave/show-sickleave.dart +++ b/lib/screens/sick-leave/show-sickleave.dart @@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; @@ -32,6 +33,7 @@ class ShowSickLeaveScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, + backgroundColor: Colors.grey[100], appBar: PatientProfileHeaderNewDesignAppBar( patient, routeArgs['patientType'] ?? "0", @@ -42,132 +44,153 @@ class ShowSickLeaveScreen extends StatelessWidget { children: [ // PatientProfileHeaderNewDesign( // patient, routeArgs['patientType'], routeArgs['arrivalType']), - Column( - children: model.getAllSIckLeave - .map((GetAllSickLeaveResponse item) { - return RoundedContainer( - child: Column( - children: [ - Container( - decoration: BoxDecoration( - border: Border( - left: BorderSide( - color: item.status == 1 - ? Colors.yellow[800] - : item.status == 2 - ? Colors.green - : Colors.black, - width: 5.0, - ))), - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Wrap( - // mainAxisAlignment: - // MainAxisAlignment.start, + model.getAllSIckLeave.length > 0 + ? Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return RoundedContainer( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + width: 5.0, + ))), + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(3), - child: AppText( - item.status == 1 - ? TranslationBase.of(context) - .hold - : item.status == 2 - ? TranslationBase.of( - context) - .active - : TranslationBase.of( - context) - .all, - fontWeight: FontWeight.bold, - color: item.status == 1 - ? Colors.yellow[800] - : item.status == 2 - ? Colors.green - : Colors.black, - ), - ), - Row( - children: [ - AppText(TranslationBase.of(context) - .daysSickleave), - AppText( - item.noOfDays.toString(), - fontWeight: FontWeight.bold, - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .startDate + - ' ', - ), - Flexible( + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), child: AppText( - DateUtils - .convertStringToDateFormat( - item.startDate, - 'dd-MMM-yyyy'), - fontWeight: FontWeight.bold, - )) - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - item.remarks ?? "", + item.status == 1 + ? TranslationBase.of( + context) + .hold + : item.status == 2 + ? TranslationBase.of( + context) + .active + : TranslationBase.of( + context) + .all, + fontWeight: FontWeight.bold, + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + ), + ), + Row( + children: [ + AppText(TranslationBase.of( + context) + .daysSickleave), + AppText( + item.noOfDays.toString(), + fontWeight: FontWeight.bold, + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .startDate + + ' ', + ), + Flexible( + child: AppText( + DateUtils + .convertStringToDateFormat( + item.startDate, + 'dd-MMM-yyyy'), + fontWeight: FontWeight.bold, + )) + ], ), - (item.status == 1) - ? IconButton( - icon: Image.asset( - 'assets/images/edit.png'), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + item.remarks ?? "", + ), + (item.status == 1) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), - // color: Colors.green, //Colors.black, - onPressed: () => { - if (item.status == 1) - { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .sickleaveonhold) - } - // else - // { - // openSickLeave( - // context, - // true, - // extendedData: - // item) - // } - }, - ) - : SizedBox() - ]), - ], - ), - SizedBox( - width: 20, + // color: Colors.green, //Colors.black, + onPressed: () => { + if (item.status == + 1) + { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .sickleaveonhold) + } + // else + // { + // openSickLeave( + // context, + // true, + // extendedData: + // item) + // } + }, + ) + : SizedBox() + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), ), ], - ), - ), - ], - )), - ], - )); - }).toList(), - ) + )), + ], + )); + }).toList(), + ) + : Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: + Texts(TranslationBase.of(context).noSickLeave), + ) + ], + ), + ) ], ), ), diff --git a/lib/widgets/dashboard/activity_button.dart b/lib/widgets/dashboard/activity_button.dart new file mode 100644 index 00000000..0dad5cec --- /dev/null +++ b/lib/widgets/dashboard/activity_button.dart @@ -0,0 +1,39 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class GetActivityButton extends StatelessWidget { + final value; + GetActivityButton(this.value); + @override + Widget build(BuildContext context) { + return Container( + width: 120, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + height: 120, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: AppText(value.value.toString(), + fontSize: 28, fontWeight: FontWeight.bold)), + Expanded( + child: AppText( + value.kPIParameter, + textOverflow: TextOverflow.clip, + fontSize: 12, + textAlign: TextAlign.center, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart new file mode 100644 index 00000000..cad99e14 --- /dev/null +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -0,0 +1,69 @@ +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class GetOutPatientStack extends StatelessWidget { + final value; + GetOutPatientStack(this.value); + @override + Widget build(BuildContext context) { + value.summaryoptions + .sort((Summaryoptions a, Summaryoptions b) => b.value - a.value); + + var list = new List(); + value.summaryoptions.forEach((result) => + {list.add(getStack(result, value.summaryoptions.first.value))}); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Texts( + value.kPIName, + medium: true, + ), + Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) + ], + ); + } + + getStack(Summaryoptions value, max) { + return Stack(children: [ + Container( + height: 150, + margin: EdgeInsets.all(5), + width: 40, + child: SizedBox(), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), color: Colors.red[50]), + ), + Positioned( + bottom: 0, + child: Container( + child: SizedBox(), + margin: EdgeInsets.all(5), + padding: EdgeInsets.all(10), + height: max != 0 ? (150 * value.value) / max : 0, + width: 40, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.red[300]))), + Container( + height: 150, + margin: EdgeInsets.only(left: 5, top: 5), + padding: EdgeInsets.all(10), + child: RotatedBox( + quarterTurns: 1, + child: Center( + child: Align( + child: AppText( + value.kPIParameter + ' (' + value.value.toString() + ') ', + fontSize: 10, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + )), + ), + )) + ]); + } +} diff --git a/lib/widgets/dashboard/row_count.dart b/lib/widgets/dashboard/row_count.dart new file mode 100644 index 00000000..c56613da --- /dev/null +++ b/lib/widgets/dashboard/row_count.dart @@ -0,0 +1,45 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class RowCounts extends StatelessWidget { + final name; + final int count; + final Color c; + RowCounts(this.name, this.count, this.c); + @override + Widget build(BuildContext context) { + return Row( + children: [ + dot(c), + Padding( + padding: EdgeInsets.only(top: 5, bottom: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + name, + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 12, + textOverflow: TextOverflow.ellipsis, + ), + AppText( + ' (' + count.toString() + ')', + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 14, + fontWeight: FontWeight.bold, + ) + ], + )), + ], + ); + } + + Widget dot(Color c) { + return Container( + padding: EdgeInsets.all(5.0), + margin: EdgeInsets.all(5.0), + decoration: BoxDecoration(color: c, shape: BoxShape.circle)); + } +} diff --git a/lib/widgets/dashboard/swiper_rounded_pagination.dart b/lib/widgets/dashboard/swiper_rounded_pagination.dart new file mode 100644 index 00000000..c3b73dd3 --- /dev/null +++ b/lib/widgets/dashboard/swiper_rounded_pagination.dart @@ -0,0 +1,24 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class SwiperRoundedPagination extends StatelessWidget { + final active; + SwiperRoundedPagination(this.active); + @override + Widget build(BuildContext context) { + return active == true + ? Container( + height: 5, + width: 30, + // margin: EdgeInsets.only(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), color: Colors.black), + ) + : Container( + height: 5, + width: 8, + margin: EdgeInsets.all(2), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), color: Colors.grey)); + } +} diff --git a/pubspec.lock b/pubspec.lock index 46eca7cf..d338a618 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -901,6 +901,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.10.0-nullsafety.1" + sticky_headers: + dependency: "direct main" + description: + name: sticky_headers + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.8+1" stream_channel: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3318ff05..1dd7ae8b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,7 +78,7 @@ dependencies: # Flutter Html View flutter_html: 1.0.2 - + sticky_headers: "^0.1.8" #speech to text