This repository has been archived on 2024-07-21. You can view files and clone it, but cannot push or open issues or pull requests.
opencanteen/lib/util.dart

84 lines
2.2 KiB
Dart
Raw Normal View History

2022-04-04 20:22:30 +02:00
import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/material.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';
Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
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(
builder: (context) => BurzaPage(canteen: canteen),
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(
builder: (c) => JidelnicekPage(canteen: canteen))),
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;
}
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,
required this.den});
}