2023-02-26 23:30:00 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2023-03-02 20:16:46 +01:00
|
|
|
import 'package:smoke_cess_app/providers/tasks_provider.dart';
|
2023-02-27 02:28:26 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/drop_down.dart';
|
2023-02-27 20:09:11 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/submit_form_button.dart';
|
2023-02-26 23:30:00 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/text_formfield.dart';
|
|
|
|
import '../providers/input_provider.dart';
|
2023-02-27 02:35:17 +01:00
|
|
|
import '../providers/settings_provider.dart';
|
2023-03-02 20:16:46 +01:00
|
|
|
import '../services/pages_service.dart';
|
2023-02-26 23:30:00 +01:00
|
|
|
import 'elevated_card.dart';
|
|
|
|
|
|
|
|
class RelapseForm extends StatelessWidget {
|
|
|
|
const RelapseForm({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var inputModel = context.watch<InputProvider>();
|
2023-02-27 11:57:55 +01:00
|
|
|
var settingsModel = context.watch<SettingsProvider>();
|
2023-03-02 20:16:46 +01:00
|
|
|
var tasksModel = context.watch<TasksProvider>();
|
2023-02-26 23:30:00 +01:00
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
2023-02-27 02:35:17 +01:00
|
|
|
ElevatedCard(
|
2023-02-27 02:28:26 +01:00
|
|
|
title: 'Rückfallkategorie',
|
2023-02-27 11:57:55 +01:00
|
|
|
child: DropDown(settingsModel.settings?.relapseCategories ?? []),
|
2023-02-27 02:28:26 +01:00
|
|
|
),
|
2023-02-26 23:30:00 +01:00
|
|
|
const ElevatedCard(
|
|
|
|
title: 'Beschreibe deinen Rückfall',
|
|
|
|
child: MyTextFormField('Beschreibe deinen Rückfall'),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 80,
|
|
|
|
),
|
2023-03-02 20:16:46 +01:00
|
|
|
SubmitFormButton(
|
|
|
|
submitCallback: inputModel.saveRelapse,
|
2023-03-02 20:33:44 +01:00
|
|
|
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
|
2023-03-02 20:16:46 +01:00
|
|
|
)
|
2023-02-26 23:30:00 +01:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|