Lepší
This commit is contained in:
parent
d106e78cb3
commit
be4f729cc0
5 changed files with 118 additions and 9 deletions
|
@ -3,5 +3,6 @@
|
||||||
- Přidáno odsazení od okrajů u jídelníčku
|
- 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
|
- Domovská obrazovka nyní zobrazuje zprávu, pokud na dnešní den není žádné jídlo v jídelníčku
|
||||||
- Upgrade knihovny
|
- Upgrade knihovny
|
||||||
|
- Odhlášení přesunuto do textového menu
|
||||||
# 0.1.0
|
# 0.1.0
|
||||||
- První verze
|
- První verze
|
|
@ -50,6 +50,39 @@ class _BurzaPageState extends State<BurzaPage> {
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
widget.canteen.objednatZBurzy(b).then((a) {
|
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();
|
nactiBurzu();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:opencanteen/main.dart';
|
import 'package:opencanteen/main.dart';
|
||||||
import 'package:opencanteen/util.dart';
|
import 'package:opencanteen/util.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({Key? key, required this.user, required this.canteen})
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -91,14 +106,17 @@ class _HomePageState extends State<HomePage> {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Domů"),
|
title: const Text("Domů"),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
PopupMenuButton(
|
||||||
onPressed: (() {
|
onSelected: kliknuti,
|
||||||
const storage = FlutterSecureStorage();
|
itemBuilder: (BuildContext context) {
|
||||||
storage.deleteAll();
|
return {'Nahlásit chybu', 'Odhlásit se'}.map((String choice) {
|
||||||
Navigator.pushReplacement(context,
|
return PopupMenuItem<String>(
|
||||||
MaterialPageRoute(builder: (c) => const LoginPage()));
|
value: choice,
|
||||||
}),
|
child: Text(choice),
|
||||||
icon: const Icon(Icons.logout))
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
|
|
58
pubspec.lock
58
pubspec.lock
|
@ -315,6 +315,62 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
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:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -338,4 +394,4 @@ packages:
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.16.1 <3.0.0"
|
dart: ">=2.16.1 <3.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=2.10.0"
|
||||||
|
|
|
@ -20,6 +20,7 @@ dependencies:
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
connectivity_plus: ^2.2.1
|
connectivity_plus: ^2.2.1
|
||||||
flutter_secure_storage: ^5.0.2
|
flutter_secure_storage: ^5.0.2
|
||||||
|
url_launcher: ^6.0.20
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^1.0.0
|
flutter_lints: ^1.0.0
|
||||||
|
|
Reference in a new issue