2022-02-09 17:52:00 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:charts_flutter/flutter.dart' as charts;
|
|
|
|
import 'package:leg_barkr_app/model/steps_series.dart';
|
|
|
|
|
|
|
|
class StepsChart extends StatelessWidget {
|
2022-02-09 18:29:27 +00:00
|
|
|
List<StepsSeries> data;
|
2022-02-09 17:52:00 +00:00
|
|
|
|
|
|
|
StepsChart(this.data);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
List<charts.Series<StepsSeries, String>> series = [
|
|
|
|
charts.Series(
|
|
|
|
id: "Steps",
|
|
|
|
data: data,
|
|
|
|
domainFn: (StepsSeries series, _) => series.date.day.toString() + "/" + series.date.month.toString(),
|
|
|
|
measureFn: (StepsSeries series, _) => series.steps,
|
|
|
|
colorFn: (StepsSeries series, _) => charts.ColorUtil.fromDartColor(Colors.green)
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
2022-02-09 18:29:27 +00:00
|
|
|
return Container(
|
|
|
|
height: 600,
|
|
|
|
width: double.infinity,
|
|
|
|
child: charts.BarChart(series, animate: true)
|
|
|
|
);
|
2022-02-09 17:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|