lab result detail screen.

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

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

@ -2,5 +2,5 @@ extension CapExtension on String {
String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}";
String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
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),
body: ListView.builder(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(bottom: 12),
itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);

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

@ -1202,6 +1202,8 @@ class TranslationBase {
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 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/material.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import '../../text.dart';
import 'FlowChartPage.dart';
class LabResultWidget extends StatelessWidget {
final String filterName ;
final String filterName;
final List<LabResult> patientLabResultList;
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;
@override
Widget build(BuildContext context) {
@ -28,11 +26,14 @@ class LabResultWidget extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 8),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
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(
onTap: () {
Navigator.push(
@ -40,135 +41,94 @@ class LabResultWidget extends StatelessWidget {
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
patientLabOrder: patientLabOrder,
),
),
);
},
child: Texts(
TranslationBase.of(context).showMoreBtn,
decoration: TextDecoration.underline,
color: Colors.blue,
child: Text(
TranslationBase.of(context).viewFlowChart,
style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12),
),
),
],
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(
width: 2.0, color: Colors.grey[300]),
),
children: fullData(patientLabResultList,context),
columnWidths: {
0: FlexColumnWidth(2),
1: FlexColumnWidth(1.5),
2: FlexColumnWidth(1),
},
children: fullData(patientLabResultList, context),
),
],
),
);
}
List<TableRow> fullData(List<LabResult> labResultList,context) {
List<TableRow> fullData(List<LabResult> labResultList, context) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Container(
child: Container(
decoration: BoxDecoration(
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),
),
_tableColumnTitle(TranslationBase.of(context).description),
_tableColumnTitle(TranslationBase.of(context).value),
_tableColumnTitle(TranslationBase.of(context).range),
],
),
);
labResultList.forEach((lab) {
for (int i = 0; i < labResultList.length; i++)
tableRow.add(
TableRow(
children: [
Container(
child: Container(
padding: EdgeInsets.all(10),
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,
),
),
),
),
_tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)),
_tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)),
_tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)),
],
),
);
});
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/widgets/new_design/doctor_header.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/material.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 '../../text.dart';
import 'FlowChartPage.dart';
import 'LabResultWidget.dart';
class LaboratoryResultWidget extends StatefulWidget {
@ -43,7 +45,7 @@ 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: Column(
@ -69,7 +71,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
);
},
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),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
@ -86,41 +88,32 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
),
],
),
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),
child: Icon(
_isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.white,
size: 22,
),
)
],
),
),
),
if (_isShowMoreGeneral)
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: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Row(
children: [
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
],
),
),
Icon(
_isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Color(0xff575757),
size: 22,
)
],
),
if (_isShowMoreGeneral)
...List.generate(
model.labResultLists.length,
(index) => LabResultWidget(
@ -129,10 +122,10 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
patientLabResultList: model.labResultLists[index].patientLabResultList,
),
)
],
),
],
),
),
),
],
),
),
@ -160,41 +153,34 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
),
],
),
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),
child: Icon(
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.white,
size: 22,
child: Column(
children: [
Row(
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context).specialResult,
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
),
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)
color: isLiveCareAppointment
? Color(0xff404545)
: !isInOutPatient
: (!isInOutPatient
? Colors.red[900]
: Theme.of(context).primaryColor,
: Theme.of(context).primaryColor),
borderRadius: BorderRadius.only(
topLeft: 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(
isLiveCareAppointment
? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach
: !isInOutPatient
: (!isInOutPatient
? 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),
),
),

@ -64,7 +64,7 @@ class DoctorHeader extends StatelessWidget {
),
Padding(
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(
icon: Icon(
widget.expandFlag ? Icons.remove : Icons.add,
widget.expandFlag ?Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Color(0xff2E303A),
// size: 30.0,
),

Loading…
Cancel
Save