nix bewerten vor 11:30 nach 14:30
This commit is contained in:
@@ -24,7 +24,9 @@ class LanguageProvider extends ChangeNotifier {
|
|||||||
},
|
},
|
||||||
"pageHome":
|
"pageHome":
|
||||||
{
|
{
|
||||||
|
"noTimePopupTitle": "Du kannst gerade nicht bewerten!",
|
||||||
|
"noTimePopupContent": "Du kannst nur zu den Essenszeiten zwischen 11:30 und 14:30 bewerten!",
|
||||||
|
"noTimePopupButton": "OK"
|
||||||
},
|
},
|
||||||
"pageService":
|
"pageService":
|
||||||
{
|
{
|
||||||
@@ -71,7 +73,9 @@ class LanguageProvider extends ChangeNotifier {
|
|||||||
"question2": "Quality",
|
"question2": "Quality",
|
||||||
},
|
},
|
||||||
"pageHome": {
|
"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": {
|
"pageService": {
|
||||||
"question1": "Question1",
|
"question1": "Question1",
|
||||||
@@ -114,7 +118,9 @@ class LanguageProvider extends ChangeNotifier {
|
|||||||
"question2": "Qualité",
|
"question2": "Qualité",
|
||||||
},
|
},
|
||||||
"pageHome": {
|
"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": {
|
"pageService": {
|
||||||
"question1": "Question1",
|
"question1": "Question1",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mensaapp/providers/languageProvider.dart';
|
||||||
import 'package:mensaapp/providers/spaceProvider.dart';
|
import 'package:mensaapp/providers/spaceProvider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -25,6 +26,8 @@ class _SpaceHomeState extends State<SpaceHome> {
|
|||||||
late String text = "";
|
late String text = "";
|
||||||
var index = 1;
|
var index = 1;
|
||||||
|
|
||||||
|
var indexMap = {0: "fr", 1: "de", 2: "en"};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
text = tempTexts[0];
|
text = tempTexts[0];
|
||||||
@@ -46,12 +49,73 @@ class _SpaceHomeState extends State<SpaceHome> {
|
|||||||
super.dispose();
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () {
|
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(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -83,11 +147,24 @@ class _SpaceHomeState extends State<SpaceHome> {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).colorScheme.primary),
|
color: Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40,),
|
const SizedBox(
|
||||||
Icon(Icons.touch_app, size: 150, color: Colors.black.withOpacity(0.5),)
|
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),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user