cpd_2022_zi/lib/widgets/relapse_form.dart

42 lines
1.4 KiB
Dart
Raw Normal View History

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';
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>();
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',
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
],
);
}
}