nix bewerten vor 11:30 nach 14:30
This commit is contained in:
@@ -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),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user