cpd_2022_zi/lib/widgets/relapse_form.dart

42 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:smoke_cess_app/providers/tasks_provider.dart';
import 'package:smoke_cess_app/widgets/drop_down.dart';
import 'package:smoke_cess_app/widgets/submit_form_button.dart';
import 'package:smoke_cess_app/widgets/text_formfield.dart';
import '../providers/input_provider.dart';
import '../providers/settings_provider.dart';
import '../services/pages_service.dart';
import 'elevated_card.dart';
class RelapseForm extends StatelessWidget {
const RelapseForm({super.key});
@override
Widget build(BuildContext context) {
var inputModel = context.watch<InputProvider>();
var settingsModel = context.watch<SettingsProvider>();
var tasksModel = context.watch<TasksProvider>();
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedCard(
title: 'Rückfallkategorie',
child: DropDown(settingsModel.settings?.relapseCategories ?? []),
),
const ElevatedCard(
title: 'Beschreibe deinen Rückfall',
child: MyTextFormField('Beschreibe deinen Rückfall'),
),
const SizedBox(
height: 80,
),
SubmitFormButton(
submitCallback: inputModel.saveRelapse,
updateTasks: () => tasksModel.setTaskDone(Pages.mood),
)
],
);
}
}