31 lines
1006 B
Dart
31 lines
1006 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:smoke_cess_app/widgets/line_chart_widget.dart';
|
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
|
import 'package:smoke_cess_app/models/mood.dart';
|
|
import 'package:smoke_cess_app/providers/tasks_provider.dart';
|
|
|
|
class MoodView extends StatelessWidget {
|
|
const MoodView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var tasksModel = context.watch<TasksProvider>();
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
LineChart(series: [
|
|
LineSeries<Mood, DateTime>(
|
|
dataSource: tasksModel.moodHistory,
|
|
xValueMapper: (Mood value, _) => value.date,
|
|
yValueMapper: (Mood value, _) => value.moodValue)
|
|
]),
|
|
Column(
|
|
children: tasksModel.moodHistory.map((mood) {
|
|
return Text('${mood.date}: ${mood.moodValue}');
|
|
}).toList())
|
|
],
|
|
);
|
|
}
|
|
}
|