2023-03-03 12:50:50 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2023-03-06 00:34:45 +01:00
|
|
|
import 'package:smoke_cess_app/models/relapse.dart';
|
2023-03-05 18:17:08 +01:00
|
|
|
import 'package:smoke_cess_app/providers/tasks_provider.dart';
|
2023-03-06 00:34:45 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/history_list_widget.dart';
|
2023-03-03 12:50:50 +01:00
|
|
|
|
|
|
|
class RelapseView extends StatelessWidget {
|
|
|
|
const RelapseView({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-03-06 00:34:45 +01:00
|
|
|
TasksProvider tasksModel = context.watch<TasksProvider>();
|
2023-03-06 14:55:56 +01:00
|
|
|
return Column(children: [
|
|
|
|
HistoryList<Relapse>(
|
|
|
|
history: tasksModel.relapseHistory,
|
|
|
|
dateSelector: (Relapse relapse) => relapse.date,
|
|
|
|
entryDataSelector: (Relapse relapse) => 'Grund: ${relapse.category}',
|
|
|
|
entryCommentSelector: (Relapse relapse) =>
|
|
|
|
'Kommentar: ${relapse.comment}',
|
|
|
|
icon: Icons.smoke_free_outlined,
|
|
|
|
)
|
|
|
|
]);
|
2023-03-03 12:50:50 +01:00
|
|
|
}
|
|
|
|
}
|