Uvítací obrazovka (Finally closes #3)
This commit is contained in:
parent
4818aaba7f
commit
4107b96ed7
14 changed files with 208 additions and 56 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 1.1.0
|
||||||
|
- Přidat uvítací obrazovku při prvním spuštění
|
||||||
|
- Mírné vyčištění kódu
|
||||||
# 1.0.0
|
# 1.0.0
|
||||||
- Ukládání dnešního jídelníčku offline
|
- Ukládání dnešního jídelníčku offline
|
||||||
- Stránka s možnostmi nastavení aplikace
|
- Stránka s možnostmi nastavení aplikace
|
||||||
|
|
BIN
assets/burza.png
Normal file
BIN
assets/burza.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
assets/doburzy.png
Normal file
BIN
assets/doburzy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
BIN
assets/objednavam.png
Normal file
BIN
assets/objednavam.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
|
@ -85,6 +85,26 @@ abstract class Languages {
|
||||||
|
|
||||||
String get balance;
|
String get balance;
|
||||||
|
|
||||||
|
// Uvítací obrazovka
|
||||||
|
|
||||||
|
String get welcome;
|
||||||
|
|
||||||
|
String get appDesc;
|
||||||
|
|
||||||
|
String get aboutOrder;
|
||||||
|
|
||||||
|
String get howOrder;
|
||||||
|
|
||||||
|
String get aboutToExch;
|
||||||
|
|
||||||
|
String get howToExch;
|
||||||
|
|
||||||
|
String get aboutFromExch;
|
||||||
|
|
||||||
|
String get howFromExch;
|
||||||
|
|
||||||
|
String get next;
|
||||||
|
|
||||||
// Burza
|
// Burza
|
||||||
|
|
||||||
String get exchange;
|
String get exchange;
|
||||||
|
|
|
@ -92,7 +92,7 @@ class LanguageCz extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get notOfficial =>
|
String get notOfficial =>
|
||||||
"Toto není oficiální aplikace k ovládání iCanteen. Autor neručí za ztráty nebo nefunkčnost v souvislosti s používáním této aplikace. Tato zpráva se znovu neukáže.";
|
"Toto není oficiální aplikace k ovládání iCanteen. Autor neručí za ztráty nebo nefunkčnost v souvislosti s používáním této aplikace. Pokračováním souhlasíte.";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get offline => "JSTE OFFLINE";
|
String get offline => "JSTE OFFLINE";
|
||||||
|
@ -165,4 +165,35 @@ class LanguageCz extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get yes => "Ano";
|
String get yes => "Ano";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutFromExch => "Žádné jídlo? Žádný problém!";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutOrder => "Klepnutím objednáte";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutToExch => "Nemáte chuť?";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appDesc =>
|
||||||
|
"OpenCanteen je neoficiální aplikace pro přístup do obědového systému iCanteen";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howFromExch =>
|
||||||
|
"Z vysunovacího menu přejděte do burzy a objednejte si z dostupných jídel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howOrder =>
|
||||||
|
"Jednoduše klepněte na jídlo s modrým políčkem a máte objednáno";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howToExch =>
|
||||||
|
"Stačí dlouze podržet jméno objednaného jídla a můžete ho přesunout na nebo z burzy";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get welcome => "Vítejte v OpenCanteen";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get next => "Další";
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class LanguageEn extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get notOfficial =>
|
String get notOfficial =>
|
||||||
"This is not an official app for accessing iCanteen. The author is not responsible for non-functionality or losses while using this app. This message will not appear again.";
|
"This is not an official app for accessing iCanteen. The author is not responsible for non-functionality or losses while using this app. By continuing you agree.";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get offline => "YOU ARE OFFLINE";
|
String get offline => "YOU ARE OFFLINE";
|
||||||
|
@ -166,4 +166,34 @@ class LanguageEn extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get yes => "Yes";
|
String get yes => "Yes";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appDesc => "OpenCanteen is a mobile app for accessing iCanteen.";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get welcome => "Welcome to OpenCanteen";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutOrder => "Order with a tap";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howOrder =>
|
||||||
|
"Simply tap on a meal with a blue checkbox next to it and it's done!";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutToExch => "Don't want your food?";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howToExch =>
|
||||||
|
"If you cannot cancel your order, simply long-tap on the ordered food and put it into the exchange.";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get aboutFromExch => "No food? No problem!";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get howFromExch =>
|
||||||
|
"Simply check the exchange from the sidebar and order when a meal is available.";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get next => "Next";
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:opencanteen/loginmanager.dart';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:canteenlib/canteenlib.dart';
|
import 'package:canteenlib/canteenlib.dart';
|
||||||
import 'package:opencanteen/okna/offline_jidelnicek.dart';
|
import 'package:opencanteen/okna/offline_jidelnicek.dart';
|
||||||
|
import 'package:opencanteen/okna/welcome.dart';
|
||||||
import 'package:opencanteen/util.dart';
|
import 'package:opencanteen/util.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
|
@ -123,7 +124,6 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => JidelnicekPage(
|
builder: (context) => JidelnicekPage(
|
||||||
user: r["user"]!,
|
|
||||||
canteen: canteen,
|
canteen: canteen,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
@ -220,34 +220,6 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
));
|
));
|
||||||
if (!d!) return;
|
if (!d!) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// souhlas
|
|
||||||
const storage = FlutterSecureStorage();
|
|
||||||
var odsouhlasil = await storage.read(key: "oc_souhlas");
|
|
||||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
|
||||||
var d = await showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (c) => AlertDialog(
|
|
||||||
title: Text(Languages.of(context)!.warning),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: Text(Languages.of(context)!
|
|
||||||
.notOfficial)),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () =>
|
|
||||||
Navigator.pop(c, true),
|
|
||||||
child: Text(
|
|
||||||
Languages.of(context)!.agree)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () =>
|
|
||||||
Navigator.pop(c, false),
|
|
||||||
child: Text(
|
|
||||||
Languages.of(context)!.disagree))
|
|
||||||
],
|
|
||||||
));
|
|
||||||
if (!d!) return;
|
|
||||||
await storage.write(key: "oc_souhlas", value: "ano");
|
|
||||||
}
|
|
||||||
if (!canteenControl.text.startsWith("https://") &&
|
if (!canteenControl.text.startsWith("https://") &&
|
||||||
!canteenControl.text.startsWith("http://")) {
|
!canteenControl.text.startsWith("http://")) {
|
||||||
canteenControl.text =
|
canteenControl.text =
|
||||||
|
@ -271,14 +243,25 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
LoginManager.setDetails(userControl.text,
|
LoginManager.setDetails(userControl.text,
|
||||||
passControl.text, canteenControl.text);
|
passControl.text, canteenControl.text);
|
||||||
}
|
}
|
||||||
|
// souhlas
|
||||||
|
const storage = FlutterSecureStorage();
|
||||||
|
var odsouhlasil =
|
||||||
|
await storage.read(key: "oc_souhlas");
|
||||||
|
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (c) =>
|
||||||
|
WelcomeScreen(canteen: canteen)));
|
||||||
|
} else {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => JidelnicekPage(
|
builder: (context) => JidelnicekPage(
|
||||||
user: userControl.text,
|
|
||||||
canteen: canteen,
|
canteen: canteen,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} on Exception catch (_) {
|
} on Exception catch (_) {
|
||||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
|
@ -6,10 +6,8 @@ import '../lang/lang.dart';
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
|
||||||
class BurzaPage extends StatefulWidget {
|
class BurzaPage extends StatefulWidget {
|
||||||
const BurzaPage({Key? key, required this.canteen, required this.user})
|
const BurzaPage({Key? key, required this.canteen}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
final Canteen canteen;
|
final Canteen canteen;
|
||||||
final String user;
|
|
||||||
@override
|
@override
|
||||||
State<BurzaPage> createState() => _BurzaPageState();
|
State<BurzaPage> createState() => _BurzaPageState();
|
||||||
}
|
}
|
||||||
|
@ -114,7 +112,7 @@ class _BurzaPageState extends State<BurzaPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: drawerGenerator(context, widget.canteen, widget.user, 3),
|
drawer: drawerGenerator(context, widget.canteen, 3),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(Languages.of(context)!.exchange),
|
title: Text(Languages.of(context)!.exchange),
|
||||||
),
|
),
|
||||||
|
|
|
@ -15,10 +15,8 @@ import '../main.dart';
|
||||||
import 'about.dart';
|
import 'about.dart';
|
||||||
|
|
||||||
class JidelnicekPage extends StatefulWidget {
|
class JidelnicekPage extends StatefulWidget {
|
||||||
const JidelnicekPage({Key? key, required this.canteen, required this.user})
|
const JidelnicekPage({Key? key, required this.canteen}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
final Canteen canteen;
|
final Canteen canteen;
|
||||||
final String user;
|
|
||||||
@override
|
@override
|
||||||
State<JidelnicekPage> createState() => _JidelnicekPageState();
|
State<JidelnicekPage> createState() => _JidelnicekPageState();
|
||||||
}
|
}
|
||||||
|
@ -262,7 +260,7 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: drawerGenerator(context, widget.canteen, widget.user, 1),
|
drawer: drawerGenerator(context, widget.canteen, 1),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(Languages.of(context)!.menu),
|
title: Text(Languages.of(context)!.menu),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
75
lib/okna/welcome.dart
Normal file
75
lib/okna/welcome.dart
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
import 'package:canteenlib/canteenlib.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
import 'package:introduction_screen/introduction_screen.dart';
|
||||||
|
import 'package:opencanteen/lang/lang.dart';
|
||||||
|
import 'package:opencanteen/okna/jidelnicek.dart';
|
||||||
|
|
||||||
|
class WelcomeScreen extends StatefulWidget {
|
||||||
|
const WelcomeScreen({Key? key, required this.canteen}) : super(key: key);
|
||||||
|
|
||||||
|
final Canteen canteen;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<WelcomeScreen> createState() => _WelcomeScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var listPagesViewModel = [
|
||||||
|
PageViewModel(
|
||||||
|
title: Languages.of(context)!.welcome,
|
||||||
|
body: Languages.of(context)!.appDesc,
|
||||||
|
image: const Center(
|
||||||
|
child: Icon(Icons.waving_hand_outlined, size: 175),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PageViewModel(
|
||||||
|
title: Languages.of(context)!.aboutOrder,
|
||||||
|
body: Languages.of(context)!.howOrder,
|
||||||
|
image: Center(
|
||||||
|
child: Image.asset('assets/objednavam.png',
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PageViewModel(
|
||||||
|
title: Languages.of(context)!.aboutToExch,
|
||||||
|
body: Languages.of(context)!.howToExch,
|
||||||
|
image: Center(
|
||||||
|
child: Image.asset('assets/doburzy.png',
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PageViewModel(
|
||||||
|
title: Languages.of(context)!.aboutFromExch,
|
||||||
|
body: Languages.of(context)!.howFromExch,
|
||||||
|
image: Center(
|
||||||
|
child: Image.asset('assets/burza.png',
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PageViewModel(
|
||||||
|
title: Languages.of(context)!.warning,
|
||||||
|
body: Languages.of(context)!.notOfficial,
|
||||||
|
image: const Center(
|
||||||
|
child: Icon(Icons.warning_amber_outlined, size: 175),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
return Scaffold(
|
||||||
|
body: IntroductionScreen(
|
||||||
|
pages: listPagesViewModel,
|
||||||
|
next: Text(Languages.of(context)!.next),
|
||||||
|
done: Text(Languages.of(context)!.ok,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w600)),
|
||||||
|
onDone: () async {
|
||||||
|
const storage = FlutterSecureStorage();
|
||||||
|
await storage.write(key: "oc_souhlas", value: "ano");
|
||||||
|
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||||
|
builder: (c) => JidelnicekPage(canteen: widget.canteen)));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,8 +5,7 @@ import 'package:opencanteen/okna/burza.dart';
|
||||||
import 'lang/lang.dart';
|
import 'lang/lang.dart';
|
||||||
import 'okna/jidelnicek.dart';
|
import 'okna/jidelnicek.dart';
|
||||||
|
|
||||||
Drawer drawerGenerator(
|
Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
|
||||||
BuildContext context, Canteen canteen, String user, int p) {
|
|
||||||
Drawer drawer = const Drawer();
|
Drawer drawer = const Drawer();
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -29,7 +28,7 @@ Drawer drawerGenerator(
|
||||||
onTap: () => Navigator.push(
|
onTap: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => BurzaPage(canteen: canteen, user: user),
|
builder: (context) => BurzaPage(canteen: canteen),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -51,8 +50,7 @@ Drawer drawerGenerator(
|
||||||
onTap: () => Navigator.push(
|
onTap: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (c) =>
|
builder: (c) => JidelnicekPage(canteen: canteen))),
|
||||||
JidelnicekPage(canteen: canteen, user: user))),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.store),
|
leading: const Icon(Icons.store),
|
||||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -113,6 +113,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.2"
|
version: "0.7.2"
|
||||||
|
dots_indicator:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dots_indicator
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -226,6 +233,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.17.0"
|
version: "0.17.0"
|
||||||
|
introduction_screen:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: introduction_screen
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
10
pubspec.yaml
10
pubspec.yaml
|
@ -6,7 +6,7 @@ publish_to: 'none'
|
||||||
# The following defines the version and build number for your application.
|
# The following defines the version and build number for your application.
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
# A version number is three numbers separated by dots, like 1.2.43
|
||||||
# followed by an optional build number separated by a +.
|
# followed by an optional build number separated by a +.
|
||||||
version: 1.0.0+3
|
version: 1.1.0+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.16.1 <3.0.0"
|
sdk: ">=2.16.1 <3.0.0"
|
||||||
|
@ -22,6 +22,7 @@ dependencies:
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.0.20
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
shared_preferences: ^2.0.13
|
shared_preferences: ^2.0.13
|
||||||
|
introduction_screen: ^3.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^1.0.0
|
flutter_lints: ^1.0.0
|
||||||
|
@ -36,9 +37,10 @@ flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
# assets:
|
assets:
|
||||||
# - images/a_dot_burr.jpeg
|
- assets/burza.png
|
||||||
# - images/a_dot_ham.jpeg
|
- assets/doburzy.png
|
||||||
|
- assets/objednavam.png
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
# https://flutter.dev/assets-and-images/#resolution-aware.
|
||||||
|
|
Reference in a new issue