From f995a9fa8e9e84d63f8e72b095d8ad7a99b42173 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 13:19:14 +0300 Subject: [PATCH 1/3] Ambulance request UI revamped --- .../notification_details_page.dart | 110 +++--- .../notifications/notifications_page.dart | 2 + .../AmbulanceRequestIndex.dart | 331 +++++++++++++++--- lib/pages/ErService/OrderLogPage.dart | 283 ++++++++++++--- lib/widgets/drawer/app_drawer_widget.dart | 2 +- .../pickupLocation/PickupLocationFromMap.dart | 35 +- 6 files changed, 573 insertions(+), 190 deletions(-) diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 7633ab9c..6a24a52f 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -34,70 +34,68 @@ class NotificationsDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - appBarTitle: TranslationBase.of(context).notificationDetails, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 25, - ), - Container( - width: double.infinity, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), - style: TextStyle( + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).notificationDetails, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 25, + ), + Container( + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), + style: TextStyle( fontSize: 18.0, color: Colors.black, fontWeight: FontWeight.w600 - ), ), ), ), - SizedBox( - height: 15, - ), - if (notification.messageTypeData.length != 0) - FractionallySizedBox( - widthFactor: 0.9, - child: Image.network(notification.messageTypeData, - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: SizedBox( - width: 40.0, - height: 40.0, - child: AppCircularProgressIndicator(), - ), - ); - }, - fit: BoxFit - .fill) //Image.network(notification.messageTypeData), - ), - SizedBox( - height: 15, + ), + SizedBox( + height: 15, + ), + if (notification.messageTypeData.length != 0) + FractionallySizedBox( + widthFactor: 0.9, + child: Image.network(notification.messageTypeData, + loadingBuilder: (BuildContext context, Widget child, + ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator(), + ), + ); + }, + fit: BoxFit + .fill) //Image.network(notification.messageTypeData), ), - Row( - children: [ - Expanded( - child: Center( - child: Text(notification.message), - ), + SizedBox( + height: 15, + ), + Row( + children: [ + Expanded( + child: Center( + child: Text(notification.message), ), - ], - ), - ], - ), + ), + ], + ), + ], ), ), ), diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 6ae318c3..498afde8 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -21,6 +22,7 @@ class NotificationsPage extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + AppGlobal.context = context; return BaseView( onModelReady: (model) { GetNotificationsRequestModel getNotificationsRequestModel = diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index bbae70a5..806c0738 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -1,14 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'BillAmount.dart'; import 'PickupLocation.dart'; @@ -33,6 +41,10 @@ class _AmbulanceRequestIndexPageState extends State { TransportationDetails transportationDetails = new TransportationDetails(); + int status; + String _statusDisp; + Color _color; + _changeCurrentTab(int tab) { setState(() { currentIndex = tab; @@ -49,8 +61,31 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + AmbulanceRequestOrdersModel order = widget.amRequestViewModel.pendingAmbulanceRequestOrder; + + if(widget.amRequestViewModel.pendingAmbulanceRequestOrder != null) { + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + } + return AppScaffold( - body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null + body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null && order != null ? SingleChildScrollView( child: Column( children: [ @@ -58,60 +93,234 @@ class _AmbulanceRequestIndexPageState extends State { height: 10, ), Container( - margin: EdgeInsets.only(left: 18, right: 18), + margin: EdgeInsets.all(21), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).status, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), - OrderLogItem( - title: TranslationBase.of(context).transportMethod, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + ], + ), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); - }, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.amRequestViewModel, order.iD); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], ), - ) - ], + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), ), + + // Container( + // margin: EdgeInsets.only(left: 18, right: 18), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(2), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // OrderLogItem( + // title: TranslationBase.of(context).reqId, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).status, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupDate, + // value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).dropoffLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).transportMethod, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + // ), + // Container( + // padding: EdgeInsets.all(10), + // width: double.maxFinite, + // margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only( + // bottomRight: Radius.circular(12), + // bottomLeft: Radius.circular(12), + // ), + // color: Colors.white), + // child: SecondaryButton( + // color: Colors.red[900], + // textColor: Colors.white, + // label: TranslationBase.of(context).cancel, + // onTap: () { + // widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); + // }, + // ), + // ) + // ], + // ), + // ), ], ), ) @@ -164,4 +373,26 @@ class _AmbulanceRequestIndexPageState extends State { ), ); } + + void showConfirmMessage(AmRequestViewModel model, int presOrderID) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; + } } diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 9bb56b9c..644f3164 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -1,10 +1,18 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class OrderLogPage extends StatelessWidget { final AmRequestViewModel amRequestViewModel; @@ -13,64 +21,231 @@ class OrderLogPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + void showConfirmMessage(AmRequestViewModel model, int presOrderID) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; + } + return Container( - margin: EdgeInsets.all(10), + // margin: EdgeInsets.all(10), padding: EdgeInsets.all(8), - child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 ? ListView.builder( - itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, - itemBuilder: (context, index) => Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].iD.toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).orderStatus, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: getDate(amRequestViewModel.patientAmbulanceRequestOrdersList[index].created), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].dropOffLocation, - ), - if (amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusId == 1) - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 + ? ListView.builder( + padding: EdgeInsets.all(21), + itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, + itemBuilder: (context, index) { + AmbulanceRequestOrdersModel order = amRequestViewModel.patientAmbulanceRequestOrdersList[index]; + + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return Container( decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.iD); - }, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(amRequestViewModel, order.iD); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), - ) - ], - ), - ), - ) : getNoDataWidget(context), + ); + }) + : getNoDataWidget(context), ); } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 9e5a88d4..8b3819f1 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -361,7 +361,7 @@ class _AppDrawerState extends State { onTap: () { //NotificationsPage // Navigator.of(context).pop(); - if (!projectProvider.isLoginChild) Navigator.push(AppGlobal.context, FadePage(page: NotificationsPage())); + if (!projectProvider.isLoginChild) Navigator.push(context, FadePage(page: NotificationsPage())); }, ), if (projectProvider.havePrivilege(3)) diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index b0a67980..73edbe08 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; @@ -18,15 +19,7 @@ class PickupLocationFromMap extends StatelessWidget { final String buttonLabel; final Color buttonColor; - const PickupLocationFromMap( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.isWithAppBar = true, - this.buttonLabel, - this.buttonColor}) - : super(key: key); + const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude, this.isWithAppBar = true, this.buttonLabel, this.buttonColor}) : super(key: key); @override Widget build(BuildContext context) { @@ -60,8 +53,7 @@ class PickupLocationFromMap extends StatelessWidget { onPick(result); Navigator.of(context).pop(); }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { print("state: $state, isSearchBarFocused: $isSearchBarFocused"); return isSearchBarFocused ? Container() @@ -75,28 +67,13 @@ class PickupLocationFromMap extends StatelessWidget { ? Center(child: CircularProgressIndicator()) : Container( margin: EdgeInsets.all(12), - child: BorderedButton( - buttonLabel != null ? buttonLabel : TranslationBase.of(context).next, - textColor: Colors.white, - fontWeight: FontWeight.bold, - backgroundColor: buttonColor != null ? buttonColor : Colors.grey[800], - fontSize: 14, - vPadding: 12, - radius: 10, - handler: () { + child: DefaultButton( + TranslationBase.of(context).next, + () { onPick(selectedPlace); Navigator.of(context).pop(); }, ), - /* SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - onPick(selectedPlace); - Navigator.of(context).pop(); - }, - label: TranslationBase.of(context).next, - ),*/ ), ); }, From c253ec311023910142a44d3ac69e99aacbfdd619 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 17:07:12 +0300 Subject: [PATCH 2/3] LiveCare UI revamped --- lib/models/Appointments/DoctorProfile.dart | 48 +- lib/pages/BookAppointment/BookConfirm.dart | 11 +- .../components/DocAvailableAppointments.dart | 8 +- lib/pages/ToDoList/ToDo.dart | 600 ++++++++++++------ lib/pages/ToDoList/widgets/paymentDialog.dart | 2 +- lib/pages/ToDoList/widgets/upcomingCard.dart | 420 ++++-------- lib/pages/livecare/widgets/clinic_list.dart | 2 +- lib/widgets/my_rich_text.dart | 4 +- 8 files changed, 539 insertions(+), 556 deletions(-) diff --git a/lib/models/Appointments/DoctorProfile.dart b/lib/models/Appointments/DoctorProfile.dart index df6031a7..f96eb4d6 100644 --- a/lib/models/Appointments/DoctorProfile.dart +++ b/lib/models/Appointments/DoctorProfile.dart @@ -1,47 +1,47 @@ class DoctorProfileList { - int doctorID; + num doctorID; String doctorName; - Null doctorNameN; - int clinicID; + dynamic doctorNameN; + num clinicID; String clinicDescription; - Null clinicDescriptionN; - Null licenseExpiry; - int employmentType; - Null setupID; - int projectID; + dynamic clinicDescriptionN; + dynamic licenseExpiry; + num employmentType; + dynamic setupID; + num projectID; String projectName; String nationalityID; String nationalityName; - Null nationalityNameN; - int gender; + dynamic nationalityNameN; + num gender; String genderDescription; - Null genderDescriptionN; - Null doctorTitle; - Null projectNameN; + dynamic genderDescriptionN; + dynamic doctorTitle; + dynamic projectNameN; bool isAllowWaitList; String titleDescription; - Null titleDescriptionN; - Null isRegistered; - Null isDoctorDummy; + dynamic titleDescriptionN; + dynamic isRegistered; + dynamic isDoctorDummy; bool isActive; bool isDoctorHasPrePostImages; - Null isDoctorAppointmentDisplayed; + dynamic isDoctorAppointmentDisplayed; bool doctorClinicActive; - Null isbookingAllowed; + dynamic isbookingAllowed; String doctorCases; - Null doctorPicture; + dynamic doctorPicture; String doctorProfileInfo; List specialty; - int actualDoctorRate; + num actualDoctorRate; String doctorImageURL; - int doctorRate; - double decimalDoctorRate; + num doctorRate; + num decimalDoctorRate; String doctorTitleForProfile; bool isAppointmentAllowed; String nationalityFlagURL; - int noOfPatientsRate; + num noOfPatientsRate; String qR; - int serviceID; + num serviceID; DoctorProfileList( {this.doctorID, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 323567b7..585e862d 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -47,6 +47,8 @@ class BookConfirm extends StatefulWidget { class _BookConfirmState extends State { ToDoCountProviderModel toDoProvider; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override void initState() { widget.authUser = new AuthenticatedUser(); @@ -195,8 +197,8 @@ class _BookConfirmState extends State { elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (!widget.isLiveCareAppointment) { + onPressed: () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -244,8 +246,8 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - if (!widget.isLiveCareAppointment) { + Future.delayed(new Duration(milliseconds: 1500), () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -441,6 +443,7 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); + this.sharedPref.remove(IS_LIVECARE_APPOINTMENT); Navigator.push( context, FadePage( diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 959816af..8e576c99 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -12,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; - import 'package:syncfusion_flutter_calendar/calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -79,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (widget.isLiveCareAppointment) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); @@ -351,22 +350,27 @@ class MeetingDataSource extends CalendarDataSource { DateTime getStartTime(int index) { return _getMeetingData(index).from; } + @override DateTime getEndTime(int index) { return _getMeetingData(index).to; } + @override String getSubject(int index) { return _getMeetingData(index).eventName; } + @override Color getColor(int index) { return _getMeetingData(index).background; } + @override bool isAllDay(int index) { return _getMeetingData(index).isAllDay; } + Meeting _getMeetingData(int index) { final dynamic meeting = appointments[index]; Meeting meetingData; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 1a0ec103..b46e1958 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -20,7 +18,10 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -40,7 +41,7 @@ class ToDo extends StatefulWidget { bool isShowAppBar = true; Function onBackClick; - ToDo({@required this.isShowAppBar,this.onBackClick}); + ToDo({@required this.isShowAppBar, this.onBackClick}); @override _ToDoState createState() => _ToDoState(); @@ -49,11 +50,7 @@ class ToDo extends StatefulWidget { class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; - AuthenticatedUserObject authenticatedUserObject = locator(); - List imagesInfo = List(); - ToDoCountProviderModel toDoProvider; CountdownTimerController controller; @@ -63,7 +60,7 @@ class _ToDoState extends State { void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authenticatedUserObject.isLogin) getPatientData(); + getPatientAppointmentHistory(); }); super.initState(); imagesInfo @@ -85,7 +82,7 @@ class _ToDoState extends State { showNewAppBarTitle: true, icon: "assets/images/new/bottom_nav/todo.svg", description: TranslationBase.of(context).infoTodo, - onTap:widget.onBackClick, + onTap: widget.onBackClick, backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( child: Column( @@ -98,207 +95,353 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { - print("ttt " + getNextActionImage(widget.appoList[index].nextAction)); - print("ttt " + widget.appoList[index].nextAction.toString()); return Container( - margin: EdgeInsets.all(10.0), + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: widget.appoList[index].clinicID == 265 + ? Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/drive-thru.svg"), + ) + : widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset("assets/images/new/virtual.svg") + : SvgPicture.asset("assets/images/new/hospital-visit.svg"), + + // SvgPicture.asset("assets/images/new/virtual.svg"), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + widget.appoList[index].clinicID == 265 + ? TranslationBase.of(context).drivethruAppo + : widget.appoList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCareAppo + : TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + 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), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) + : Container(); + }, + ), + ), + ], + ), + ], + ), + Container( + child: InkWell( + onTap: () { + performNextAction(widget.appoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: getNextActionButtonColor(widget.appoList[index].nextAction), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + getNextActionText(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + url: widget.appoList[index].doctorImageURL, + width: 52, + height: 52, ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), + SizedBox(width: 11), + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, children: [ - Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), - Container( - width: MediaQuery.of(context).size.width * 0.4, - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + - " " + - widget.appoList[index].startTime.substring(0, 5), - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 10.0)), - ), - !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), - Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: widget.appoList[index].isLiveCareAppointment - ? Container() - : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", - overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + RatingBar.readOnly( + initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), ], ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), - if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), - style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - Container( - child: CountdownTimer( - controller: - new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), - widgetBuilder: (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + - TranslationBase.of(context).upcomingTimeLeft, - style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) - : Container(); - }, - ), - ), - ], - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction(widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ), - ) - ], - ), - Divider( - color: Colors.grey[500], - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), - ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), - ), - ), - ) - ], - ), ], ), ), - ), + ], ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), - color: Color(0xff20bc44), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + getNextActionDescription(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), - height: 30.0, - padding: EdgeInsets.only(right: 10, left: 10), - margin: EdgeInsets.symmetric(horizontal: 20), - transform: Matrix4.translationValues(0.0, -8.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - widget.appoList[index].clinicID == 265 - ? Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: SvgPicture.asset( - "assets/images/new/car_icon.svg", - height: 15, - width: 15, - ), - ) - : widget.appoList[index].isLiveCareAppointment - ? Image.asset("assets/images/new-design/video.png") - : Image.asset("assets/images/new-design/walkin.png"), - widget.appoList[index].clinicID == 265 - ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : widget.appoList[index].isLiveCareAppointment - ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - ], + ), + InkWell( + onTap: () { + navigateToAppointmentDetails(context, widget.appoList[index]); + }, + child: Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), ), ), ], ), ); + // return Container( + // margin: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // child: Card( + // margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + // color: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // child: Container( + // width: MediaQuery.of(context).size.width, + // padding: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Row( + // children: [ + // Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), + // Container( + // width: MediaQuery.of(context).size.width * 0.4, + // margin: EdgeInsets.only(left: 10.0, right: 10.0), + // child: Text( + // DateUtil.getWeekDayMonthDayYearDateFormatted( + // DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + + // " " + + // widget.appoList[index].startTime.substring(0, 5), + // overflow: TextOverflow.clip, + // style: TextStyle(fontSize: 10.0)), + // ), + // !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), + // Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: widget.appoList[index].isLiveCareAppointment + // ? Container() + // : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + // overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + // ), + // ], + // ), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Divider( + // color: Colors.grey[500], + // ), + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 1, + // child: Container( + // height: MediaQuery.of(context).size.height * 0.1, + // margin: EdgeInsets.only(top: 5.0), + // child: ClipRRect( + // borderRadius: BorderRadius.circular(100.0), + // child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), + // ), + // ), + // ), + // Expanded( + // flex: 3, + // child: Container( + // margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + // style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), + // if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") + // Container( + // margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + // child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), + // style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisSize: MainAxisSize.max, + // children: [ + // RatingBar.readOnly( + // initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + // size: 20.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + // ], + // ), + // Container( + // child: CountdownTimer( + // controller: + // new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + // widgetBuilder: (_, CurrentRemainingTime time) { + // return time != null + // ? Text( + // '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + // TranslationBase.of(context).upcomingTimeLeft, + // style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) + // : Container(); + // }, + // ), + // ), + // ], + // ), + // ), + // ), + // Expanded( + // flex: 1, + // child: InkWell( + // onTap: () => performNextAction(widget.appoList[index]), + // child: Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Column( + // children: [ + // Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + // ) + // ], + // ), + // ), + // ), + // ) + // ], + // ), + // Divider( + // color: Colors.grey[500], + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 2, + // child: Container( + // child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), + // ), + // ), + // Expanded( + // flex: 1, + // child: GestureDetector( + // onTap: () { + // navigateToAppointmentDetails(context, widget.appoList[index]); + // }, + // child: Container( + // child: Text(TranslationBase.of(context).upcomingDetails, + // textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), + // ), + // ), + // ) + // ], + // ), + // ], + // ), + // ), + // ), + // ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), + // color: Color(0xff20bc44), + // ), + // height: 30.0, + // padding: EdgeInsets.only(right: 10, left: 10), + // margin: EdgeInsets.symmetric(horizontal: 20), + // transform: Matrix4.translationValues(0.0, -8.0, 0.0), + // child: Row( + // mainAxisSize: MainAxisSize.min, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // widget.appoList[index].clinicID == 265 + // ? Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: SvgPicture.asset( + // "assets/images/new/car_icon.svg", + // height: 15, + // width: 15, + // ), + // ) + // : widget.appoList[index].isLiveCareAppointment + // ? Image.asset("assets/images/new-design/video.png") + // : Image.asset("assets/images/new-design/walkin.png"), + // widget.appoList[index].clinicID == 265 + // ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : widget.appoList[index].isLiveCareAppointment + // ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // ], + // ), + // ), + // ], + // ), + // ); }, ), ), @@ -375,6 +518,48 @@ class _ToDoState extends State { } } + Color getNextActionButtonColor(nextAction) { + switch (nextAction) { + case 0: + return CustomColors.accentColor; + break; + case 10: + return CustomColors.green; + break; + + case 15: + return CustomColors.grey2; + break; + + case 20: + return CustomColors.green; + break; + + case 30: + return CustomColors.accentColor; + break; + + case 40: + return CustomColors.green; + break; + + case 50: + return CustomColors.green; + break; + + case 60: + return CustomColors.orange; + break; + + case 90: + return CustomColors.accentColor; + break; + + default: + return CustomColors.green; + } + } + String getNextActionText(nextAction) { switch (nextAction) { case 0: @@ -732,35 +917,34 @@ class _ToDoState extends State { }); } - getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - setState(() { - print(data); - authUser = data; - }); - getPatientAppointmentHistory(); - } - } + // getPatientData() async { + // AppSharedPreferences sharedPref = AppSharedPreferences(); + // if (await sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + // setState(() { + // print(data); + // authUser = data; + // }); + // getPatientAppointmentHistory(); + // } + // } Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - - Navigator.push(context, FadePage(page: PaymentMethod( - onSelectedMethod: (String metohd) { + // if (await this.sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + // setState(() { + // authUser = data; + // }); + // } + + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { setState(() {}); }))).then((value) { print(value); getPatientAppointmentHistory(); if (value != null) { - openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index eedbb874..7a0bdc2e 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -89,7 +89,7 @@ class _PaymentDialogState extends State { children: [ Expanded( child: DefaultButton( - TranslationBase.of(context).cancel, + TranslationBase.of(context).cancel_nocaps, () { Navigator.pop(context, null); }, diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 6610ed33..863947ea 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -1,20 +1,17 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { - AppoitmentAllHistoryResultList appo; - var languageID; - final VoidCallback onListUpdated; - - TodoListCard({@required this.appo, this.onListUpdated}); + TodoListCard(); @override _TodoListCardState createState() => _TodoListCardState(); @@ -25,333 +22,128 @@ class _TodoListCardState extends State { @override void initState() { -// widget.onListUpdated(); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( + width: double.infinity, margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Row( - children: [ - Image.asset("assets/images/new-design/time_icon.png", - width: 20.0, height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 30.0), - child: Text(getDate(widget.appo.appointmentDate), - style: TextStyle(fontSize: 12.0)), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: SvgPicture.asset("assets/images/new/virtual.svg"), ), - widget.appo.isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: widget.appo.isLiveCareAppointment - ? Text(TranslationBase.of(context).upcomingLivecare, - style: TextStyle(fontSize: 12.0)) - : Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text(TranslationBase.of(context).videoAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text("01:23:22 " + TranslationBase.of(context).upcomingTimeLeft, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)), + ), + ], ), ], ), Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appo.doctorImageURL, - fit: BoxFit.fill), - ), + child: InkWell( + onTap: () { + // showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: CustomColors.green, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), ), - ), - Expanded( - flex: 3, - child: Container( - margin: - EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - widget.appo.doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: 4.0, - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - ], - ), + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget.appo.nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget.appo.nextAction), - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ) - ], + ), ), - Divider( - color: Colors.grey[500], + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + "Raed Mubarak Bin Ghanem", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: "Raed Mubarak Bin Ghanem", + url: "https://hmgwebservices.com/Images/MobileImages/TAKHSUSI/158210.png", + width: 52, + height: 52, ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription(widget.appo.nextAction), - style: TextStyle( - fontSize: 12.0, color: Colors.grey[700])), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", "Cardiology", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", "11/04/2021 15:30", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, "Olaya Hospital", projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: 4.5, + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: new Color(0xFF40ACC9), - decoration: TextDecoration.underline)), - ), - ), - ) - ], + ], + ), ), ], ), - ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + "Please confirm the appointment to avoid cancellation", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + "More Details", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), + ), + ], ), ); } - - String getNextActionImage(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return "assets/images/new-design/confirm_button.png"; - break; - - case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; - break; - - case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; - break; - - case 30: - return "assets/images/new-design/qr_code_button.png"; - break; - - case 40: - return "assets/images/new-design/video_call_instruction.png"; - break; - - case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; - break; - - default: - return ""; - } - } - - String getNextActionText(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).confirm; - break; - - case 15: - return TranslationBase.of(context).pendingPayment; - break; - - case 20: - return TranslationBase.of(context).payNow; - break; - - case 30: - return TranslationBase.of(context).viewQR; - break; - - case 40: - return TranslationBase.of(context).instruction; - break; - - case 50: - return TranslationBase.of(context).livecare; - break; - - default: - return ""; - } - } - - String getNextActionDescription(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).upcomingConfirm; - break; - - case 15: - return TranslationBase.of(context).upcomingPaymentPending; - break; - - case 20: - return TranslationBase.of(context).upcomingPaymentNow; - break; - - case 30: - return TranslationBase.of(context).upcomingQR; - break; - - case 40: - return TranslationBase.of(context).upcomingVirtual; - break; - - case 50: - return TranslationBase.of(context).upcomingLivecare; - break; - - default: - return ""; - } - } - - getLanguageID() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - widget.languageID = languageID; - }); - } - - String getDate(String date) { - DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString() + - " " + - dateObj.hour.toString() + - ":" + - getMinute(dateObj); - } - - String getMinute(DateTime dateObj) { - if (dateObj.minute == 0) { - return dateObj.minute.toString() + "0"; - } else { - return dateObj.minute.toString(); - } - } - - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - - Future navigateToAppointmentDetails(context) async { - Navigator.push( - context, FadePage(page: AppointmentDetails())); - } } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 988d102c..bf4d33c7 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -626,7 +626,7 @@ class _clinic_listState extends State { } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: true, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { diff --git a/lib/widgets/my_rich_text.dart b/lib/widgets/my_rich_text.dart index 92100f48..c3d108c5 100644 --- a/lib/widgets/my_rich_text.dart +++ b/lib/widgets/my_rich_text.dart @@ -12,11 +12,11 @@ class MyRichText extends StatelessWidget { maxLines: 1, text: TextSpan( text: title, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), children: [ TextSpan( text: " $value", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ) ]), ); From 30e67bbe3e11db3f2970ddd1cc265f9269695670 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 17:26:32 +0300 Subject: [PATCH 3/3] updates --- .../service/blood/blood_donation_service.dart | 47 ++++++++-------- .../medical/my_balance_view_model.dart | 16 +++--- lib/pages/Blood/blood_donation.dart | 56 ++++++++++++------- 3 files changed, 67 insertions(+), 52 deletions(-) diff --git a/lib/core/service/blood/blood_donation_service.dart b/lib/core/service/blood/blood_donation_service.dart index 0128d0d1..a59a2169 100644 --- a/lib/core/service/blood/blood_donation_service.dart +++ b/lib/core/service/blood/blood_donation_service.dart @@ -10,13 +10,13 @@ class BloodDonationService extends BaseService { List CitiesModelList = List(); Map body = Map(); + Future getAllCitiesOrders() async { hasError = false; body['ListCities'] = false; - await baseAppClient.post(GET_CITIES_REQUEST, - onSuccess: (dynamic response, int statusCode) { + body["IsPublicRequest"] = true; + await baseAppClient.post(GET_CITIES_REQUEST, onSuccess: (dynamic response, int statusCode) { CitiesModelList.clear(); - response['ListCities'].forEach((vital) { CitiesModelList.add(CitiesModel.fromJson(vital)); }); @@ -25,16 +25,16 @@ class BloodDonationService extends BaseService { super.error = error; }, body: body); } + Future bloodDonationSave(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_REQUEST, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_REQUEST, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; @@ -44,30 +44,27 @@ class BloodDonationService extends BaseService { Future getAgreement() async { var localRes; try { - await baseAppClient.post(GET_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: {}); + await baseAppClient.post(GET_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: {}); return Future.value(localRes); } catch (error) { throw error; } } - Future saveAgreement(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index a92b6e16..e12e2b07 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -81,13 +81,15 @@ class MyBalanceViewModel extends BaseViewModel { } Future getCities() async { - setState(ViewState.Busy); - await _bloodDonationService.getAllCitiesOrders(); - if (_bloodDonationService.hasError) { - error = _bloodDonationService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + if(isLogin) { + setState(ViewState.Busy); + await _bloodDonationService.getAllCitiesOrders(); + if (_bloodDonationService.hasError) { + error = _bloodDonationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } Future getBlood() async { diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 3a702d32..c5e0f714 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -73,26 +73,42 @@ class _BloodDonationPageState extends State { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) { - if (projectProvider.isLogin && projectProvider.user != null) { - model.getCities().then((value) { - model.getBlood().then((value) { - if (model.bloodModelList.length > 0) { - CitiesModel citiesModel = new CitiesModel(); - citiesModel.iD = getSelectedCityID(model); - _selectedHospitalIndex = (citiesModel.iD - 1); - citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; - citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; - _selectedHospital = citiesModel; - _selectedBloodType = model.bloodModelList[0].bloodGroup; - _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); - } else { - _selectedHospital = model.CitiesModelList[0]; - } - }); - }); - } - }, + onModelReady: (model) => model.getCities().then((value) { + model.getBlood().then((value) { + if (model.bloodModelList.length > 0) { + CitiesModel citiesModel = new CitiesModel(); + citiesModel.iD = getSelectedCityID(model); + _selectedHospitalIndex = (citiesModel.iD - 1); + citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + _selectedHospital = citiesModel; + _selectedBloodType = model.bloodModelList[0].bloodGroup; + _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + } else { + _selectedHospital = model.CitiesModelList[0]; + } + }); + }), + // { + // if (projectProvider.isLogin && projectProvider.user != null) { + // model.getCities().then((value) { + // model.getBlood().then((value) { + // if (model.bloodModelList.length > 0) { + // CitiesModel citiesModel = new CitiesModel(); + // citiesModel.iD = getSelectedCityID(model); + // _selectedHospitalIndex = (citiesModel.iD - 1); + // citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + // citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + // _selectedHospital = citiesModel; + // _selectedBloodType = model.bloodModelList[0].bloodGroup; + // _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + // } else { + // _selectedHospital = model.CitiesModelList[0]; + // } + // }); + // }); + // } + // }, builder: (_, model, w) => AppScaffold( isShowAppBar: true, showNewAppBar: true,