From 63621b5fedaf73422243d3e0e0907623970e9bf5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 7 Jan 2024 09:42:28 +0300 Subject: [PATCH] Updates & fixes --- lib/pages/ToDoList/ToDo.dart | 137 ++++++++++++++++++----------------- pubspec.yaml | 2 +- 2 files changed, 70 insertions(+), 69 deletions(-) diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 5fb46243..2be4f097 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -48,9 +48,6 @@ import 'package:rating_bar/rating_bar.dart'; class ToDo extends StatefulWidget { PatientShareResponse patientShareResponse; - List appoList = []; - List ancillaryLists = []; - List obGyneAppoList = []; var languageID; bool isShowAppBar = true; @@ -86,6 +83,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isCash = false; MyInAppBrowser browser; + List appoList = []; + List ancillaryLists = []; + List obGyneAppoList = []; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -103,6 +104,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { @override void dispose() { super.dispose(); + // getToDoCount(); _tabController.dispose(); } @@ -162,15 +164,15 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: widget.appoList.length.toString(), + counter: appoList.length.toString(), title: TranslationBase.of(context).appointments, - bodyWidget: widget.appoList.length != 0 + bodyWidget: appoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, + itemCount: appoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -190,12 +192,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { children: [ Padding( padding: const EdgeInsets.only(top: 4.0), - child: widget.appoList[index].clinicID == 265 + child: appoList[index].clinicID == 265 ? Container( margin: EdgeInsets.only(left: 5.0, right: 5.0), child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0), ) - : widget.appoList[index].isLiveCareAppointment + : appoList[index].isLiveCareAppointment ? SvgPicture.asset("assets/images/new/virtual.svg") : SvgPicture.asset("assets/images/new/hospital-visit.svg"), ), @@ -205,9 +207,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Text( - widget.appoList[index].clinicID == 265 + appoList[index].clinicID == 265 ? TranslationBase.of(context).covidTestTodo - : widget.appoList[index].isLiveCareAppointment + : appoList[index].isLiveCareAppointment ? TranslationBase.of(context).liveCareAppo : TranslationBase.of(context).walkinAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), @@ -215,8 +217,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + controller: + new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (appoList[index].remaniningHoursTocanPay * 1000) * 60), widgetBuilder: (_, CurrentRemainingTime time) { return time != null ? Text( @@ -236,17 +238,17 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: Container( child: InkWell( onTap: () { - performNextAction(widget.appoList[index]); + performNextAction(appoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: getNextActionButtonColor(widget.appoList[index].nextAction), + color: getNextActionButtonColor(appoList[index].nextAction), border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.circular(6), ), child: Text( - getNextActionText(widget.appoList[index].nextAction), + getNextActionText(appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), @@ -259,7 +261,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + appoList[index].doctorTitle + " " + appoList[index].doctorNameObj, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -267,8 +269,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - url: widget.appoList[index].doctorImageURL, + name: appoList[index].doctorTitle + " " + appoList[index].doctorNameObj, + url: appoList[index].doctorImageURL, width: 52, height: 52, ), @@ -278,32 +280,32 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", appoList[index].clinicName, projectViewModel.isArabic), // MyRichText(TranslationBase.of(context).appointmentDate + ": ", - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), // Timezone changes - widget.appoList[index].isLiveCareAppointment + appoList[index].isLiveCareAppointment ? MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), + DateUtil.convertStringToDate(appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), projectViewModel.isArabic) : MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - widget.appoList[index].startTime.substring(0, 5), + appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, appoList[index].projectName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, children: [ RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + initialRating: appoList[index].actualDoctorRate.toDouble(), size: 16.0, filledColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127), @@ -322,13 +324,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 12.0), child: Text( - getNextActionDescription(widget.appoList[index].nextAction), + getNextActionDescription(appoList[index].nextAction), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), ), InkWell( onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); + navigateToAppointmentDetails(context, appoList[index]); }, child: Padding( padding: const EdgeInsets.only(top: 0.0), @@ -357,9 +359,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: (widget.ancillaryLists.isNotEmpty) ? widget.ancillaryLists[0].ancillaryOrderList.length.toString() : "0", + counter: (ancillaryLists.isNotEmpty) ? ancillaryLists[0].ancillaryOrderList.length.toString() : "0", title: TranslationBase.of(context).anicllaryOrders, - bodyWidget: widget.ancillaryLists.length != 0 + bodyWidget: ancillaryLists.length != 0 ? Container( padding: EdgeInsets.all(12), child: ListView.separated( @@ -368,18 +370,18 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { reverse: true, itemBuilder: (context, index) { return DoctorCard( - onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList[index], widget.ancillaryLists[0].projectID), + onTap: () => ancillaryOrdersDetails(ancillaryLists[0].ancillaryOrderList[index], ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), - billNo: widget.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), + name: TranslationBase.of(context).dr.toString() + " " + (ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), + billNo: ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", - subName: widget.ancillaryLists[0].projectName, + subName: ancillaryLists[0].projectName, isLiveCareAppointment: false, - date: DateUtil.convertStringToDate(widget.ancillaryLists[0].ancillaryOrderList[index].orderDate), + date: DateUtil.convertStringToDate(ancillaryLists[0].ancillaryOrderList[index].orderDate), isSortByClinic: true, ); }, - itemCount: widget.ancillaryLists[0].ancillaryOrderList.length, + itemCount: ancillaryLists[0].ancillaryOrderList.length, separatorBuilder: (context, index) => SizedBox(height: 14), ), ) @@ -389,13 +391,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { ), ), Container( - child: widget.obGyneAppoList.length != 0 + child: obGyneAppoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.obGyneAppoList.length, + itemCount: obGyneAppoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -433,7 +435,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Container( child: InkWell( onTap: () { - getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID, widget.obGyneAppoList[index].setupID, widget.obGyneAppoList[index]); + getOBGyneDoctorsList(obGyneAppoList[index].projectID, obGyneAppoList[index].setupID, obGyneAppoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), @@ -454,7 +456,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -462,7 +464,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + name: TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName, url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", width: 52, height: 52, @@ -473,12 +475,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", obGyneAppoList[index].clinicDescription, projectViewModel.isArabic), MyRichText( TranslationBase.of(context).orderDate + ": ", - DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate)).split(" ")[0], + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(obGyneAppoList[index].orderDate)).split(" ")[0], projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, obGyneAppoList[index].projectDescription, projectViewModel.isArabic), ], ), ), @@ -749,14 +751,14 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getOBGyneOrdersList(context).then((res) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['HIS_OBGYNEProcedureGet_List'].length != 0) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); res['HIS_OBGYNEProcedureGet_List'].forEach((v) { - widget.obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); + obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); }); } else { // Navigator.of(context).popAndPushNamed(HOME); @@ -822,32 +824,31 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { obGyneProcedureListResponse: obGyneProcedureListResponse))); } - getPatientAppointmentHistory() { + getPatientAppointmentHistory() async { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, languageID, context).then((res) { - widget.appoList.clear(); + appoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - setState(() { - if (res['AppoimentAllHistoryResultList'].length != 0) { - widget.appoList.clear(); - res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - }); - } - if (res['AncillaryOrderList'].length != 0) { - res['AncillaryOrderList'].forEach((item) { - widget.ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); - }); - } - dataLoaded = true; - if (widget.isFromMyAppointments) { - performNextAction(widget.appointment); - widget.isFromMyAppointments = false; - } - }); + if (res['AppoimentAllHistoryResultList'].length != 0) { + appoList.clear(); + res['AppoimentAllHistoryResultList'].forEach((v) { + appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + }); + } + if (res['AncillaryOrderList'].length != 0) { + res['AncillaryOrderList'].forEach((item) { + ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + }); + } + dataLoaded = true; + if (widget.isFromMyAppointments) { + performNextAction(widget.appointment); + widget.isFromMyAppointments = false; + } + setState(() {}); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } diff --git a/pubspec.yaml b/pubspec.yaml index 0cb06dd5..5de7f32e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.78+1 +version: 4.5.79+1 environment: sdk: ">=2.7.0 <3.0.0"