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.
diplomatic-quarter/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart

175 lines
5.3 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/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>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(filterName),
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
),
),
);
},
child: Texts(
TranslationBase.of(context).showMoreBtn,
decoration: TextDecoration.underline,
color: Colors.blue,
),
),
],
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(
width: 2.0, color: Colors.grey[300]),
),
children: fullData(patientLabResultList,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),
),
],
),
);
labResultList.forEach((lab) {
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,
),
),
),
),
],
),
);
});
return tableRow;
}
}