Merge branch 'elham' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into mohammad
Conflicts: lib/screens/patients/profile/vital_sign/body_measurements_screen.dartmerge-requests/85/head
commit
14edbff8b4
@ -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/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:flutter/material.dart';
|
||||
import 'package:charts_flutter/flutter.dart' as charts;
|
||||
|
||||
class TimeSeriesChart extends StatelessWidget {
|
||||
const TimeSeriesChart({
|
||||
Key key,
|
||||
@required this.seriesList,
|
||||
@required this.vitalList,
|
||||
}) : super(key: key);
|
||||
class AppTimeSeriesChart extends StatelessWidget {
|
||||
AppTimeSeriesChart(
|
||||
{Key key,
|
||||
@required this.vitalList,
|
||||
@required this.viewKey,
|
||||
this.chartName = ''});
|
||||
|
||||
final List<charts.Series> seriesList;
|
||||
final List<VitalSignResModel> vitalList;
|
||||
final String chartName;
|
||||
final String viewKey;
|
||||
List<charts.Series> seriesList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
seriesList = generateData();
|
||||
return RoundedContainer(
|
||||
height: SizeConfig.realScreenHeight * 0.4,
|
||||
child: Center(
|
||||
child: Expanded(
|
||||
child: charts.TimeSeriesChart(
|
||||
seriesList,
|
||||
animate: true,
|
||||
behaviors: [
|
||||
new charts.RangeAnnotation(
|
||||
[
|
||||
new charts.RangeAnnotationSegment(
|
||||
DateTime(
|
||||
vitalList[vitalList.length - 1]
|
||||
.vitalSignDate
|
||||
.year,
|
||||
vitalList[vitalList.length - 1]
|
||||
.vitalSignDate
|
||||
.month +
|
||||
3,
|
||||
vitalList[vitalList.length - 1]
|
||||
.vitalSignDate
|
||||
.day),
|
||||
vitalList[0].vitalSignDate,
|
||||
charts.RangeAnnotationAxisType.domain),
|
||||
],
|
||||
height: SizeConfig.realScreenHeight * 0.47,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
chartName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: SizeConfig.textMultiplier * 3),
|
||||
),
|
||||
Container(
|
||||
height: SizeConfig.realScreenHeight * 0.37,
|
||||
child: Center(
|
||||
child: Expanded(
|
||||
child: charts.TimeSeriesChart(
|
||||
seriesList,
|
||||
animate: true,
|
||||
behaviors: [
|
||||
new charts.RangeAnnotation(
|
||||
[
|
||||
new charts.RangeAnnotationSegment(
|
||||
DateTime(
|
||||
vitalList[vitalList.length - 1]
|
||||
.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