Merge remote-tracking branch 'origin/development_new_design_2.0' into development_new_design_2.0

merge-update-with-lab-changes
Mirza.Shafique 4 years ago
commit 26c30038c9

@ -20,25 +20,25 @@ class LaboratoryResultPage extends StatefulWidget {
class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
@override
Widget build(BuildContext context) {
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLaboratoryResult(
invoiceNo: widget.patientLabOrders.invoiceNo,
clinicID: widget.patientLabOrders.clinicID,
projectID: widget.patientLabOrders.projectID,
orderNo: widget.patientLabOrders.orderNo),
invoiceNo: widget.patientLabOrders.invoiceNo, clinicID: widget.patientLabOrders.clinicID, projectID: widget.patientLabOrders.projectID, orderNo: widget.patientLabOrders.orderNo),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).labResults,
appBarTitle: widget.patientLabOrders.doctorName,
baseViewModel: model,
body: Scaffold(
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
body: ListView.builder(
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: ()async {
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders,mes: TranslationBase.of(context).sendSuc);
await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc);
GifLoaderDialogUtils.hideDialog(context);
},
billNo: widget.patientLabOrders.invoiceNo,
@ -49,7 +49,6 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
itemCount: model.patientLabSpecialResult.length,
),
),
),
);
}
}

@ -3,15 +3,20 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../text.dart';
import 'LabResultWidget.dart';
@ -23,14 +28,7 @@ class LaboratoryResultWidget extends StatefulWidget {
final String orderNo;
final PatientLabOrders patientLabOrder;
const LaboratoryResultWidget(
{Key key,
this.onTap,
this.billNo,
this.details,
this.orderNo,
this.patientLabOrder})
: super(key: key);
const LaboratoryResultWidget({Key key, this.onTap, this.billNo, this.details, this.orderNo, this.patientLabOrder}) : super(key: key);
@override
_LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState();
@ -45,79 +43,20 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>(
onModelReady: (model) =>
model.getPatientLabResult(patientLabOrder: widget.patientLabOrder),
// onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder),
builder: (_, model, w) => NetworkBaseView(
baseViewModel: model,
child: Container(
margin: EdgeInsets.all(15),
child: Column(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
)),
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(TranslationBase.of(context).invoiceNo),
Texts(widget.billNo),
],
),
),
),
InkWell(
onTap: (){
showConfirmMessage(context,widget.onTap,model.user.emailAddress);
},
child: Container(
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
)),
child: Container(
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.email,
color: Colors.white,
),
Texts(
TranslationBase.of(context).sendEmail,
color: Colors.white,
)
],
),
),
),
)
],
),
),
SizedBox(
height: 12,
DoctorHeader(
patientLabOrder: widget.patientLabOrder,
invoiceNo: widget.billNo,
email: model.user.emailAddress,
onTap: widget.onTap,
),
if( model.labResultLists.isNotEmpty)
SizedBox(height: 10),
if (model.labResultLists.isNotEmpty)
Container(
child: Column(
children: [
@ -130,27 +69,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
);
},
child: Container(
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10),
margin: EdgeInsets.only(left: 21, right: 21, top: 12),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
)),
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Row(
children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).generalResult)),
Container(
width: 25,
height: 25,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor),
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Icon(
_isShowMoreGeneral
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
_isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.white,
size: 22,
),
@ -175,18 +119,14 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
child: Container(
width: double.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...List.generate(
model.labResultLists.length,
(index) => LabResultWidget(
patientLabOrder: widget.patientLabOrder,
filterName: model
.labResultLists[index].filterName,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
filterName: model.labResultLists[index].filterName,
patientLabResultList: model.labResultLists[index].patientLabResultList,
),
)
],
@ -196,9 +136,6 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
],
),
),
SizedBox(
height: 10,
),
InkWell(
onTap: () {
setState(() {
@ -206,26 +143,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
});
},
child: Container(
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10),
margin: EdgeInsets.only(left: 21, right: 21, top: 12),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
)),
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Row(
children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).specialResult)),
Container(
width: 25,
height: 25,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Theme.of(context).primaryColor),
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Icon(
_isShowMore
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.white,
size: 22,
),
@ -252,23 +195,8 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
data: widget.details ?? TranslationBase.of(context).noDataAvailable,
)),
),
],
),
],
),
),
),
);
}
void showConfirmMessage(BuildContext context, GestureTapCallback onTap,String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
),
);
}

@ -154,8 +154,10 @@ class DoctorCard extends StatelessWidget {
),
);
}
}
Widget myRichText(String title, String value) {
// todo 'sikander' move this widget to separate file
Widget myRichText(String title, String value) {
return RichText(
text: TextSpan(
text: title,
@ -167,5 +169,4 @@ class DoctorCard extends StatelessWidget {
)
]),
);
}
}

@ -0,0 +1,138 @@
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:rating_bar/rating_bar.dart';
class DoctorHeader extends StatelessWidget {
final PatientLabOrders patientLabOrder;
final String invoiceNo;
final String email;
final VoidCallback onTap;
DoctorHeader({Key key, @required this.patientLabOrder, @required this.email, @required this.invoiceNo, @required this.onTap}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(left: 21, right: 21, bottom: 21),
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LargeAvatar(
name: patientLabOrder.doctorName,
url: patientLabOrder.doctorImageURL,
width: 51,
height: 51,
),
SizedBox(width: 10),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
(patientLabOrder?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""),
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
),
myRichText(TranslationBase.of(context).invoiceNo + ":", invoiceNo),
myRichText(TranslationBase.of(context).branch, patientLabOrder.projectName),
],
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.formatDateToDate(patientLabOrder.orderDate),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
),
Text(
DateUtil.formatDateToTime(patientLabOrder.orderDate),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Image.network(patientLabOrder.nationalityFlagURL, height: 16),
),
],
)
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(width: 21),
RatingBar.readOnly(
initialRating: patientLabOrder.doctorRate + 0.0,
size: 15.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
),
SizedBox(width: 6),
Text(
"${patientLabOrder.actualDoctorRate} ${TranslationBase.of(context).reviews}",
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
),
],
),
InkWell(
onTap: () {
showConfirmMessage(context, onTap, email);
},
child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15),
decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: BorderRadius.only(topLeft: Radius.circular(10))),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// todo: 'change icon for send email'
SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 19.0),
SizedBox(width: 6),
Text(
TranslationBase.of(context).sendEmail,
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 25 / 16),
),
],
),
),
)
],
)
],
),
);
}
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
),
);
}
}
Loading…
Cancel
Save