This commit is contained in:
Matyáš Caras 2022-04-12 21:20:22 +02:00
parent d106e78cb3
commit be4f729cc0
5 changed files with 118 additions and 9 deletions

View file

@ -3,5 +3,6 @@
- Přidáno odsazení od okrajů u jídelníčku
- Domovská obrazovka nyní zobrazuje zprávu, pokud na dnešní den není žádné jídlo v jídelníčku
- Upgrade knihovny
- Odhlášení přesunuto do textového menu
# 0.1.0
- První verze

View file

@ -50,6 +50,39 @@ class _BurzaPageState extends State<BurzaPage> {
TextButton(
onPressed: () {
widget.canteen.objednatZBurzy(b).then((a) {
if (a) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text("Objednáno"),
content: const Text(
"Jídlo bylo úspěšně objednáno."),
actions: [
TextButton(
child: const Text("OK"),
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
} else {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text("Nelze objednat"),
content: const Text(
"Jídlo se nepodařilo objednat."),
actions: [
TextButton(
child: const Text("OK"),
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
}
nactiBurzu();
});
},

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:opencanteen/main.dart';
import 'package:opencanteen/util.dart';
import 'package:url_launcher/url_launcher.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key, required this.user, required this.canteen})
@ -78,6 +79,20 @@ class _HomePageState extends State<HomePage> {
});
}
void kliknuti(String value) {
switch (value) {
case 'Odhlásit se':
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (c) => const LoginPage()));
break;
case 'Nahlásit chybu':
launch("https://github.com/hernikplays/opencanteen/issues/new/choose");
break;
}
}
@override
void initState() {
super.initState();
@ -91,14 +106,17 @@ class _HomePageState extends State<HomePage> {
appBar: AppBar(
title: const Text("Domů"),
actions: [
IconButton(
onPressed: (() {
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (c) => const LoginPage()));
}),
icon: const Icon(Icons.logout))
PopupMenuButton(
onSelected: kliknuti,
itemBuilder: (BuildContext context) {
return {'Nahlásit chybu', 'Odhlásit se'}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
},
),
],
),
body: RefreshIndicator(

View file

@ -315,6 +315,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.20"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
vector_math:
dependency: transitive
description:
@ -338,4 +394,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.16.1 <3.0.0"
flutter: ">=2.0.0"
flutter: ">=2.10.0"

View file

@ -20,6 +20,7 @@ dependencies:
cupertino_icons: ^1.0.2
connectivity_plus: ^2.2.1
flutter_secure_storage: ^5.0.2
url_launcher: ^6.0.20
dev_dependencies:
flutter_lints: ^1.0.0