lab result detail flow chart screen & improvement.

merge-requests/390/head
Sikander Saleem 3 years ago
parent 6ee56cba0d
commit b3fd1cb93d

@ -945,6 +945,7 @@ const Map localizedValues = {
"insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, "insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"},
'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, 'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"},
'details': {'en': 'Details', 'ar': 'التفاصيل'}, 'details': {'en': 'Details', 'ar': 'التفاصيل'},
'graph-details': {'en': 'Graph Details', 'ar': 'التفاصيل الرسم البياني'},
"age": {"en": "Age", "ar": "العمر"}, "age": {"en": "Age", "ar": "العمر"},
"active-insurence": {"en": "Active", "ar": "نشطة"}, "active-insurence": {"en": "Active", "ar": "نشطة"},
"not-active": {"en": "Not Active", "ar": "غير نشط"}, "not-active": {"en": "Not Active", "ar": "غير نشط"},

@ -1416,6 +1416,8 @@ class TranslationBase {
String get details => localizedValues['details'][locale.languageCode]; String get details => localizedValues['details'][locale.languageCode];
String get graphDetails => localizedValues['graph-details'][locale.languageCode];
String get age => localizedValues['age'][locale.languageCode]; String get age => localizedValues['age'][locale.languageCode];
String get activeInsurence => localizedValues['active-insurence'][locale.languageCode]; String get activeInsurence => localizedValues['active-insurence'][locale.languageCode];

@ -20,7 +20,7 @@ import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'
import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart';
import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart';
import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
@ -813,6 +813,48 @@ class Utils {
); );
}); });
} }
static 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,
)
],
);
}
static 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,
)
],
);
}
} }
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) {

@ -1,10 +1,14 @@
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; 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/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'LineChartCurved.dart';
import 'lab_result_chart_and_detials.dart'; import 'lab_result_chart_and_detials.dart';
class FlowChartPage extends StatelessWidget { class FlowChartPage extends StatelessWidget {
@ -16,28 +20,58 @@ class FlowChartPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabOrdersResults( onModelReady: (model) => model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName),
patientLabOrder: patientLabOrder, procedure: filterName),
builder: (context, model, w) => AppScaffold( builder: (context, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: filterName, appBarTitle: filterName,
baseViewModel: model, baseViewModel: model,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
body: SingleChildScrollView( body: SingleChildScrollView(
child: model. labOrdersResultsList.isNotEmpty child: model.labOrdersResultsList.isNotEmpty
? Container( ? Column(
child: LabResultChartAndDetails( crossAxisAlignment: CrossAxisAlignment.start,
name: filterName, mainAxisSize: MainAxisSize.min,
labResult: model.labOrdersResultsList, children: [
), Container(
width: double.infinity,
padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12),
margin: EdgeInsets.only(left: 21, right: 21, top: 21),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: LineChartCurved(
title: filterName,
labResult: model.labOrdersResultsList,
),
),
LabResultChartAndDetails(
name: filterName,
labResult: model.labOrdersResultsList,
),
],
) )
: Center( : Center(
child: Container( child: Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).size.height *0.42), padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.42),
child: Center( child: Center(
child: Texts('No Data'), child: Texts('No Data'),
), ),
), ),
), ),
), ),
), ),
); );

