97 lines
2.5 KiB
Dart
97 lines
2.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mensaapp/providers/spaceProvider.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class SpaceHome extends StatefulWidget {
|
|
const SpaceHome({super.key});
|
|
|
|
@override
|
|
State<SpaceHome> createState() => _SpaceHomeState();
|
|
}
|
|
|
|
class _SpaceHomeState extends State<SpaceHome> {
|
|
//TODO: in languageProvider
|
|
var tempTexts = [
|
|
"Bewerte jetzt deine DHBW-Kantine...",
|
|
"Rate your DHBW canteen now...",
|
|
"Évaluez votre cantine DHBW maintenant..."
|
|
];
|
|
|
|
//TODO: END-TODO
|
|
|
|
late Timer _timer;
|
|
late String text = "";
|
|
var index = 0;
|
|
|
|
@override
|
|
void initState() {
|
|
text = tempTexts[0];
|
|
super.initState();
|
|
_timer = Timer.periodic(
|
|
const Duration(seconds: 5),
|
|
(timer) {
|
|
setState(() {
|
|
text = tempTexts[index];
|
|
index = (index + 1 >= tempTexts.length ? 0 : index + 1);
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_timer.cancel();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: GestureDetector(
|
|
onTap: () {
|
|
Provider.of<SpaceProvider>(context, listen: false).setSelectedSpace(1);
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Center(
|
|
child: Container(
|
|
width: 1600,
|
|
height: 750,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("assets/backgrounds/Essen.jpg"),
|
|
fit: BoxFit.cover, // Deckt den gesamten Bildschirm ab
|
|
colorFilter: ColorFilter.mode(
|
|
Colors.white.withOpacity(0.2),
|
|
BlendMode.dstATop,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize: 70,
|
|
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),)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|