TimeSeriesChart as widget
parent
1347198928
commit
bd24b7c196
@ -0,0 +1,51 @@
|
||||
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/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);
|
||||
|
||||
final List<charts.Series> seriesList;
|
||||
final List<VitalSignResModel> vitalList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue