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
|
|
|
|
|
|
|
import 'okna/home.dart';
|
|
|
|
import 'okna/jidelnicek.dart';
|
|
|
|
|
|
|
|
Drawer drawerGenerator(
|
|
|
|
BuildContext context, Canteen canteen, String user, int p) {
|
|
|
|
Drawer drawer = const Drawer();
|
|
|
|
switch (p) {
|
|
|
|
case 1:
|
|
|
|
// Home page
|
|
|
|
drawer = Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
const DrawerHeader(
|
|
|
|
child: Text("OpenCanteen"),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
selected: true,
|
2022-04-05 19:48:14 +02:00
|
|
|
title: const Text("Domů"),
|
2022-04-04 20:22:30 +02:00
|
|
|
leading: const Icon(Icons.home),
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.restaurant),
|
|
|
|
title: const Text('Jídelníček'),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) =>
|
|
|
|
JidelnicekPage(canteen: canteen, user: user),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-04-05 19:48:14 +02:00
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.store),
|
|
|
|
title: const Text('Burza'),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => BurzaPage(canteen: canteen, user: user),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-04-04 20:22:30 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Jidelnicek page
|
|
|
|
drawer = Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
const DrawerHeader(
|
|
|
|
child: Text("OpenCanteen"),
|
|
|
|
),
|
|
|
|
ListTile(
|
2022-04-05 19:48:14 +02:00
|
|
|
title: const Text("Domů"),
|
2022-04-04 20:22:30 +02:00
|
|
|
leading: const Icon(Icons.home),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (c) => HomePage(canteen: canteen, user: user))),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.restaurant),
|
|
|
|
selected: true,
|
|
|
|
title: const Text('Jídelníček'),
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
),
|
2022-04-05 19:48:14 +02:00
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.store),
|
|
|
|
title: const Text('Burza'),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => BurzaPage(canteen: canteen, user: user),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-04-04 20:22:30 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
break;
|
2022-04-05 19:48:14 +02:00
|
|
|
case 3:
|
|
|
|
drawer = Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
const DrawerHeader(
|
|
|
|
child: Text("OpenCanteen"),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.home),
|
|
|
|
title: const Text("Domů"),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (c) => HomePage(canteen: canteen, user: user))),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.restaurant),
|
|
|
|
title: const Text('Jídelníček'),
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) =>
|
|
|
|
JidelnicekPage(canteen: canteen, user: user),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.store),
|
|
|
|
selected: true,
|
|
|
|
title: const Text('Burza'),
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
2022-04-04 20:22:30 +02:00
|
|
|
}
|
|
|
|
return drawer;
|
|
|
|
}
|