nix bewerten vor 11:30 nach 14:30

This commit is contained in:
Jonas Braus
2024-11-26 16:13:10 +01:00
parent 08f6008637
commit df56c82c69
2 changed files with 90 additions and 7 deletions
+9 -3
View File
@@ -24,7 +24,9 @@ class LanguageProvider extends ChangeNotifier {
},
"pageHome":
{
"noTimePopupTitle": "Du kannst gerade nicht bewerten!",
"noTimePopupContent": "Du kannst nur zu den Essenszeiten zwischen 11:30 und 14:30 bewerten!",
"noTimePopupButton": "OK"
},
"pageService":
{
@@ -71,7 +73,9 @@ class LanguageProvider extends ChangeNotifier {
"question2": "Quality",
},
"pageHome": {
"noTimePopupTitle": "You cannot rate right now!",
"noTimePopupContent": "You can only rate during meal times between 11:30 AM and 2:30 PM!",
"noTimePopupButton": "OK"
},
"pageService": {
"question1": "Question1",
@@ -114,7 +118,9 @@ class LanguageProvider extends ChangeNotifier {
"question2": "Qualité",
},
"pageHome": {
"noTimePopupTitle": "Vous ne pouvez pas évaluer pour le moment !",
"noTimePopupContent": "Vous ne pouvez évaluer que pendant les heures de repas entre 11h30 et 14h30 !",
"noTimePopupButton": "D'ACCORD"
},
"pageService": {
"question1": "Question1",
+81 -4
View File
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mensaapp/providers/languageProvider.dart';
import 'package:mensaapp/providers/spaceProvider.dart';
import 'package:provider/provider.dart';
@@ -25,6 +26,8 @@ class _SpaceHomeState extends State<SpaceHome> {
late String text = "";
var index = 1;
var indexMap = {0: "fr", 1: "de", 2: "en"};
@override
void initState() {
text = tempTexts[0];
@@ -46,12 +49,73 @@ class _SpaceHomeState extends State<SpaceHome> {
super.dispose();
}
// only for test
var disableRateTimeDebug = false;
// end only for test
void _showNotRateTimeDialog(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
title: Text(
Provider.of<LanguageProvider>(context, listen: false)
.languageData[indexMap[index]]["pageHome"]["noTimePopupTitle"],
style: TextStyle(fontSize: 25),
),
content: Text(
Provider.of<LanguageProvider>(context, listen: false)
.languageData[indexMap[index]]["pageHome"]
["noTimePopupContent"],
style: TextStyle(fontSize: 20),
),
actions: [
FilledButton(
child: Text(
Provider.of<LanguageProvider>(context, listen: false)
.languageData[indexMap[index]]["pageHome"]
["noTimePopupButton"],
style: TextStyle(fontSize: 17),
),
onPressed: () {
if (disableRateTimeDebug) {
Provider.of<SpaceProvider>(context, listen: false)
.setSelectedSpace(1);
}
Navigator.of(context).pop();
},
)
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: GestureDetector(
onTap: () {
Provider.of<SpaceProvider>(context, listen: false).setSelectedSpace(1);
var now = DateTime.now();
if (!(now
.difference(
DateTime(now.year, now.month, now.day, 11, 30))
.inMinutes >
0 &&
now
.difference(
DateTime(now.year, now.month, now.day, 14, 30))
.inMinutes <
0)) {
_showNotRateTimeDialog(context);
} else {
Provider.of<SpaceProvider>(context, listen: false)
.setSelectedSpace(1);
}
},
child: Stack(
children: [
@@ -83,11 +147,24 @@ class _SpaceHomeState extends State<SpaceHome> {
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary),
),
const SizedBox(height: 40,),
Icon(Icons.touch_app, size: 150, color: Colors.black.withOpacity(0.5),)
const SizedBox(
height: 40,
),
Icon(
Icons.touch_app,
size: 150,
color: Colors.black.withOpacity(0.5),
),
SizedBox(
height: 50,
),
Text(
"11:30 - 14:30",
style: TextStyle(fontSize: 40),
),
],
),
)
),
],
),
),