@ -2,11 +2,12 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.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: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';
@ -28,12 +29,13 @@ class LabResultWidget extends StatelessWidget {
children: <Widget>[ children: <Widget>[
SizedBox(height: 8), SizedBox(height: 8),
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
filterName, filterName,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.56, height: 21 / 14), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.56, height: 21 / 14),
),SizedBox(width: 16), ),
SizedBox(width: 16),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -71,9 +73,9 @@ class LabResultWidget extends StatelessWidget {
tableRow.add( tableRow.add(
TableRow( TableRow(
children: [ children: [
_tableColumnTitle(TranslationBase.of(context).description), Utils.tableColumnTitle(TranslationBase.of(context).description),
_tableColumnTitle(TranslationBase.of(context).value), Utils.tableColumnTitle(TranslationBase.of(context).value),
_tableColumnTitle(TranslationBase.of(context).range), Utils.tableColumnTitle(TranslationBase.of(context).range),
], ],
), ),
); );
@ -82,53 +84,12 @@ class LabResultWidget extends StatelessWidget {
tableRow.add( tableRow.add(
TableRow( TableRow(
children: [ children: [
_tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)), Utils.tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)),
_tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)),
_tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)),
], ],
), ),
); );
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,
)
],
);
}
} }

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.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/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -24,96 +25,35 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Container( return Table(
decoration: BoxDecoration( columnWidths: {
color: Colors.transparent, 0: FlexColumnWidth(2),
borderRadius: BorderRadius.only( 1: FlexColumnWidth(1),
topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), },
border: Border.all(color: Colors.grey, width: 1), children: fullData(widget.labResult, context),
),
margin: EdgeInsets.all(20),
child: Container(
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(projectViewModel),
),
],
),
),
); );
} }
List<TableRow> fullData(ProjectViewModel projectViewModel) { List<TableRow> fullData(List<LabOrderResult> labOrderResultList, context) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add(TableRow(children: [ tableRow.add(
Container( TableRow(
child: Container( children: [
decoration: BoxDecoration( Utils.tableColumnTitle(TranslationBase.of(context).date),
color: Theme.of(context).primaryColor, Utils.tableColumnTitle(TranslationBase.of(context).labResults),
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).date,
color: Colors.white,
),
),
height: 60,
),
), ),
Container( );
child: Container(
decoration: BoxDecoration( for (int i = 0; i < labOrderResultList.length; i++)
color: Theme.of(context).primaryColor, tableRow.add(
borderRadius: BorderRadius.only( TableRow(
topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), children: [
topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), Utils.tableColumnValue(DateUtil.formatDateToDate(DateUtil.convertStringToDate(labOrderResultList[i].verifiedOnDateTime)), isLast: i == (labOrderResultList.length - 1)),
), Utils.tableColumnValue(labOrderResultList[i].resultValue, isLast: i == (labOrderResultList.length - 1)),
), ],
child: Center(
child: Texts(TranslationBase.of(context).labResult, color: Colors.white),
),
height: 60),
)
]));
widget.labResult.forEach((vital) {
var date =DateUtil.convertStringToDate(vital.verifiedOnDateTime);
tableRow.add(TableRow(children: [
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
'${projectViewModel.isArabic? DateUtil.getWeekDayArabic(date.weekday): DateUtil.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic? DateUtil.getMonthArabic(date.month) : DateUtil.getMonth(date.month)} ${date.year}',
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
'${vital.resultValue}',
textAlign: TextAlign.center,
),
),
),
), ),
])); );
});
return tableRow; return tableRow;
} }
} }

