lab result detail screen.

merge-requests/390/head
Sikander Saleem 5 years ago
parent 3a1af590ff
commit bb20d65b40

@ -818,6 +818,7 @@ const Map localizedValues = {
"SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"},
"GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"}, "GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"},
"show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"},
"view_flow_chart": {"en": "View Flowchart", "ar": "النتائج التراكمية"},
"value": {"en": "Value", "ar": "القيمة"}, "value": {"en": "Value", "ar": "القيمة"},
"range": {"en": "Range", "ar": "المدى"}, "range": {"en": "Range", "ar": "المدى"},

@ -2,5 +2,5 @@ extension CapExtension on String {
String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}";
String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
String get allInCaps => this.toUpperCase(); String get allInCaps => this.toUpperCase();
String get capitalizeFirstofEach => this.split(" ").map((str) => str.inCaps).join(" "); String get capitalizeFirstofEach => this.length > 0 ? this.split(" ").map((str) => str.inCaps).join(" ") : "";
} }

@ -35,6 +35,7 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
backgroundColor: Color(0xffF8F8F8), backgroundColor: Color(0xffF8F8F8),
body: ListView.builder( body: ListView.builder(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(bottom: 12),
itemBuilder: (context, index) => LaboratoryResultWidget( itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: () async { onTap: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);

@ -57,7 +57,7 @@ class DateUtil {
} }
static String formatDateToTime(DateTime date) { static String formatDateToTime(DateTime date) {
return DateFormat('kk:mm a').format(date); return DateFormat('hh:mm a').format(date);
} }
static String yearMonthDay(DateTime dateTime) { static String yearMonthDay(DateTime dateTime) {

@ -1202,6 +1202,8 @@ class TranslationBase {
String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode];
String get viewFlowChart => localizedValues['view_flow_chart'][locale.languageCode];
String get value => localizedValues['value'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode];
String get range => localizedValues['range'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode];

@ -6,18 +6,16 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import '../../text.dart'; import '../../text.dart';
import 'FlowChartPage.dart'; import 'FlowChartPage.dart';
class LabResultWidget extends StatelessWidget { class LabResultWidget extends StatelessWidget {
final String filterName;
final String filterName ;
final List<LabResult> patientLabResultList; final List<LabResult> patientLabResultList;
final PatientLabOrders patientLabOrder; final PatientLabOrders patientLabOrder;
LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key); LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key);
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -28,11 +26,14 @@ class LabResultWidget extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(height: 8),
Row( Row(
mainAxisAlignment: // mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(filterName), Text(
filterName,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.56, height: 21 / 14),
),SizedBox(width: 16),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -40,135 +41,94 @@ class LabResultWidget extends StatelessWidget {
FadePage( FadePage(
page: FlowChartPage( page: FlowChartPage(
filterName: filterName, filterName: filterName,
patientLabOrder: patientLabOrder, patientLabOrder: patientLabOrder,
), ),
), ),
); );
}, },
child: Texts( child: Text(
TranslationBase.of(context).showMoreBtn, TranslationBase.of(context).viewFlowChart,
decoration: TextDecoration.underline, style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12),
color: Colors.blue,
), ),
), ),
], ],
), ),
Table( Table(
border: TableBorder.symmetric( columnWidths: {
inside: BorderSide( 0: FlexColumnWidth(2),
width: 2.0, color: Colors.grey[300]), 1: FlexColumnWidth(1.5),
), 2: FlexColumnWidth(1),
children: fullData(patientLabResultList,context), },
children: fullData(patientLabResultList, context),
), ),
], ],
), ),
); );
} }
List<TableRow> fullData(List<LabResult> labResultList,context) {
List<TableRow> fullData(List<LabResult> labResultList, context) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
children: [ children: [
Container( _tableColumnTitle(TranslationBase.of(context).description),
child: Container( _tableColumnTitle(TranslationBase.of(context).value),
decoration: BoxDecoration( _tableColumnTitle(TranslationBase.of(context).range),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
),
),
child: Center(
child: Texts(
TranslationBase.of(context).description,
color: Colors.white,
),
),
height: 60,
),
),
Container(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(TranslationBase.of(context).value, color: Colors.white),
),
height: 60),
),
Container(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
),
),
child: Center(
child: Texts(TranslationBase.of(context).range, color: Colors.white),
),
height: 60),
),
], ],
), ),
); );
labResultList.forEach((lab) {
for (int i = 0; i < labResultList.length; i++)
tableRow.add( tableRow.add(
TableRow( TableRow(
children: [ children: [
Container( _tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)),
child: Container( _tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)),
padding: EdgeInsets.all(10), _tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)),
color: Colors.white,
child: Center(
child: Texts(
lab.description,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.resultValue+" "+lab.uOM,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.referanceRange,
textAlign: TextAlign.center,
),
),
),
),
], ],
), ),
); );
});
return tableRow; return tableRow;
} }
} Widget _tableColumnTitle(String text) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 6),
Text(
text,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
),
SizedBox(height: 6),
Divider(
height: 1,
color: Color(0xff2E303A),
thickness: 1,
)
],
);
}
Widget _tableColumnValue(String text, {bool isLast = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 12),
Text(
text.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 12),
if (!isLast)
Divider(
height: 1,
color: Color(0xffEFEFEF),
thickness: 1,
)
],
);
}
}

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.d
import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.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:diplomaticquarterapp/widgets/transitions/fade_page.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';
@ -19,6 +20,7 @@ import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import '../../text.dart'; import '../../text.dart';
import 'FlowChartPage.dart';
import 'LabResultWidget.dart'; import 'LabResultWidget.dart';
class LaboratoryResultWidget extends StatefulWidget { class LaboratoryResultWidget extends StatefulWidget {
@ -43,7 +45,7 @@ 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) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder), onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder),
builder: (_, model, w) => NetworkBaseView( builder: (_, model, w) => NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Column( child: Column(
@ -69,7 +71,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
); );
}, },
child: Container( child: Container(
padding: EdgeInsets.only(left: 17, top: 14, right: 13, bottom: 10), padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12),
margin: EdgeInsets.only(left: 21, right: 21, top: 12), margin: EdgeInsets.only(left: 21, right: 21, top: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -86,41 +88,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
], ],
), ),
child: Row( child: Column(
children: <Widget>[ mainAxisSize: MainAxisSize.min,
Expanded(child: Texts(TranslationBase.of(context).generalResult)), children: [
Container( Row(
width: 25, mainAxisSize: MainAxisSize.min,
height: 25, crossAxisAlignment: CrossAxisAlignment.center,
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), children: <Widget>[
child: Icon( Expanded(
_isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, child: Row(
color: Colors.white, children: [
size: 22, Text(
), TranslationBase.of(context).generalResult,
) style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
], ),
), // todo 'sikander' discuss about chart flow chart
), ],
), ),
if (_isShowMoreGeneral) ),
AnimatedContainer( Icon(
padding: EdgeInsets.all(10.0), _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
margin: EdgeInsets.only(left: 5, right: 5), color: Color(0xff575757),
decoration: BoxDecoration( size: 22,
shape: BoxShape.rectangle, )
color: Colors.white, ],
borderRadius: BorderRadius.only( ),
bottomLeft: Radius.circular(5.0), if (_isShowMoreGeneral)
bottomRight: Radius.circular(5.0),
),
),
duration: Duration(milliseconds: 7000),
child: Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...List.generate( ...List.generate(
model.labResultLists.length, model.labResultLists.length,
(index) => LabResultWidget( (index) => LabResultWidget(
@ -129,10 +122,10 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
patientLabResultList: model.labResultLists[index].patientLabResultList, patientLabResultList: model.labResultLists[index].patientLabResultList,
), ),
) )
], ],
),
), ),
), ),
),
], ],
), ),
), ),
@ -160,41 +153,34 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
], ],
), ),
child: Row( child: Column(
children: <Widget>[ children: [
Expanded(child: Texts(TranslationBase.of(context).specialResult)), Row(
Container( children: <Widget>[
width: 25, Expanded(
height: 25, child: Text(
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), TranslationBase.of(context).specialResult,
child: Icon( style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, ),
color: Colors.white, ),
size: 22, Icon(
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Color(0xff575757),
size: 22,
)
],
),
if (_isShowMore)
Container(
width: double.infinity,
child: Html(
data: widget.details ?? TranslationBase.of(context).noDataAvailable,
),
), ),
)
], ],
), ),
), ),
), ),
if (_isShowMore)
AnimatedContainer(
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(5.0),
bottomRight: Radius.circular(5.0),
)),
duration: Duration(milliseconds: 7000),
child: Container(
width: double.infinity,
child: Html(
data: widget.details ?? TranslationBase.of(context).noDataAvailable,
)),
),
], ],
), ),
), ),

