Merge branch 'login_design_sikander' into development_new_design_2.0

merge-update-with-lab-changes
Sikander Saleem 5 years ago
commit 35b5d38b82

@ -20,25 +20,25 @@ class LaboratoryResultPage extends StatefulWidget {
class _LaboratoryResultPageState extends State<LaboratoryResultPage> { class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLaboratoryResult( onModelReady: (model) => model.getLaboratoryResult(
invoiceNo: widget.patientLabOrders.invoiceNo, invoiceNo: widget.patientLabOrders.invoiceNo, clinicID: widget.patientLabOrders.clinicID, projectID: widget.patientLabOrders.projectID, orderNo: widget.patientLabOrders.orderNo),
clinicID: widget.patientLabOrders.clinicID,
projectID: widget.patientLabOrders.projectID,
orderNo: widget.patientLabOrders.orderNo),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).labResults, appBarTitle: widget.patientLabOrders.doctorName,
baseViewModel: model, baseViewModel: model,
body: Scaffold( showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
body: ListView.builder( body: ListView.builder(
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) => LaboratoryResultWidget( itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: ()async { onTap: () async {
GifLoaderDialogUtils.showMyDialog(context); 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); GifLoaderDialogUtils.hideDialog(context);
}, },
billNo: widget.patientLabOrders.invoiceNo, billNo: widget.patientLabOrders.invoiceNo,
@ -49,7 +49,6 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
itemCount: model.patientLabSpecialResult.length, 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/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.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/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/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:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.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:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../text.dart'; import '../../text.dart';
import 'LabResultWidget.dart'; import 'LabResultWidget.dart';
@ -23,14 +28,7 @@ class LaboratoryResultWidget extends StatefulWidget {
final String orderNo; final String orderNo;
final PatientLabOrders patientLabOrder; final PatientLabOrders patientLabOrder;
const LaboratoryResultWidget( const LaboratoryResultWidget({Key key, this.onTap, this.billNo, this.details, this.orderNo, this.patientLabOrder}) : super(key: key);
{Key key,
this.onTap,
this.billNo,
this.details,
this.orderNo,
this.patientLabOrder})
: super(key: key);
@override @override
_LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState(); _LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState();
@ -45,79 +43,20 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => // onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder),
model.getPatientLabResult(patientLabOrder: widget.patientLabOrder),
builder: (_, model, w) => NetworkBaseView( builder: (_, model, w) => NetworkBaseView(
baseViewModel: model, 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts(TranslationBase.of(context).invoiceNo), DoctorHeader(
Texts(widget.billNo), patientLabOrder: widget.patientLabOrder,
], invoiceNo: widget.billNo,
), email: model.user.emailAddress,
), onTap: widget.onTap,
),
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,
), ),
if( model.labResultLists.isNotEmpty) SizedBox(height: 10),
if (model.labResultLists.isNotEmpty)
Container( Container(
child: Column( child: Column(
children: [ children: [
@ -130,27 +69,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
); );
}, },
child: Container( child: Container(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10),
margin: EdgeInsets.only(left: 5, right: 5), margin: EdgeInsets.only(left: 21, right: 21, top: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( 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( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).generalResult)), Expanded(child: Texts(TranslationBase.of(context).generalResult)),
Container( Container(
width: 25, width: 25,
height: 25, height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
shape: BoxShape.circle,
color: Theme.of(context).primaryColor),
child: Icon( child: Icon(
_isShowMoreGeneral _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.white, color: Colors.white,
size: 22, size: 22,
), ),
@ -175,18 +119,14 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
...List.generate( ...List.generate(
model.labResultLists.length, model.labResultLists.length,
(index) => LabResultWidget( (index) => LabResultWidget(
patientLabOrder: widget.patientLabOrder, patientLabOrder: widget.patientLabOrder,
filterName: model filterName: model.labResultLists[index].filterName,
.labResultLists[index].filterName, patientLabResultList: model.labResultLists[index].patientLabResultList,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
), ),
) )
], ],
@ -196,9 +136,6 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
], ],
), ),
), ),
SizedBox(
height: 10,
),
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
@ -206,26 +143,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
}); });
}, },
child: Container( child: Container(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10),
margin: EdgeInsets.only(left: 5, right: 5), margin: EdgeInsets.only(left: 21, right: 21, top: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( 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( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).specialResult)), Expanded(child: Texts(TranslationBase.of(context).specialResult)),
Container( Container(
width: 25, width: 25,
height: 25, height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Icon( child: Icon(
_isShowMore _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.white, color: Colors.white,
size: 22, size: 22,
), ),
@ -252,23 +195,8 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
data: widget.details ?? TranslationBase.of(context).noDataAvailable, 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( return RichText(
text: TextSpan( text: TextSpan(
text: title, 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