@ -38,46 +38,34 @@ class LineChartCurvedState extends State<LineChartCurved> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AspectRatio( return Container(
aspectRatio: 1.23, decoration: const BoxDecoration(
child: Container( borderRadius: BorderRadius.all(Radius.circular(18)),
decoration: const BoxDecoration( // color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(18)), ),
// color: Colors.white, child: Stack(
), children: <Widget>[
child: Stack( Column(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
Column( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.stretch, Text(
children: <Widget>[ widget.title,
const SizedBox( style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
height: 4, ),
), SizedBox(height: 16),
Text( AspectRatio(
widget.title, aspectRatio: 333 / 288,
style: TextStyle( child: Padding(
color: Colors.black, padding: EdgeInsets.only(right: 16.0, left: 6.0),
fontSize: 32, child: LineChart(
fontWeight: FontWeight.bold, sampleData1(),
letterSpacing: 2), swapAnimationDuration: const Duration(milliseconds: 250),
textAlign: TextAlign.center,
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 16.0, left: 6.0),
child: LineChart(
sampleData1(),
swapAnimationDuration: const Duration(milliseconds: 250),
),
), ),
), ),
const SizedBox( ),
height: 10, ],
), ),
], ],
),
],
),
), ),
); );
} }
@ -91,17 +79,13 @@ class LineChartCurvedState extends State<LineChartCurved> {
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(show: true, drawVerticalLine: false, drawHorizontalLine: true),
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (value) => const TextStyle( getTextStyles: (value) => TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
color: Colors.black, margin: 8,
fontSize: 12, rotateAngle: -0,
),
margin: 22,
rotateAngle:-65,
getTitles: (value) { getTitles: (value) {
print(value); print(value);
DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime); DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime);
@ -111,27 +95,20 @@ class LineChartCurvedState extends State<LineChartCurved> {
} else } else
return ''; return '';
} else { } else {
if (value.toInt() == 0) if (value.toInt() == 0) return '${date.day}/ ${date.year}';
return '${date.day}/ ${date.year}'; if (value.toInt() == widget.labResult.length - 1) return '${date.day}/ ${date.year}';
if (value.toInt() == widget.labResult.length - 1)
return '${date.day}/ ${date.year}';
if (xAxixs.contains(value.toInt())) { if (xAxixs.contains(value.toInt())) {
return '${date.day}/ ${date.year}'; return '${date.day}/ ${date.year}';
} }
} }
return ''; return '';
}, },
), ),
leftTitles: SideTitles( leftTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (value) => const TextStyle( getTextStyles: (value) => TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,
),
getTitles: (value) { getTitles: (value) {
return '${value.toInt()}'; return '${value.toInt()}';
}, },
@ -140,22 +117,22 @@ class LineChartCurvedState extends State<LineChartCurved> {
), ),
), ),
borderData: FlBorderData( borderData: FlBorderData(
show: true, show: false,
border: const Border( // border: const Border(
bottom: BorderSide( // bottom: BorderSide(
color: Colors.black, // color: Colors.black,
width: 0.5, // width: 0.5,
), // ),
left: BorderSide( // // left: BorderSide(
color: Colors.black, // // color: Colors.black,
), // // ),
right: BorderSide( // // right: BorderSide(
color: Colors.black, // // color: Colors.black,
), // // ),
top: BorderSide( // top: BorderSide(
color: Colors.transparent, // color: Colors.transparent,
), // ),
), // ),
), ),
minX: 0, minX: 0,
maxX: (widget.labResult.length - 1).toDouble(), maxX: (widget.labResult.length - 1).toDouble(),
@ -168,10 +145,10 @@ class LineChartCurvedState extends State<LineChartCurved> {
double getMaxY() { double getMaxY() {
double max = 0; double max = 0;
widget.labResult.forEach((element) { widget.labResult.forEach((element) {
try{ try {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble > max) max = resultValueDouble;} if (resultValueDouble > max) max = resultValueDouble;
catch(e){ } catch (e) {
print(e); print(e);
} }
}); });
@ -181,13 +158,14 @@ class LineChartCurvedState extends State<LineChartCurved> {
double getMinY() { double getMinY() {
double min = 0; double min = 0;
try{ try {
min = double.parse(widget.labResult[0].resultValue); min = double.parse(widget.labResult[0].resultValue);
widget.labResult.forEach((element) { widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble < min) min = resultValueDouble; if (resultValueDouble < min) min = resultValueDouble;
});}catch(e){ });
} catch (e) {
print(e); print(e);
} }
int value = min.toInt(); int value = min.toInt();
@ -198,21 +176,22 @@ class LineChartCurvedState extends State<LineChartCurved> {
List<LineChartBarData> getData() { List<LineChartBarData> getData() {
List<FlSpot> spots = List(); List<FlSpot> spots = List();
for (int index = 0; index < widget.labResult.length; index++) { for (int index = 0; index < widget.labResult.length; index++) {
try{ try {
var resultValueDouble = double.parse(widget.labResult[index].resultValue); var resultValueDouble = double.parse(widget.labResult[index].resultValue);
spots.add(FlSpot(index.toDouble(), resultValueDouble)); print("$index:$resultValueDouble");
}catch(e){ spots.add(FlSpot(index.toDouble(), resultValueDouble));
} catch (e) {
print(e); print(e);
spots.add(FlSpot(index.toDouble(), 0.0)); spots.add(FlSpot(index.toDouble(), 0.0));
} }
} }
final LineChartBarData lineChartBarData1 = LineChartBarData( final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [Theme.of(context).primaryColor], //preventCurveOverShooting : true,
barWidth: 5, colors: [Color(0xffD02127)],
barWidth: 1.5,
isStrokeCapRound: true, isStrokeCapRound: true,
dotData: FlDotData( dotData: FlDotData(
show: false, show: false,

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart';
import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -20,23 +21,98 @@ class LabResultChartAndDetails extends StatelessWidget {
final List<LabOrderResult> labResult; final List<LabOrderResult> labResult;
final String name; final String name;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Container(
children: <Widget>[ padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12),
AppExpandableNotifier( margin: EdgeInsets.only(left: 21, right: 21, top: 12),
headerWidget: Padding( decoration: BoxDecoration(
padding: const EdgeInsets.all(8.0), shape: BoxShape.rectangle,
child: LineChartCurved(title: name,labResult:labResult,), color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
), ),
bodyWidget: LabResultDetailsWidget( ],
labResult: labResult.reversed.toList(), ),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context).graphDetails,
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
),
],
), ),
isExpand: true, SizedBox(height: 8),
), LabResultDetailsWidget(
], labResult: labResult.reversed.toList(),
)
],
),
); );
// todo old was expandable, but new is not expandable
// Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Row(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Expanded(
// child: Text(
// TranslationBase.of(context).generalResult,
// style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
// ),
// ),
// ],
// ),
// LabResultDetailsWidget(
// labResult: labResult.reversed.toList(),
// ),
// AppExpandableNotifier(
// // headerWidget: Container(
// // padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12),
// // margin: EdgeInsets.only(left: 21, right: 21, top: 21),
// // decoration: BoxDecoration(
// // shape: BoxShape.rectangle,
// // color: Colors.white,
// // borderRadius: BorderRadius.all(
// // Radius.circular(10.0),
// // ),
// // boxShadow: [
// // BoxShadow(
// // color: Color(0xff000000).withOpacity(.05),
// // //spreadRadius: 5,
// // blurRadius: 27,
// // offset: Offset(0, -3),
// // ),
// // ],
// // ),
// // child: LineChartCurved(
// // title: name,
// // labResult: labResult
// // ),
// // ),
// title: TranslationBase.of(context).delete,
// bodyWidget: LabResultDetailsWidget(
// labResult: labResult.reversed.toList(),
// ),
// isExpand: true,
// ),
// ],
// );
} }
} }

