vitalsign details
parent
bd24b7c196
commit
0d30fd6212
@ -0,0 +1,39 @@
|
|||||||
|
import 'package:doctor_app_flutter/models/patient/vital_sign_res_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/patients/vital_sign_details_wideget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/charts/app_time_series_chart.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
class VitalSingChartAndDetials extends StatelessWidget {
|
||||||
|
VitalSingChartAndDetials({
|
||||||
|
Key key,
|
||||||
|
@required this.vitalList,
|
||||||
|
@required this.name,
|
||||||
|
@required this.viewKey,
|
||||||
|
@required this.title1,
|
||||||
|
@required this.title2,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final List<VitalSignResModel> vitalList ;
|
||||||
|
final String name;
|
||||||
|
final String viewKey;
|
||||||
|
final String title1;
|
||||||
|
final String title2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
AppTimeSeriesChart(
|
||||||
|
vitalList: vitalList,
|
||||||
|
chartName: name,
|
||||||
|
viewKey: viewKey,
|
||||||
|
),
|
||||||
|
VitalSignDetailsWidget(
|
||||||
|
vitalList: vitalList.reversed.toList(),
|
||||||
|
title1: '${title1}',
|
||||||
|
title2: '${title2}',
|
||||||
|
viewKey: '${viewKey}',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,51 +1,93 @@
|
|||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
import 'package:doctor_app_flutter/models/patient/vital_sign_res_model.dart';
|
import 'package:doctor_app_flutter/models/patient/vital_sign_res_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/body_measurements_screen.dart';
|
||||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:charts_flutter/flutter.dart' as charts;
|
|
||||||
|
|
||||||
class TimeSeriesChart extends StatelessWidget {
|
class AppTimeSeriesChart extends StatelessWidget {
|
||||||
const TimeSeriesChart({
|
AppTimeSeriesChart(
|
||||||
Key key,
|
{Key key,
|
||||||
@required this.seriesList,
|
@required this.vitalList,
|
||||||
@required this.vitalList,
|
@required this.viewKey,
|
||||||
}) : super(key: key);
|
this.chartName = ''});
|
||||||
|
|
||||||
final List<charts.Series> seriesList;
|
|
||||||
final List<VitalSignResModel> vitalList;
|
final List<VitalSignResModel> vitalList;
|
||||||
|
final String chartName;
|
||||||
|
final String viewKey;
|
||||||
|
List<charts.Series> seriesList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
seriesList = generateData();
|
||||||
return RoundedContainer(
|
return RoundedContainer(
|
||||||
height: SizeConfig.realScreenHeight * 0.4,
|
height: SizeConfig.realScreenHeight * 0.47,
|
||||||
child: Center(
|
child: Column(
|
||||||
child: Expanded(
|
children: <Widget>[
|
||||||
child: charts.TimeSeriesChart(
|
Text(
|
||||||
seriesList,
|
chartName,
|
||||||
animate: true,
|
style: TextStyle(
|
||||||
behaviors: [
|
fontWeight: FontWeight.bold,
|
||||||
new charts.RangeAnnotation(
|
fontSize: SizeConfig.textMultiplier * 3),
|
||||||
[
|
),
|
||||||
new charts.RangeAnnotationSegment(
|
Container(
|
||||||
DateTime(
|
height: SizeConfig.realScreenHeight * 0.37,
|
||||||
vitalList[vitalList.length - 1]
|
child: Center(
|
||||||
.vitalSignDate
|
child: Expanded(
|
||||||
.year,
|
child: charts.TimeSeriesChart(
|
||||||
vitalList[vitalList.length - 1]
|
seriesList,
|
||||||
.vitalSignDate
|
animate: true,
|
||||||
.month +
|
behaviors: [
|
||||||
3,
|
new charts.RangeAnnotation(
|
||||||
vitalList[vitalList.length - 1]
|
[
|
||||||
.vitalSignDate
|
new charts.RangeAnnotationSegment(
|
||||||
.day),
|
DateTime(
|
||||||
vitalList[0].vitalSignDate,
|
vitalList[vitalList.length - 1]
|
||||||
charts.RangeAnnotationAxisType.domain),
|
.vitalSignDate
|
||||||
],
|
.year,
|
||||||
|
vitalList[vitalList.length - 1]
|
||||||
|
.vitalSignDate
|
||||||
|
.month +
|
||||||
|
3,
|
||||||
|
vitalList[vitalList.length - 1]
|
||||||
|
.vitalSignDate
|
||||||
|
.day),
|
||||||
|
vitalList[0].vitalSignDate,
|
||||||
|
charts.RangeAnnotationAxisType.domain),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateData() {
|
||||||
|
final List<TimeSeriesSales> data = [];
|
||||||
|
if (vitalList.length > 0) {
|
||||||
|
vitalList.forEach(
|
||||||
|
(element) {
|
||||||
|
data.add(
|
||||||
|
TimeSeriesSales(
|
||||||
|
new DateTime(element.vitalSignDate.year,
|
||||||
|
element.vitalSignDate.month, element.vitalSignDate.day),
|
||||||
|
element.toJson()[viewKey].toInt(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
new charts.Series<TimeSeriesSales, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
domainFn: (TimeSeriesSales sales, _) => sales.time,
|
||||||
|
measureFn: (TimeSeriesSales sales, _) => sales.sales,
|
||||||
|
data: data,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue