From eed4fd25094d01a916919e4f3b6f59b017a26516 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 27 Oct 2021 09:55:43 +0300 Subject: [PATCH] Pharmacy prescriptions page design --- .../pharmacyModule/PrescriptionViewModel.dart | 2 +- .../fragments/home_page_fragment2.dart | 3 +- .../widgets/home/PrescriptionsWidget.dart | 278 ++++++++---------- 3 files changed, 118 insertions(+), 165 deletions(-) diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 86a320e6..420ec1fa 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -14,7 +14,7 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); - if(prescriptionsList.isNotEmpty){ + if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); if (_prescriptionService.hasError) { diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 7fcfecae..4714c208 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; @@ -236,7 +237,7 @@ class _HomePageFragment2State extends State { ), FlatButton( onPressed: () { - Navigator.push(context, FadePage(page: AllHabibMedicalService())); + Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); }, child: Text( TranslationBase.of(context).viewAllServices, diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 28556679..fe8ca977 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -27,30 +25,21 @@ class PrescriptionsWidget extends StatelessWidget { isLocalLoader: true, baseViewModel: model, child: Container( - height: model.prescriptionsList.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, child: Column( children: [ - ViewAllHomeWidget( - TranslationBase.of(context).myPrescription, - HomePrescriptionsPage()), + ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 14.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.only(right: 10.0, left: 10.0), + height: MediaQuery.of(context).size.height * 0.18, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( - height: MediaQuery.of(context).size.height * 0.3, - padding: EdgeInsets.only( - bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), + padding: EdgeInsets.only(left: 8.0, right: 8.0), + margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( border: Border.all( color: Colors.grey, @@ -59,167 +48,130 @@ class PrescriptionsWidget extends StatelessWidget { ), color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( children: [ - Row( - children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 15.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: - Colors.transparent, - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, - ), - ), + Column(children: [ + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 15.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 60, + height: 60, ), - ]), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 1), - padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, - ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( - model.languageID == "ar" - ? model - .prescriptionsList[ - index] - .isInOutPatientDescriptionN - .toString() - : model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( - DateUtil.convertStringToDate( - model - .prescriptionsList[ - index] - .appointmentDate - .toString()) - .toString() - .substring(0, 10), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - ), - ) - ]), - ], ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + ), + ]), + Column( + children: [ Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index] - .doctorTitle - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index] - .doctorName - .toString(), + margin: EdgeInsets.only(left: 1), + padding: EdgeInsets.only(left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0)), + child: Text( + model.languageID == "ar" + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 15.0, - fontWeight: FontWeight.bold, ), - ), - ]), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index] - .clinicDescription - .toString(), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + DateUtil.convertStringToDate(model.prescriptionsList[index].appointmentDate.toString()).toString().substring(0, 10), style: TextStyle( - color: Colors.green, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, ), + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, ), ), - ], + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .prescriptionsList[index] - .actualDoctorRate - .toDouble(), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), // initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ) - ]), - ]), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + ]), + ]), ); }), ),