2022-04-04 20:22:30 +02:00
|
|
|
import 'package:canteenlib/canteenlib.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2022-06-08 17:12:44 +02:00
|
|
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
2022-04-05 19:48:14 +02:00
|
|
|
import 'package:opencanteen/okna/burza.dart';
|
2022-04-04 20:22:30 +02:00
|
|
|
|
2022-05-15 16:59:55 +02:00
|
|
|
import 'lang/lang.dart';
|
2022-04-04 20:22:30 +02:00
|
|
|
import 'okna/jidelnicek.dart';
|
|
|
|
|
2022-06-08 17:12:44 +02:00
|
|
|
Drawer drawerGenerator(BuildContext context, Canteen canteen, int p,
|
|
|
|
FlutterLocalNotificationsPlugin n) {
|
2022-04-04 20:22:30 +02:00
|
|
|
Drawer drawer = const Drawer();
|
|
|
|
switch (p) {
|
|
|
|
case 1:
|
|
|
|
// Home page
|
|
|
|
drawer = Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
2022-05-15 16:59:55 +02:00
|
|
|
DrawerHeader(
|
|
|
|
child: Text(Languages.of(context)!.appName),
|
2022-04-04 20:22:30 +02:00
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
selected: true,
|
2022-05-15 16:59:55 +02:00
|
|
|
title: Text(Languages.of(context)!.home),
|
2022-04-04 20:22:30 +02:00
|
|
|
leading: const Icon(Icons.home),
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
),
|
2022-04-05 19:48:14 +02:00
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.store),
|
2022-05-15 16:59:55 +02:00
|
|
|
title: Text(Languages.of(context)!.exchange),
|
2022-04-05 19:48:14 +02:00
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
2022-06-08 17:12:44 +02:00
|
|
|
builder: (context) => BurzaPage(canteen: canteen, n: n),
|
2022-04-05 19:48:14 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-04-04 20:22:30 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
2022-04-05 19:48:14 +02:00
|
|
|
case 3:
|
|
|
|
drawer = Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
2022-05-15 16:59:55 +02:00
|
|
|
DrawerHeader(
|
|
|
|
child: Text(Languages.of(context)!.appName),
|
2022-04-05 19:48:14 +02:00
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.home),
|
2022-05-15 16:59:55 +02:00
|
|
|
title: Text(Languages.of(context)!.home),
|
2022-04-05 19:48:14 +02:00
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
2022-06-08 17:12:44 +02:00
|
|
|
builder: (c) => JidelnicekPage(canteen: canteen, n: n))),
|
2022-04-05 19:48:14 +02:00
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.store),
|
|
|
|
selected: true,
|
2022-05-15 16:59:55 +02:00
|
|
|
title: Text(Languages.of(context)!.exchange),
|
2022-04-05 19:48:14 +02:00
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
2022-04-04 20:22:30 +02:00
|
|
|
}
|
|
|
|
return drawer;
|
|
|
|
}
|
2022-05-16 20:26:39 +02:00
|
|
|
|
|
|
|
class OfflineJidlo {
|
|
|
|
String nazev;
|
|
|
|
String varianta;
|
|
|
|
bool objednano;
|
|
|
|
double cena;
|
|
|
|
bool naBurze;
|
|
|
|
DateTime den;
|
|
|
|
|
|
|
|
OfflineJidlo(
|
|
|
|
{required this.nazev,
|
|
|
|
required this.varianta,
|
|
|
|
required this.objednano,
|
|
|
|
required this.cena,
|
|
|
|
required this.naBurze,
|
2022-05-17 18:14:14 +02:00
|
|
|
required this.den});
|
2022-05-16 20:26:39 +02:00
|
|
|
}
|
2022-06-08 17:12:44 +02:00
|
|
|
|
|
|
|
/// Vytvoří [DateTime] z [TimeOfDay]
|
|
|
|
DateTime casNaDate(TimeOfDay c) {
|
|
|
|
var now = DateTime.now();
|
|
|
|
return DateTime.parse(
|
|
|
|
"${now.year}-${(now.month < 10 ? "0" : "") + now.month.toString()}-${(now.day < 10 ? "0" : "") + now.day.toString()} ${(c.hour < 10 ? "0" : "") + c.hour.toString()}:${(c.minute < 10 ? "0" : "") + c.minute.toString()}:00");
|
|
|
|
}
|
2022-09-12 16:49:42 +02:00
|
|
|
|
|
|
|
List<Map<String, String>> instance = [
|
|
|
|
{"name": "SŠTE Brno, Olomoucká", "url": "https://stravovani.sstebrno.cz"},
|
|
|
|
{"name": "Jiné", "url": ""}
|
|
|
|
];
|