migrainetracker/lib/data_entry/view.dart

134 lines
4.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:migrainetracker/data_storage/daily_status_repository.dart';
import 'package:provider/provider.dart';
class DataEntryPage extends StatelessWidget {
const DataEntryPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var firstButton = ElevatedButton(
onPressed: () {
// model.logFeelingMigrainy(true);
Provider.of<DailyStatusModel>(context, listen: false)
.logFeelingMigrainy(true);
},
style: ElevatedButton.styleFrom(
shape: CircleBorder(),
padding: EdgeInsets.all(12),
),
child: const Icon(Icons.error_outline, size: 120),
);
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
SizedBox.fromSize(size: const Size.fromHeight(32)),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.fromLTRB(32, 0, 32, 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: firstButton,
),
SizedBox.fromSize(size: const Size.fromWidth(32)),
Expanded(
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
shape: CircleBorder(),
padding: EdgeInsets.all(12),
),
child: const Icon(
Icons.notifications_paused_sharp,
size: 120,
),
),
),
],
),
),
),
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.fromLTRB(32, 16, 32, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
flex: 10,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
shape: CircleBorder(),
padding: EdgeInsets.all(12),
),
child: const Icon(
Icons.electric_bolt,
size: 120,
),
),
),
SizedBox.fromSize(size: const Size.fromWidth(32)),
Expanded(
flex: 10,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
shape: CircleBorder(),
padding: EdgeInsets.all(12),
),
child: const Icon(
Icons.medication_outlined,
size: 120,
),
),
),
],
),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
getCurrentDate(),
style: const TextStyle(
fontSize: 54,
fontWeight: FontWeight.w200,
),
),
],
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Consumer<DailyStatusModel>(
builder: (context, model, child) => Text(
"msg: ${model.message2}",
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
),
)),
],
),
),
]);
}
String getCurrentDate() {
DateTime now = DateTime.now();
DateTime date = DateTime(now.year, now.month, now.day);
return DateFormat.yMd('de_CH').format(date);
}
}