diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index 104b390d..1d849755 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -25,9 +25,9 @@ class PrescriptionDeliveryService extends BaseService { Map body = Map(); body['latitude'] = latitude; body['longitude'] = longitude; - body['AppointmentNo'] = appointmentNo; - body['CreatedBy'] = createdBy; - body['DischargeID'] = dischargeID; + body['AppointmentNo'] = appointmentNo.toString(); + // body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID.toString(); await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { var asd = ""; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index fa2a24c6..48c4f1bf 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; @@ -16,8 +17,9 @@ import 'package:flutter/cupertino.dart'; class PrescriptionsService extends BaseService { List prescriptionsList = List(); List prescriptionReportListINP = List(); - List prescriptionsOrderList = List(); + List prescriptionsOrderList = List(); var isMedDeliveryAllowed; + Future getPrescriptions() async { hasError = false; Map body = Map(); @@ -36,10 +38,24 @@ class PrescriptionsService extends BaseService { Future getPrescriptionsOrders() async { prescriptionsOrderList.clear(); Map body = Map(); - body['isDentalAllowedBackend'] = false; + // body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { - prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + // prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescriptionsOrdersRC() async { + prescriptionsOrderList.clear(); + Map body = Map(); + // body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + response['response'].forEach((prescriptionsOrder) { + prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 03018878..be6153bd 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; @@ -26,7 +27,7 @@ class PrescriptionsViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionsService.prescriptionsList; - List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; + List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; @@ -79,7 +80,8 @@ class PrescriptionsViewModel extends BaseViewModel { getPrescriptionsOrders({bool showLoading = false}) async { setState(ViewState.Busy); Future.delayed(new Duration(milliseconds: 300)).then((value) async { - await _prescriptionsService.getPrescriptionsOrders(); + // await _prescriptionsService.getPrescriptionsOrders(); + await _prescriptionsService.getPrescriptionsOrdersRC(); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index d85db81f..bbd73d64 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -27,6 +27,8 @@ class _HospitalsPageState extends State { LocationUtils locationUtils; var weather = '--'; + ProjectViewModel projectViewModel; + @override void initState() { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); @@ -37,7 +39,7 @@ class _HospitalsPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeatherData(), allowAny: true, @@ -131,7 +133,7 @@ class _HospitalsPageState extends State { padding: EdgeInsets.all(15), child: Column( children: mode.weatherIndicatorData.map((data) { - return WeatherSlider(data); + return WeatherSlider(data, projectViewModel); }).toList())) ])) : Center(child: AppCircularProgressIndicator())), diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 26b6421c..8688fec3 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -78,7 +79,7 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - Navigator.of(context).push(FadePage(page: Register())), + Navigator.of(context).push(FadePage(page: RegisterNew())), }, color: CustomColors.accentColor, textColor: Colors.white, diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index 986fb848..719b2196 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -9,9 +9,10 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -101,23 +102,43 @@ class PrescriptionOrderOverview extends StatelessWidget { prescriptionReportEnhList.length, (index) => Container( margin: EdgeInsets.all(0.0), - decoration: cardRadius(0), + // decoration: cardRadius(0), child: Row( children: [ - Container( - margin: EdgeInsets.only(bottom: 10.0), - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(30)), - child: Image.network( - prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 48, - height: 48, - ), + InkWell( + onTap: () { + showZoomImageDialog(context, prescriptionReportEnhList[index].imageSRCUrl); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(3), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), ), SizedBox(width: 14), @@ -153,15 +174,14 @@ class PrescriptionOrderOverview extends StatelessWidget { ), ), Container( - decoration: cardRadius(0), + // decoration: cardRadius(0), margin: EdgeInsets.zero, child: Container( width: double.infinity, margin: EdgeInsets.all(12), - child: SecondaryButton( - label: TranslationBase.of(context).submit.toUpperCase(), - color: CustomColors.accentColor, - onTap: () async { + child: DefaultButton( + TranslationBase.of(context).submit.toUpperCase(), + () async { showDialog( context: context, child: ConfirmWithMessageDialog( diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 3fbc2baf..5a47ec3b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -23,6 +23,7 @@ import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override @@ -111,14 +112,18 @@ class PrescriptionDetailsPage extends StatelessWidget { decoration: cardRadius(2000), ), Container( - child: Icon(Icons.search,size: 18,color: Colors.white,), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), padding: EdgeInsets.all(6), decoration: containerRadius(Colors.black.withOpacity(0.3), 200), ) ], ), - onTap: (){ - showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + onTap: () { + showZoomImageDialog(context, prescriptionReport.imageSRCUrl); }, ), SizedBox(width: 12), diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 1da0adb6..adce13bb 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -1,12 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -25,126 +24,130 @@ class PrescriptionsHistoryPage extends StatelessWidget { onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true), builder: (_, model, widget) => AppScaffold( baseViewModel: prescriptionsViewModel, - body: ListView.separated( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.all(21), - separatorBuilder: (context, index) { - return SizedBox(height: 12); - }, - itemBuilder: (context, index) { - int status = prescriptionsViewModel.prescriptionsHistory[index].status; - String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; - 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) { - //cancel // Rejected - _color = Color(0xffD02127); - } + body: model.state != ViewState.Busy + ? prescriptionsViewModel.prescriptionsHistory.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].statusId; + String _statusDisp = prescriptionsViewModel.prescriptionsHistory[index].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 InkWell( - onTap: () async { - final result = await Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ); - if (result != null) { - showOrderLog(); - } - }, - child: Container( - height: 65, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - width: 6, - decoration: BoxDecoration( - color: _color, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _statusDisp, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), - ), - Text( - '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - ], - ), + return InkWell( + onTap: () async { + // final result = await Navigator.push( + // context, + // FadePage( + // page: PrescriptionsHistoryDetailsPage( + // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + // ), + // ), + // ); + // if (result != null) { + // showOrderLog(); + // } + }, + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + ), ), - Text( - DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTimeLang(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created), false), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), ), - ], - ) - ], - ), - ), - ), - Icon( - Icons.arrow_forward, - size: 16, - ), - mWidth(6), - ], - ), - )); - }, - itemCount: prescriptionsViewModel.prescriptionsHistory.length, - ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + mWidth(6), + ], + ), + )); + }, + itemCount: prescriptionsViewModel.prescriptionsHistory.length, + ) + : getNoDataWidget(context) + : Container(), )); } } diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 26c8dc22..d5efa38b 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -90,7 +90,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), @@ -99,7 +99,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index 64b72f2b..131a2820 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -14,11 +14,12 @@ import '../show_zoom_image_dialog.dart'; /// [height] the avatar height /// [onTap] on tap function class LargeAvatar extends StatelessWidget { - LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap}) : super(key: key); + LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar: false}) : super(key: key); final String name; final String url; final bool disableProfileView; + final bool isAppointmentAvatar; final double radius; final double width; final double height; @@ -38,7 +39,7 @@ class LargeAvatar extends StatelessWidget { width: width, height: height, ), - if (!disableProfileView) + if (!disableProfileView && !isAppointmentAvatar) Container( child: Icon(Icons.search,size: 18,color: Colors.white,), padding: EdgeInsets.all(6), @@ -62,7 +63,7 @@ class LargeAvatar extends StatelessWidget { return InkWell( onTap: disableProfileView ? null - : () { + : isAppointmentAvatar ? onTap : () { print("ssssss " + url.trim()); showZoomImageDialog(context, url.trim() ?? ""); }, diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 3851f329..4d38de2e 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -35,6 +35,7 @@ class _TimeLineViewState extends State { List dateObjs = []; DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); + @override void initState() { super.initState(); @@ -347,14 +348,15 @@ class TimelineNewWidget extends StatelessWidget { FadePage( page: AppointmentDetails( appo: appoitmentAllHistoryResul, - parentIndex: 2, + parentIndex: 2, ))); }, name: appoitmentAllHistoryResul.doctorNameObj, - disableProfileView: true, + disableProfileView: false, url: appoitmentAllHistoryResul.doctorImageURL, width: 30, height: 30, + isAppointmentAvatar: true, ), mHeight(6), Text( diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart index fe82cf49..0e784a05 100644 --- a/lib/widgets/weather_slider/weather_slider.dart +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -1,47 +1,29 @@ import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class WeatherSlider extends StatelessWidget { - // final width; - // final LinearGradient color; final GetCityInfoList data; - WeatherSlider(this.data); - LinearGradient red = LinearGradient( - colors: [ - Colors.redAccent[100], - Colors.redAccent - ]); - LinearGradient green = LinearGradient( - colors: [ - Colors.greenAccent[100], - Colors.greenAccent - ]); - LinearGradient grey = LinearGradient( - colors: [ - Colors.grey[100], - Colors.grey - ]); - LinearGradient orange = LinearGradient( - colors: [ - Colors.orangeAccent[100], - Colors.orange - ]); - LinearGradient yellow = LinearGradient( - colors: [ - Colors.yellow[100], - Colors.yellow[600] - ]); + + final ProjectViewModel projectViewModel; + + WeatherSlider(this.data, this.projectViewModel); + + LinearGradient red = LinearGradient(colors: [Colors.redAccent[100], Colors.redAccent]); + LinearGradient green = LinearGradient(colors: [Colors.greenAccent[100], Colors.greenAccent]); + LinearGradient grey = LinearGradient(colors: [Colors.grey[100], Colors.grey]); + LinearGradient orange = LinearGradient(colors: [Colors.orangeAccent[100], Colors.orange]); + LinearGradient yellow = LinearGradient(colors: [Colors.yellow[100], Colors.yellow[600]]); + @override Widget build(BuildContext context) { // TODO: implement build return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only(top:10), - child: AppText(data.name)), + Padding(padding: EdgeInsets.only(top: 10), child: AppText(data.name)), AppText( data.category, fontSize: 24, @@ -51,11 +33,8 @@ class WeatherSlider extends StatelessWidget { child: Stack( children: [ Container( - margin: EdgeInsets.only(bottom:10), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.grey[100], Colors.grey[400]]), - borderRadius: BorderRadius.circular(10)), + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100], Colors.grey[400]]), borderRadius: BorderRadius.circular(10)), height: 15, width: MediaQuery.of(context).size.width, child: SizedBox(), @@ -64,110 +43,200 @@ class WeatherSlider extends StatelessWidget { top: 0, child: Container( decoration: BoxDecoration( - gradient: data.colorName =='red' ? red : data.colorName =='orange' ? orange : data.colorName =='green' ? green : data.colorName == 'yellow' ? yellow : grey, + gradient: data.colorName == 'red' + ? red + : data.colorName == 'orange' + ? orange + : data.colorName == 'green' + ? green + : data.colorName == 'yellow' + ? yellow + : grey, borderRadius: BorderRadius.circular(10)), height: 15, width: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), padding: EdgeInsets.all(15), child: SizedBox(), )), - Positioned(child: Container( - height: 0, - width:0, - decoration: ShapeDecoration( - color:data.colorName =='red' ? Colors.redAccent : data.colorName =='orange' ? Colors.orangeAccent : data.colorName =='green' ? Colors.greenAccent : data.colorName == 'yellow' ? Colors.yellowAccent : Colors.grey, - shape: MessageBorder(), - - )),top:25, left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)),) - + projectViewModel.isArabic + ? Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + right: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) + : Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) ], ), - ), Padding( - padding: EdgeInsets.only(top:10), - child: data.isValuesReversed == false ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - ) : Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - )), - Padding( - padding: EdgeInsets.all(15), - child:Divider()) + padding: EdgeInsets.only(top: 10), + child: data.isValuesReversed == false + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + )), + Padding(padding: EdgeInsets.all(15), child: Divider()) ], ); - } } + class MessageBorder extends ShapeBorder { final bool usePadding; final bool reverse; - MessageBorder({this.usePadding = true, this.reverse =false}); + + MessageBorder({this.usePadding = true, this.reverse = false}); @override - EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding? 0 : 0); + EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding ? 0 : 0); @override Path getInnerPath(Rect rect, {TextDirection textDirection}) => null; @@ -175,17 +244,16 @@ class MessageBorder extends ShapeBorder { @override Path getOuterPath(Rect rect, {TextDirection textDirection}) { rect = Rect.fromPoints(rect.bottomRight, rect.bottomLeft - Offset(0, 0)); - if(!reverse) { + if (!reverse) { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx - 10, rect.topCenter.dy) - ..relativeLineTo(10, -10)..relativeLineTo(10, 10) + ..relativeLineTo(10, -10) + ..relativeLineTo(10, 10) ..close(); - }else{ + } else { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx, rect.topCenter.dy) ..relativeLineTo(10, 20) ..relativeLineTo(20, -20) @@ -198,4 +266,4 @@ class MessageBorder extends ShapeBorder { @override ShapeBorder scale(double t) => this; -} \ No newline at end of file +}