import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smoke_cess_app/models/sleep.dart'; import 'package:smoke_cess_app/widgets/entry_detail_widget.dart'; import 'package:smoke_cess_app/widgets/history_list_widget.dart'; import 'package:smoke_cess_app/widgets/line_chart_widget.dart'; import 'package:smoke_cess_app/providers/tasks_provider.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; class SleepView extends StatelessWidget { const SleepView({super.key}); @override Widget build(BuildContext context) { TasksProvider tasksModel = context.watch(); return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ LineChart( series: [ LineSeries( dataSource: tasksModel.sleepHistory, xValueMapper: (Sleep value, _) => value.date, yValueMapper: (Sleep value, _) => value.sleepQualitiyValue) ], ), HistoryList( history: tasksModel.sleepHistory, dateSelector: (Sleep sleep) => sleep.date, entryDataSelector: (Sleep sleep) => '${sleep.sleepDuration.hour}:${sleep.sleepDuration.minute}') ], ); } }