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.
RSGDoctorApp/lib/widgets/shared/charts/app_time_series_chart.dart

52 lines
1.6 KiB
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/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),
],
),
],
),
),
),
);
}
}