You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart

96 lines
3.4 KiB
Dart

import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../text.dart';
import 'FlowChartPage.dart';
class LabResultWidget extends StatelessWidget {
final String filterName;
final List<LabResult> patientLabResultList;
final PatientLabOrders patientLabOrder;
LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key);
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 8),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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(
context,
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
),
),
);
},
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(
columnWidths: {
0: FlexColumnWidth(2),
1: FlexColumnWidth(1.5),
2: FlexColumnWidth(1),
},
children: fullData(patientLabResultList, context),
),
],
),
);
}
List<TableRow> fullData(List<LabResult> labResultList, context) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Utils.tableColumnTitle(TranslationBase.of(context).description),
Utils.tableColumnTitle(TranslationBase.of(context).value),
Utils.tableColumnTitle(TranslationBase.of(context).range),
],
),
);
for (int i = 0; i < labResultList.length; i++)
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)),
],
),
);
return tableRow;
}
}