@ -58,9 +58,9 @@ class DoctorCard extends StatelessWidget {
//Colors.red[900] Color(0xff404545) //Colors.red[900] Color(0xff404545)
color: isLiveCareAppointment color: isLiveCareAppointment
? Color(0xff404545) ? Color(0xff404545)
: !isInOutPatient : (!isInOutPatient
? Colors.red[900] ? Colors.red[900]
: Theme.of(context).primaryColor, : Theme.of(context).primaryColor),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10),
bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10),
@ -73,9 +73,9 @@ class DoctorCard extends StatelessWidget {
child: Text( child: Text(
isLiveCareAppointment isLiveCareAppointment
? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach ? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach
: !isInOutPatient : (!isInOutPatient
? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach
: TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach),
style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
), ),
), ),

@ -64,7 +64,7 @@ class DoctorHeader extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Image.network(patientLabOrder.nationalityFlagURL, height: 16), child: Image.network(patientLabOrder?.nationalityFlagURL ?? "", height: 16),
), ),
], ],
) )

@ -86,7 +86,7 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
), ),
IconButton( IconButton(
icon: Icon( icon: Icon(
widget.expandFlag ? Icons.remove : Icons.add, widget.expandFlag ?Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Color(0xff2E303A), color: Color(0xff2E303A),
// size: 30.0, // size: 30.0,
), ),

Loading…
Cancel
Save