diff --git a/CHANGELOG.md b/CHANGELOG.md index ad3df00..30da080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,5 +5,6 @@ - Upgrade knihovny - Odhlášení přesunuto do textového menu - Odstraněna stránka domů, hlavní stránka je nyní jídelníček +- Přidána stránka `O Aplikaci` # 0.1.0 - První verze \ No newline at end of file diff --git a/lib/okna/about.dart b/lib/okna/about.dart new file mode 100644 index 0000000..0a8dedd --- /dev/null +++ b/lib/okna/about.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AboutPage extends StatefulWidget { + const AboutPage({Key? key}) : super(key: key); + + @override + State createState() => _AboutPageState(); +} + +class _AboutPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("O Aplikaci"), + ), + body: SizedBox( + height: MediaQuery.of(context).size.height, + child: Column(mainAxisSize: MainAxisSize.min, children: [ + const Text("OpenCanteen", style: TextStyle(fontSize: 30)), + const Text("© 2022 Matyáš Caras a přispěvatelé"), + const Text("Vydáno pod licencí GNU GPLv3"), + const SizedBox(height: 15), + const Text("Použité knihovny:", style: TextStyle(fontSize: 19)), + const SizedBox(height: 10), + cudlik( + "Flutter", + "Copyright 2014 The Flutter Authors. All rights reserved, licence BSD 3-Clause", + "https://github.com/flutter/flutter/blob/master/LICENSE"), + const SizedBox(height: 10), + cudlik( + "Flutter_secure_storage", + "Copyright 2017 German Saprykin. All rights reserved, licence BSD 3-Clause", + "https://github.com/mogol/flutter_secure_storage/blob/develop/flutter_secure_storage/LICENSE"), + const SizedBox(height: 10), + cudlik( + "connectivity_plus", + "Copyright 2017 The Chromium Authors. All rights reserved, licence BSD 3-Clause", + "https://github.com/fluttercommunity/plus_plugins/blob/main/packages/connectivity_plus/connectivity_plus/LICENSE"), + const SizedBox(height: 10), + cudlik( + "url_launcher", + "Copyright 2013 The Flutter Authors. All rights reserved, licence BSD 3-Clause", + "https://github.com/flutter/plugins/blob/main/packages/url_launcher/url_launcher/LICENSE"), + const SizedBox(height: 10), + cudlik( + "canteenlib", + "Copyright (c) 2022 Matyáš Caras and contributors, licence MIT", + "https://github.com/hernikplays/canteenlib/blob/main/LICENSE") + ]), + ), + ); + } + + Widget cudlik(String nazev, String copyright, String licence) { + return InkWell( + onTap: () => launch(licence), + child: Column(children: [ + Text( + nazev, + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + textAlign: TextAlign.center, + ), + Text( + copyright, + ), + ]), + ); + } +} diff --git a/lib/okna/jidelnicek.dart b/lib/okna/jidelnicek.dart index 1322734..3dd0d99 100644 --- a/lib/okna/jidelnicek.dart +++ b/lib/okna/jidelnicek.dart @@ -1,8 +1,11 @@ import 'package:canteenlib/canteenlib.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:opencanteen/util.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../main.dart'; +import 'about.dart'; class JidelnicekPage extends StatefulWidget { const JidelnicekPage({Key? key, required this.canteen, required this.user}) @@ -169,6 +172,24 @@ class _JidelnicekPageState extends State { }); } + 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; + case 'O Aplikaci': + Navigator.push( + context, MaterialPageRoute(builder: (c) => const AboutPage())); + break; + } + } + @override void initState() { super.initState(); @@ -181,6 +202,20 @@ class _JidelnicekPageState extends State { drawer: drawerGenerator(context, widget.canteen, widget.user, 1), appBar: AppBar( title: const Text('Jídelníček'), + actions: [ + PopupMenuButton( + onSelected: kliknuti, + itemBuilder: (BuildContext context) { + return {'Nahlásit chybu', 'O Aplikaci', 'Odhlásit se'} + .map((String choice) { + return PopupMenuItem( + value: choice, + child: Text(choice), + ); + }).toList(); + }, + ), + ], ), body: RefreshIndicator( child: Center( diff --git a/pubspec.lock b/pubspec.lock index acfdf2b..bed36d5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -106,13 +106,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" dbus: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index fe95241..7ac35a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,6 @@ dependencies: flutter_localizations: sdk: flutter canteenlib: ^0.1.0-alpha.14 - cupertino_icons: ^1.0.2 connectivity_plus: ^2.2.1 flutter_secure_storage: ^5.0.2 url_launcher: ^6.0.20