From f995a9fa8e9e84d63f8e72b095d8ad7a99b42173 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 13:19:14 +0300 Subject: [PATCH] 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, - ),*/ ), ); },