code updated.

merge-update-with-lab-changes
Sultan khan 2 years ago
parent b45cbbcf29
commit 8bf5479f56

@ -1,5 +1,5 @@
import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter_charts/flutter_charts.dart' as charts;
import 'package:charts_flutter/flutter.dart'; // import 'package:charts_flutter/flutter.dart';
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/widgets/data_display/list/flexible_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/list/flexible_container.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -10,10 +10,10 @@ import 'package:flutter/material.dart';
/// [chartName] the name of the chart /// [chartName] the name of the chart
/// [startDate] the start date /// [startDate] the start date
/// [endDate] the end date /// [endDate] the end date
class AppTimeSeriesChart extends StatelessWidget { class AppTimeSeriesChar,b m extends StatelessWidget {
AppTimeSeriesChart({ AppTimeSeriesChart({
Key key, Key? key,
@required this.seriesList, required this.seriesList,
this.chartName = '', this.chartName = '',
this.startDate, this.startDate,
this.endDate, this.endDate,
@ -21,8 +21,8 @@ class AppTimeSeriesChart extends StatelessWidget {
final String chartName; final String chartName;
final List<Series<dynamic, DateTime>> seriesList; final List<Series<dynamic, DateTime>> seriesList;
final DateTime startDate; final DateTime? startDate;sz
final DateTime endDate; final DateTime? endDate;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +35,7 @@ class AppTimeSeriesChart extends StatelessWidget {
height: SizeConfig.realScreenHeight * 0.37, height: SizeConfig.realScreenHeight * 0.37,
child: Center( child: Center(
child: Container( child: Container(
child: charts.TimeSeriesChart( child: charts.LineChart(
seriesList, seriesList,
animate: true, animate: true,
behaviors: [ behaviors: [

@ -6,16 +6,16 @@ import 'package:flutter/material.dart';
import '../../Constants.dart'; import '../../Constants.dart';
class ShowChart extends StatelessWidget { class ShowChart extends StatelessWidget {
final String title; final String? title;
final List<TimeSeriesSales2> timeSeries; final List<TimeSeriesSales2>? timeSeries;
final int indexes; final int? indexes;
final double horizontalInterval; final double horizontalInterval;
final bool isWeeklyOrMonthly; final bool isWeeklyOrMonthly;
ShowChart({this.title, this.timeSeries, this.indexes, this.horizontalInterval = 8.0, this.isWeeklyOrMonthly = false}); ShowChart({this.title, this.timeSeries, this.indexes, this.horizontalInterval = 8.0, this.isWeeklyOrMonthly = false});
List<int> xAxixs = List(); List<int> xAxixs = [];
List<double> yAxixs = List(); List<double> yAxixs = [];
double minY = 0; double minY = 0;
double maxY = 0; double maxY = 0;
@ -50,7 +50,7 @@ class ShowChart extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
title, title!,
style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600), style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -79,19 +79,19 @@ class ShowChart extends StatelessWidget {
} }
getXaxix() { getXaxix() {
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
int mIndex = indexes * index; int mIndex = indexes! * index!;
if (mIndex < timeSeries.length) { if (mIndex < timeSeries!.length) {
xAxixs.add(mIndex); xAxixs.add(mIndex);
} }
} }
} }
getYaxix() { getYaxix() {
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
int mIndex = indexes * index; int mIndex = indexes! * index!;
if (mIndex < timeSeries.length) { if (mIndex < timeSeries!.length) {
yAxixs.add(timeSeries[mIndex].sales); yAxixs.add(timeSeries![mIndex].sales);
} }
} }
} }
@ -102,7 +102,7 @@ class ShowChart extends StatelessWidget {
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white, tooltipBgColor: Colors.white,
), ),
touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, touchCallback: (touchEvent, LineTouchResponse? touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
@ -117,18 +117,18 @@ class ShowChart extends StatelessWidget {
margin: 22, margin: 22,
getTitles: (value) { getTitles: (value) {
if (isWeeklyOrMonthly) { if (isWeeklyOrMonthly) {
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.month}'; return '${timeSeries![value.toInt()].time.day}/ ${timeSeries![value.toInt()].time.month}';
} else { } else {
if (timeSeries.length < 15) { if (timeSeries!.length < 15) {
if (timeSeries.length > value.toInt()) { if (timeSeries!.length > value.toInt()) {
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; return '${timeSeries![value.toInt()].time.month}/ ${timeSeries![value.toInt()].time.year}';
} else } else
return ''; return '';
} else { } else {
if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; if (value.toInt() == 0) return '${timeSeries![value.toInt()].time.month}/ ${timeSeries![value.toInt()].time.year}';
if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; if (value.toInt() == timeSeries!.length - 1) return '${timeSeries![value.toInt()].time.month}/ ${timeSeries![value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) { if (xAxixs.contains(value.toInt())) {
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; return '${timeSeries![value.toInt()].time.month}/ ${timeSeries![value.toInt()].time.year}';
} }
} }
return ''; return '';
@ -184,7 +184,7 @@ class ShowChart extends StatelessWidget {
getMin(); getMin();
getMinY(); getMinY();
try { try {
increasingY = ((maxY - minY) / timeSeries.length - 1) * 15; increasingY = ((maxY - minY) / timeSeries!.length - 1) * 15;
maxY += increasingY.abs(); maxY += increasingY.abs();
minY -= increasingY.abs(); minY -= increasingY.abs();
} catch(ex) { } catch(ex) {
@ -199,7 +199,7 @@ class ShowChart extends StatelessWidget {
double getMaxY() { double getMaxY() {
maxY = 0; maxY = 0;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales;
if (resultValueDouble > maxY) { if (resultValueDouble > maxY) {
lastY = resultValueDouble; lastY = resultValueDouble;
@ -212,8 +212,8 @@ class ShowChart extends StatelessWidget {
double getInitialY() { double getInitialY() {
try { try {
intialY = timeSeries.first.sales; intialY = timeSeries!.first.sales;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales;
if (resultValueDouble < intialY) intialY = resultValueDouble; if (resultValueDouble < intialY) intialY = resultValueDouble;
}); });
@ -226,12 +226,12 @@ class ShowChart extends StatelessWidget {
} }
getMaxX() { getMaxX() {
maxX = (timeSeries.length - 1).toDouble(); maxX = (timeSeries!.length - 1).toDouble();
} }
double getMin() { double getMin() {
minX = 0; minX = 0;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales;
if (resultValueDouble < minX) minX = resultValueDouble; if (resultValueDouble < minX) minX = resultValueDouble;
}); });
@ -241,7 +241,7 @@ class ShowChart extends StatelessWidget {
double getMinY() { double getMinY() {
minY = 0; minY = 0;
timeSeries.forEach((element) { timeSeries!.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales;
if (resultValueDouble < minY) minY = resultValueDouble; if (resultValueDouble < minY) minY = resultValueDouble;
}); });
@ -251,15 +251,15 @@ class ShowChart extends StatelessWidget {
} }
List<LineChartBarData> getData(context) { List<LineChartBarData> getData(context) {
List<FlSpot> spots = List(); List<FlSpot> spots =[];
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries!.length; index++) {
spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); spots.add(FlSpot(index.toDouble(), timeSeries![index].sales));
} }
final LineChartBarData lineChartBarData1 = LineChartBarData( final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [secondaryColor], colors: [secondaryColor!],
barWidth: 1.5, barWidth: 1.5,
isStrokeCapRound: true, isStrokeCapRound: true,
dotData: FlDotData( dotData: FlDotData(

@ -11,7 +11,7 @@ class CardRoundedWidget extends StatelessWidget {
final double radius; final double radius;
CardRoundedWidget( CardRoundedWidget(
{@required this.child, {required this.child,
this.color = Colors.white, this.color = Colors.white,
this.radius = 10.0, this.radius = 10.0,
this.padding = 10.0}); this.padding = 10.0});

@ -13,22 +13,22 @@ import 'package:flutter/material.dart';
/// [child] child of the widget /// [child] child of the widget
/// [decoration] decoration of the widget /// [decoration] decoration of the widget
class CustomItem extends StatelessWidget { class CustomItem extends StatelessWidget {
final IconData startIcon; final IconData? startIcon;
final double startIconSize; final double startIconSize;
final Color startIconColor; final Color? startIconColor;
final IconData endIcon; final IconData endIcon;
final double endIconSize; final double endIconSize;
final Color endIconColor; final Color? endIconColor;
final bool disabled; final bool disabled;
final Function onTap; final Function? onTap;
final EdgeInsets padding; final EdgeInsets? padding;
final Widget child; final Widget? child;
final BoxDecoration decoration; final BoxDecoration? decoration;
CustomItem( CustomItem(
{Key key, {Key? key,
this.startIcon, this.startIcon,
this.disabled: false, this.disabled= false,
this.onTap, this.onTap,
this.startIconColor, this.startIconColor,
this.endIcon = Icons.chevron_right_sharp, this.endIcon = Icons.chevron_right_sharp,
@ -48,11 +48,11 @@ class CustomItem extends StatelessWidget {
decoration: decoration != null ? decoration : BoxDecoration(), decoration: decoration != null ? decoration : BoxDecoration(),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (onTap != null) onTap(); if (onTap != null) onTap!();
}, },
child: Padding( child: Padding(
padding: padding != null padding: padding! != null
? padding ? padding!
: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), : const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -67,7 +67,7 @@ class CustomItem extends StatelessWidget {
), ),
if (startIcon != null) SizedBox(width: 18.0), if (startIcon != null) SizedBox(width: 18.0),
Expanded( Expanded(
child: child, child: child!,
flex: 10, flex: 10,
), ),
endIcon == null endIcon == null

@ -14,11 +14,11 @@ import 'package:flutter/material.dart';
class FlexibleContainer extends StatelessWidget { class FlexibleContainer extends StatelessWidget {
final double widthFactor; final double widthFactor;
final double heightFactor; final double heightFactor;
final EdgeInsets padding; final EdgeInsets? padding;
final Widget child; final Widget? child;
FlexibleContainer({ FlexibleContainer({
Key key, Key? key,
this.widthFactor = 0.9, this.widthFactor = 0.9,
this.heightFactor = 1, this.heightFactor = 1,
this.padding, this.padding,

@ -13,18 +13,18 @@ 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 {
final PatientLabOrders patientLabOrder; final PatientLabOrders? patientLabOrder;
final String filterName; final String? filterName;
FlowChartPage({this.patientLabOrder, this.filterName}); FlowChartPage({this.patientLabOrder, this.filterName});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName), onModelReady: (model) => model.getPatientLabOrdersResults(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, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
@ -59,13 +59,13 @@ class FlowChartPage extends StatelessWidget {
// labResult: model.labOrdersResultsList, // labResult: model.labOrdersResultsList,
// ), // ),
child: ShowChart( child: ShowChart(
title: filterName, title: filterName!,
timeSeries: model.timeSeries, timeSeries: model.timeSeries,
indexes: model.timeSeries.length ~/ 5.5 ?? 0, indexes: model.timeSeries.length ~/ 5.5 ?? 0,
), ),
), ),
LabResultChartAndDetails( LabResultChartAndDetails(
name: filterName, name: filterName!,
labResult: model.labOrdersResultsList, labResult: model.labOrdersResultsList,
), ),
], ],

@ -19,14 +19,14 @@ import 'package:provider/provider.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;
LabResult covidLabResult; late LabResult covidLabResult;
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; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -42,7 +42,7 @@ class LabResultWidget extends StatelessWidget {
// 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),
@ -55,9 +55,9 @@ class LabResultWidget extends StatelessWidget {
2: FlexColumnWidth(1), 2: FlexColumnWidth(1),
3: FlexColumnWidth(1.7), 3: FlexColumnWidth(1.7),
}, },
children: fullData(patientLabResultList, context), children: fullData(patientLabResultList!, context),
), ),
checkIfCovidLab(patientLabResultList) checkIfCovidLab(patientLabResultList!)
? Container( ? Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: ButtonTheme( child: ButtonTheme(
@ -68,8 +68,8 @@ class LabResultWidget extends StatelessWidget {
height: 45.0, height: 45.0,
child: CustomTextButton( child: CustomTextButton(
backgroundColor: Color(0xFFc5272d), backgroundColor: Color(0xFFc5272d),
disabledForegroundColor: Colors.red[300].withOpacity(0.38), disabledForegroundColor: Colors.red[300]!.withOpacity(0.38),
disabledBackgroundColor: Colors.red[300].withOpacity(0.12), disabledBackgroundColor: Colors.red[300]!.withOpacity(0.12),
elevation: 0, elevation: 0,
onPressed: () { onPressed: () {
showKSADialog(context); showKSADialog(context);
@ -179,7 +179,7 @@ class LabResultWidget extends StatelessWidget {
); );
tableRow.add( tableRow.add(
TableRow( TableRow(
decoration: containerColorRadiusBorderWidth(Colors.grey[100], 12, Colors.grey[300], 0.6), decoration: containerColorRadiusBorderWidth(Colors.grey[100]!, 12, Colors.grey[300]!, 0.6),
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 12, right: projectViewModel.isArabic ? 12 : 0), padding: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 12, right: projectViewModel.isArabic ? 12 : 0),
@ -187,7 +187,7 @@ class LabResultWidget extends StatelessWidget {
), ),
Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true, mProjectViewModel: projectViewModel), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false, mProjectViewModel: projectViewModel), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
!checkIfCovidLab(patientLabResultList) !checkIfCovidLab(patientLabResultList!)
? InkWell( ? InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -195,7 +195,7 @@ class LabResultWidget extends StatelessWidget {
FadePage( FadePage(
page: FlowChartPage( page: FlowChartPage(
filterName: labResultList[i].description, filterName: labResultList[i].description,
patientLabOrder: patientLabOrder, patientLabOrder: patientLabOrder!,
), ),
), ),
); );

@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class LabResultDetailsWidget extends StatefulWidget { class LabResultDetailsWidget extends StatefulWidget {
final List<LabOrderResult> labResult; final List<LabOrderResult>? labResult;
LabResultDetailsWidget({ LabResultDetailsWidget({
this.labResult, this.labResult,
@ -27,7 +27,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
0: FlexColumnWidth(2), 0: FlexColumnWidth(2),
1: FlexColumnWidth(1), 1: FlexColumnWidth(1),
}, },
children: fullData(widget.labResult, context), children: fullData(widget.labResult!, context),
); );
} }

@ -76,7 +76,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white, tooltipBgColor: Colors.white,
), ),
touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, touchCallback: (touchEvent, LineTouchResponse? touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData(show: true, drawVerticalLine: false, drawHorizontalLine: true), gridData: FlGridData(show: true, drawVerticalLine: false, drawHorizontalLine: true),
@ -88,15 +88,15 @@ class LineChartCurvedState extends State<LineChartCurved> {
rotateAngle: -0, rotateAngle: -0,
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);
if (widget.labResult.length < 8) { if (widget.labResult!.length < 8) {
if (widget.labResult.length > value.toInt()) { if (widget.labResult!.length > value.toInt()) {
return '${date.day}/ ${date.year}'; return '${date.day}/ ${date.year}';
} else } else
return ''; return '';
} else { } else {
if (value.toInt() == 0) return '${date.day}/ ${date.year}'; if (value.toInt() == 0) 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}';
} }
@ -136,7 +136,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
// ), // ),
), ),
minX: 0, minX: 0,
maxX: (widget.labResult.length - 1).toDouble(), maxX: (widget.labResult!.length - 1).toDouble(),
maxY: getMaxY(), maxY: getMaxY(),
minY: getMinY(), minY: getMinY(),
lineBarsData: getData(), lineBarsData: getData(),
@ -153,7 +153,7 @@ 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;
@ -168,9 +168,9 @@ 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;
}); });
@ -183,10 +183,10 @@ class LineChartCurvedState extends State<LineChartCurved> {
} }
List<LineChartBarData> getData() { List<LineChartBarData> getData() {
List<FlSpot> spots = List(); List<FlSpot> spots =[];
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);
print("$index:$resultValueDouble"); print("$index:$resultValueDouble");
spots.add(FlSpot(index.toDouble(), resultValueDouble)); spots.add(FlSpot(index.toDouble(), resultValueDouble));
} catch (e) { } catch (e) {

@ -6,9 +6,9 @@ import 'Lab_Result_details_wideget.dart';
class LabResultChartAndDetails extends StatelessWidget { class LabResultChartAndDetails extends StatelessWidget {
LabResultChartAndDetails({ LabResultChartAndDetails({
Key key, Key? key,
@required this.labResult, required this.labResult,
@required this.name, required this.name,
}) : super(key: key); }) : super(key: key);
final List<LabOrderResult> labResult; final List<LabOrderResult> labResult;

@ -15,13 +15,13 @@ import 'package:provider/provider.dart';
import 'LabResultWidget.dart'; import 'LabResultWidget.dart';
class LaboratoryResultWidget extends StatefulWidget { class LaboratoryResultWidget extends StatefulWidget {
final GestureTapCallback onTap; final GestureTapCallback? onTap;
final String billNo; final String? billNo;
final String details; final String? details;
final String orderNo; final String? orderNo;
final PatientLabOrders patientLabOrder; 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 @override
_LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState(); _LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState();
@ -30,13 +30,13 @@ class LaboratoryResultWidget extends StatefulWidget {
class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> { class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
bool _isShowMore = true; bool _isShowMore = true;
bool _isShowMoreGeneral = true; bool _isShowMoreGeneral = true;
ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
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(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, num.parse(widget.patientLabOrder.projectID)), patientLabOrder: widget.patientLabOrder), onModelReady: (model) => model.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID)), patientLabOrder: widget.patientLabOrder!),
builder: (_, model, w) => NetworkBaseView( builder: (_, model, w) => NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Column( child: Column(
@ -44,20 +44,20 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
children: <Widget>[ children: <Widget>[
DoctorHeader( DoctorHeader(
headerModel: HeaderModel( headerModel: HeaderModel(
widget.patientLabOrder.doctorName, widget.patientLabOrder!.doctorName,
widget.patientLabOrder.doctorID, widget.patientLabOrder!.doctorID,
widget.patientLabOrder.doctorImageURL, widget.patientLabOrder!.doctorImageURL,
widget.patientLabOrder.speciality, widget.patientLabOrder!.speciality,
widget.billNo, widget.billNo!,
widget.patientLabOrder.projectName, widget.patientLabOrder!.projectName,
widget.patientLabOrder.orderDate, widget.patientLabOrder!.orderDate,
null, "",
widget.patientLabOrder.nationalityFlagURL, widget.patientLabOrder!.nationalityFlagURL,
widget.patientLabOrder.doctorRate, widget.patientLabOrder!.doctorRate,
widget.patientLabOrder.actualDoctorRate, widget.patientLabOrder!.actualDoctorRate,
widget.patientLabOrder.noOfPatientsRate, widget.patientLabOrder!.noOfPatientsRate,
projectViewModel.user.emailAddress), projectViewModel.user.emailAddress),
onTap: widget.onTap, onTap: widget.onTap!,
), ),
SizedBox(height: 10), SizedBox(height: 10),
if (model.labResultLists.isNotEmpty) if (model.labResultLists.isNotEmpty)

@ -16,31 +16,31 @@ import 'package:provider/provider.dart';
class DoctorHeader extends StatelessWidget { class DoctorHeader extends StatelessWidget {
final HeaderModel headerModel; final HeaderModel headerModel;
final VoidCallback onTap; final VoidCallback? onTap;
final VoidCallback onRatingAndReviewTap; final VoidCallback? onRatingAndReviewTap;
final bool showConfirmMessageDialog; final bool showConfirmMessageDialog;
final String buttonTitle; final String? buttonTitle;
final String? buttonIcon; final String? buttonIcon;
final bool isNeedToShowButton; final bool isNeedToShowButton;
final bool isShowName; final bool isShowName;
DoctorHeader( DoctorHeader(
{Key? key, {Key? key,
required this.headerModel, required this.headerModel,
required this.buttonTitle, this.buttonTitle,
required this.onTap, this.onTap,
this.isNeedToShowButton = true, this.isNeedToShowButton = true,
this.isShowName = false, this.isShowName = false,
this.buttonIcon, this.buttonIcon,
this.showConfirmMessageDialog = true, this.showConfirmMessageDialog = true,
required this.onRatingAndReviewTap}) this.onRatingAndReviewTap})
: super(key: key); : super(key: key);
late ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String _speciality = (headerModel?.speciality ?? []).length > 0 ? headerModel.speciality.first : ""; String _speciality = (headerModel?.speciality ?? []).length > 0 ? headerModel!.speciality.first : "";
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
return Container( return Container(
color: Colors.white, color: Colors.white,
@ -52,7 +52,7 @@ class DoctorHeader extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.only(left: 21, right: 21, bottom: 12), padding: EdgeInsets.only(left: 21, right: 21, bottom: 12),
child: Text( child: Text(
headerModel.doctorName, headerModel!.doctorName!,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
@ -65,8 +65,8 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LargeAvatar( LargeAvatar(
name: headerModel.doctorName, name: headerModel!.doctorName,
url: headerModel.doctorImageURL, url: headerModel!.doctorImageURL,
width: 51, width: 51,
height: 51, height: 51,
), ),
@ -166,9 +166,9 @@ class DoctorHeader extends StatelessWidget {
? InkWell( ? InkWell(
onTap: () { onTap: () {
if (showConfirmMessageDialog) if (showConfirmMessageDialog)
showConfirmMessage(context, onTap, headerModel.email); showConfirmMessage(context, onTap!, headerModel.email);
else else
onTap(); onTap!();
}, },
child: Container( child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15),
@ -180,7 +180,7 @@ class DoctorHeader extends StatelessWidget {
SvgPicture.asset(buttonIcon ?? 'assets/images/new/email.svg', width: 19.0), SvgPicture.asset(buttonIcon ?? 'assets/images/new/email.svg', width: 19.0),
SizedBox(width: 6), SizedBox(width: 6),
Text( Text(
buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle, buttonTitle! == null ? TranslationBase.of(context).sendEmail : buttonTitle!,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 1), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 1),
), ),
], ],

Loading…
Cancel
Save