2023-02-16 12:00:02 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2023-02-26 14:59:37 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2023-02-17 11:35:05 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/elevated_card.dart';
|
2023-02-16 12:00:02 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/slider.dart';
|
2023-02-27 20:09:11 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/submit_form_button.dart';
|
2023-02-16 12:00:02 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/text_formfield.dart';
|
2023-02-17 11:35:05 +01:00
|
|
|
import 'package:smoke_cess_app/widgets/timepicker.dart';
|
2023-02-16 12:00:02 +01:00
|
|
|
|
2023-02-26 14:59:37 +01:00
|
|
|
import '../providers/input_provider.dart';
|
|
|
|
|
2023-02-26 17:07:38 +01:00
|
|
|
class SleepForm extends StatelessWidget {
|
2023-02-20 23:59:40 +01:00
|
|
|
const SleepForm({Key? key}) : super(key: key);
|
2023-02-16 12:00:02 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-02-26 17:07:38 +01:00
|
|
|
InputProvider inputModel = context.watch<InputProvider>();
|
|
|
|
String wokeUpKey = 'wokeUpAt';
|
|
|
|
String sleptKey = 'sleptAt';
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
ElevatedCard(
|
|
|
|
title: 'Einschlafzeit',
|
|
|
|
child: TimePicker(sleptKey),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
ElevatedCard(
|
|
|
|
title: 'Aufwachzeit',
|
|
|
|
child: TimePicker(wokeUpKey),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
const ElevatedCard(
|
|
|
|
title: 'Schlafbewertung',
|
|
|
|
child: MySlider(),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
const ElevatedCard(
|
|
|
|
title: 'Schlafbeschreibung',
|
|
|
|
child: MyTextFormField('Beschreibe deinen Schlaf'),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 80,
|
|
|
|
),
|
2023-02-27 20:09:11 +01:00
|
|
|
SubmitFormButton(
|
|
|
|
submitCallback: () => inputModel.saveSleep(wokeUpKey, sleptKey),
|
|
|
|
)
|
2023-02-26 17:07:38 +01:00
|
|
|
],
|
2023-02-20 23:59:40 +01:00
|
|
|
);
|
2023-02-16 12:00:02 +01:00
|
|
|
}
|
|
|
|
}
|