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
2022-05-15 16:59:55 +02:00

68 lines
1.9 KiB
Dart

import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/material.dart';
import 'package:opencanteen/okna/burza.dart';
import 'lang/lang.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: [
DrawerHeader(
child: Text(Languages.of(context)!.appName),
),
ListTile(
selected: true,
title: Text(Languages.of(context)!.home),
leading: const Icon(Icons.home),
onTap: () => Navigator.pop(context),
),
ListTile(
leading: const Icon(Icons.store),
title: Text(Languages.of(context)!.exchange),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BurzaPage(canteen: canteen, user: user),
),
),
),
],
),
);
break;
case 3:
drawer = Drawer(
child: ListView(
children: [
DrawerHeader(
child: Text(Languages.of(context)!.appName),
),
ListTile(
leading: const Icon(Icons.home),
title: Text(Languages.of(context)!.home),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (c) =>
JidelnicekPage(canteen: canteen, user: user))),
),
ListTile(
leading: const Icon(Icons.store),
selected: true,
title: Text(Languages.of(context)!.exchange),
onTap: () => Navigator.pop(context),
),
],
),
);
}
return drawer;
}