@ -53,7 +53,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
DoctorHeader( DoctorHeader(
headerModel: new HeaderModel( headerModel: HeaderModel(
widget.patientLabOrder.doctorName, widget.patientLabOrder.doctorName,
widget.patientLabOrder.doctorImageURL, widget.patientLabOrder.doctorImageURL,
widget.patientLabOrder.speciality, widget.patientLabOrder.speciality,
@ -105,14 +105,9 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Row( child: Text(
children: [ TranslationBase.of(context).generalResult,
Text( style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
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( Icon(

@ -20,6 +20,8 @@ class DoctorHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String _speciality = (headerModel?.speciality ?? []).length > 0 ? headerModel.speciality.first : "";
return Container( return Container(
color: Colors.white, color: Colors.white,
child: Column( child: Column(
@ -44,7 +46,7 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
(headerModel?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""), _speciality,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
), ),
myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo), myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo),
@ -64,10 +66,10 @@ class DoctorHeader extends StatelessWidget {
DateUtil.formatDateToTime(headerModel.orderDate), DateUtil.formatDateToTime(headerModel.orderDate),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
Padding( // Padding(
padding: const EdgeInsets.only(top: 8.0), // padding: const EdgeInsets.only(top: 8.0),
child: Image.network(headerModel.nationalityFlagURL ?? "", height: 16), // child: Image.network(headerModel.nationalityFlagURL ?? "", height: 16),
), // ),
], ],
) )
], ],
@ -109,7 +111,6 @@ class DoctorHeader extends StatelessWidget {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
// todo: 'change icon for send email'
SvgPicture.asset('assets/images/new/email.svg', width: 19.0), SvgPicture.asset('assets/images/new/email.svg', width: 19.0),
SizedBox(width: 6), SizedBox(width: 6),
Text( Text(

@ -65,38 +65,42 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
), ),
header: Padding( header: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12, left: 21, right: 21), padding: const EdgeInsets.only(top: 12, bottom: 12, left: 21, right: 21),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ child: InkWell(
Expanded( onTap: (){
child: Column( setState(() {
mainAxisSize: MainAxisSize.min, widget.expandFlag = !widget.expandFlag;
crossAxisAlignment: CrossAxisAlignment.start, widget.controller.expanded = widget.expandFlag;
children: [ });
if (_title.isNotEmpty) },
Text( child: Row(
_title, mainAxisAlignment: MainAxisAlignment.spaceBetween,
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 23 / 12), children: [
), Expanded(
Text( child: Column(
_subTitle, mainAxisSize: MainAxisSize.min,
maxLines: 1, crossAxisAlignment: CrossAxisAlignment.start,
style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2E303A), letterSpacing: -1.44, height: 25 / 24), children: [
if (_title.isNotEmpty)
Text(
_title,
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 23 / 12),
),
Text(
_subTitle,
maxLines: 1,
style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2E303A), letterSpacing: -1.44, height: 25 / 24),
),
],
), ),
], ),
), Icon(
), widget.expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
IconButton(
icon: Icon(
widget.expandFlag ?Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Color(0xff2E303A), color: Color(0xff2E303A),
// size: 30.0, // size: 30.0,
), ),
onPressed: () { ],
setState(() { ),
widget.expandFlag = !widget.expandFlag; ),
widget.controller.expanded = widget.expandFlag;
});
}),
]),
), ),
collapsed: widget.collapsed ?? Container(), collapsed: widget.collapsed ?? Container(),
expanded: widget.bodyWidget, expanded: widget.bodyWidget,

Loading…
Cancel
Save