Compare commits

..

No commits in common. "64b7f261a029154dff9342b6ffec12cdda52fccd" and "26c6e4604e0b25b6b59af208bc55eb73837bd17c" have entirely different histories.

20 changed files with 1029 additions and 1317 deletions

@ -1 +1 @@
Subproject commit b06b8b2710955028a6b562f5aa6fe62941d6febf
Subproject commit 52b3dc25f6471c27b2144594abb11c741cb88f57

View file

@ -45,8 +45,6 @@ abstract class Languages {
// Jídelníček
String get todayTooltip;
String get loading;
String get monday;

View file

@ -244,7 +244,4 @@ class LanguageCz extends Languages {
@override
String get errorSaving =>
"Při ukládání offline nastala chyba, zkuste to znovu později.";
@override
String get todayTooltip => "Přejít na dnešní jídelníček";
}

View file

@ -242,7 +242,4 @@ class LanguageEn extends Languages {
@override
String get errorSaving =>
"An error occured while trying to save menu offline, try again later.";
@override
String get todayTooltip => "Go to today's meal";
}

View file

@ -2,7 +2,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class LoginManager {
static Future<Map<String, String>?> getDetails() async {
// check secure storage for details
// zkontrolovat secure storage pokud je něco uložené
const storage = FlutterSecureStorage();
var user = await storage.read(key: "oc_user");
var pass = await storage.read(key: "oc_pass");
@ -18,7 +18,7 @@ class LoginManager {
await storage.write(key: "oc_url", value: url);
}
static Future<bool> rememberme() async {
static Future<bool> zapamatovat() async {
const storage = FlutterSecureStorage();
return await storage.containsKey(key: "oc_pass");
}

View file

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@ -38,8 +37,7 @@ Copyright (C) 2022 Matyáš Caras a přispěvatelé
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
/// Used to setup notifications about ordered food
void setupNotification(SharedPreferences prefs, tz.Location l) async {
void oznamitPredem(SharedPreferences prefs, tz.Location l) async {
String title;
String locale = Intl.getCurrentLocale();
@ -52,24 +50,24 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
}
/*if (prefs.getBool("offline") ?? false) {
// TODO grab data from offline storage
// TODO možnost brát z offline dat
} else {*/
// data from the web
var d = await LoginManager.getDetails(); // grab login
// bere online
var d = await LoginManager.getDetails(); // získat údaje
if (d != null) {
var c = Canteen(d["url"]!);
if (await c.login(d["user"]!, d["pass"]!)) {
var jidla = await c.jidelnicekDen();
try {
var jidlo = jidla.jidla
.singleWhere((element) => element.objednano); // grab ordered meal
var jidlo = jidla.jidla.singleWhere(
(element) => element.objednano); // získá objednané jídlo
var kdy = DateTime.parse(prefs.getString(
"oznameni_cas")!); // save the time the notif should be sent
var cas = timeToDate(
"oznameni_cas")!); // uložíme čas, kdy se odeslat oznámení
var cas = casNaDate(
TimeOfDay(hour: kdy.hour, minute: kdy.minute),
);
if (cas.isBefore(DateTime.now())) return;
// notif data
// data o oznámení
const AndroidNotificationDetails androidSpec =
AndroidNotificationDetails('predobedem', 'Oznámení před obědem',
channelDescription: 'Oznámení o dnešním jídle',
@ -78,7 +76,7 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
styleInformation: BigTextStyleInformation(''),
ticker: 'today meal');
// plan through lib
// naplánovat
await flutterLocalNotificationsPlugin.zonedSchedule(
0,
title,
@ -89,7 +87,7 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime);
} on StateError catch (_) {
// no ordered meal found
// nenalezeno
}
}
// }
@ -104,10 +102,10 @@ void main() async {
var prefs = await SharedPreferences.getInstance();
if (prefs.getBool("oznamit") ?? false) {
setupNotification(prefs, l);
oznamitPredem(prefs, l);
}
// notif library setup
// nastavit oznámení
const AndroidInitializationSettings initializationSettingsAndroid =
AndroidInitializationSettings('notif_icon');
@ -117,6 +115,7 @@ void main() async {
InitializationSettings(android: initializationSettingsAndroid, iOS: ios);
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
// spustit aplikaci
runApp(const MyApp());
}
@ -125,38 +124,23 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return (Platform
.isAndroid) // run app based on current platform to make use of the platform's respective UI lib
? MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
AppLocalizationsDelegate(),
...GlobalMaterialLocalizations.delegates
],
supportedLocales: const [Locale("cs", ""), Locale("en", "")],
title: "OpenCanteen",
theme: ThemeData(
primarySwatch: Colors.purple,
),
darkTheme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.purple,
),
home: const LoginPage(),
)
: const CupertinoApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizationsDelegate(),
...GlobalMaterialLocalizations.delegates
],
supportedLocales: [Locale("cs", ""), Locale("en", "")],
title: "OpenCanteen",
theme: CupertinoThemeData(
primaryColor: Colors.purple,
),
home: LoginPage(),
);
return MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
AppLocalizationsDelegate(),
...GlobalMaterialLocalizations.delegates
],
supportedLocales: const [Locale("cs", ""), Locale("en", "")],
title: "OpenCanteen",
theme: ThemeData(
primarySwatch: Colors.purple,
),
darkTheme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.purple,
),
home: const LoginPage(),
);
}
}

View file

@ -1,8 +1,6 @@
import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/material.dart';
import 'package:opencanteen/okna/login.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformdialog.dart';
import 'package:opencanteen/util.dart';
import '../../lang/lang.dart';
@ -15,101 +13,100 @@ class BurzaView extends StatefulWidget {
}
class _BurzaViewState extends State<BurzaView> {
List<Widget> content = [];
double balance = 0.0;
Future<void> loadExchange(BuildContext context) async {
content = [const CircularProgressIndicator()];
var uzivatel = await widget.canteen.ziskejUzivatele().catchError((o) {
List<Widget> obsah = [];
double kredit = 0.0;
Future<void> nactiBurzu(BuildContext context) async {
obsah = [const CircularProgressIndicator()];
widget.canteen.ziskejUzivatele().then((kr) {
kredit = kr.kredit;
widget.canteen.ziskatBurzu().then((burza) {
setState(() {
obsah = [];
if (burza.isEmpty) {
obsah = [
Text(
Languages.of(context)!.noExchange,
style: const TextStyle(fontSize: 20),
),
Text(Languages.of(context)!.pullToReload)
];
} else {
for (var b in burza) {
obsah.add(
Padding(
padding: const EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("${b.den.day}. ${b.den.month}."),
const SizedBox(width: 10),
Flexible(
child: Text(
b.nazev,
),
),
Text("${b.pocet}x"),
TextButton(
onPressed: () {
widget.canteen.objednatZBurzy(b).then((a) {
if (a) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(Languages.of(context)!.ordered),
content: Text(
Languages.of(context)!.orderSuccess),
actions: [
TextButton(
child: Text(Languages.of(context)!.ok),
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
} else {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
Languages.of(context)!.cannotOrder),
content: Text(
Languages.of(context)!.errorOrdering),
actions: [
TextButton(
child: Text(Languages.of(context)!.ok),
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
}
nactiBurzu(context);
});
},
child: Text(Languages.of(context)!.order)),
],
),
),
);
}
}
});
});
}).catchError((o) {
if (!widget.canteen.prihlasen) {
Navigator.pushReplacement(
context, platformRouter((c) => const LoginPage()));
}
return Uzivatel(kredit: 0);
});
balance = uzivatel.kredit;
var burza = await widget.canteen.ziskatBurzu();
setState(() {
content = [];
if (burza.isEmpty) {
content = [
Text(
Languages.of(context)!.noExchange,
style: const TextStyle(fontSize: 20),
),
Text(Languages.of(context)!.pullToReload)
];
} else {
for (var b in burza) {
content.add(
Padding(
padding: const EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("${b.den.day}. ${b.den.month}."),
const SizedBox(width: 10),
Flexible(
child: Text(
b.nazev,
),
),
Text("${b.pocet}x"),
PlatformButton(
onPressed: () {
widget.canteen.objednatZBurzy(b).then(
(a) {
if (a) {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.ordered,
content: Languages.of(context)!.orderSuccess,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
} else {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.cannotOrder,
content: Languages.of(context)!.errorOrdering,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
],
),
);
}
loadExchange(context);
},
);
},
text: Languages.of(context)!.order,
),
],
),
),
);
}
context, MaterialPageRoute(builder: (c) => const LoginPage()));
}
});
return;
}
@override
void initState() {
super.initState();
loadExchange(context);
nactiBurzu(context);
}
@override
@ -126,20 +123,20 @@ class _BurzaViewState extends State<BurzaView> {
child: Column(
children: [
const SizedBox(height: 10),
Text("${Languages.of(context)!.balance}$balance"),
Text("${Languages.of(context)!.balance}$kredit"),
const SizedBox(height: 10),
SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: SizedBox(
height: MediaQuery.of(context).size.height / 1.3,
child: Column(children: content),
child: Column(children: obsah),
),
)
],
),
),
),
onRefresh: () => loadExchange(context)),
onRefresh: () => nactiBurzu(context)),
);
}
}

View file

@ -6,8 +6,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:opencanteen/okna/login.dart';
import 'package:opencanteen/okna/nastaveni.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformdialog.dart';
import 'package:opencanteen/util.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
@ -16,25 +14,25 @@ import 'package:url_launcher/url_launcher.dart';
import '../../lang/lang.dart';
class MealView extends StatefulWidget {
const MealView({Key? key, required this.canteen}) : super(key: key);
class JidelnicekView extends StatefulWidget {
const JidelnicekView({Key? key, required this.canteen}) : super(key: key);
final Canteen canteen;
@override
State<MealView> createState() => _MealViewState();
State<JidelnicekView> createState() => _JidelnicekViewState();
}
class _MealViewState extends State<MealView> {
List<Widget> content = [const CircularProgressIndicator()];
DateTime day = DateTime.now();
String dayOWeek = "";
double balance = 0.0;
class _JidelnicekViewState extends State<JidelnicekView> {
List<Widget> obsah = [const CircularProgressIndicator()];
DateTime den = DateTime.now();
String denTydne = "";
double kredit = 0.0;
bool _skipWeekend = false;
void checkWeek(BuildContext context) async {
void kontrolaTyden(BuildContext context) async {
var prefs = await SharedPreferences.getInstance();
if (prefs.getBool("tyden") ?? false) {
// Check if user has ordered a meal in the next week
var pristi = day.add(const Duration(days: 6));
// Zjistit jestli je objednáno na přístí týden
var pristi = den.add(const Duration(days: 6));
for (var i = 0; i < 5; i++) {
var jidelnicek = await widget.canteen
.jidelnicekDen(den: pristi.add(Duration(days: i + 1)));
@ -49,8 +47,8 @@ class _MealViewState extends State<MealView> {
action: SnackBarAction(
onPressed: () => setState(
() {
day = pristi.add(Duration(days: i + 1));
loadMeals();
den = pristi.add(Duration(days: i + 1));
nactiJidlo();
},
),
label: Languages.of(context)!.jump,
@ -63,295 +61,288 @@ class _MealViewState extends State<MealView> {
}
}
Future<void> loadMeals() async {
content = [const CircularProgressIndicator()];
switch (day.weekday) {
Future<void> nactiJidlo() async {
obsah = [const CircularProgressIndicator()];
switch (den.weekday) {
case 2:
dayOWeek = Languages.of(context)!.tuesday;
denTydne = Languages.of(context)!.tuesday;
break;
case 3:
dayOWeek = Languages.of(context)!.wednesday;
denTydne = Languages.of(context)!.wednesday;
break;
case 4:
dayOWeek = Languages.of(context)!.thursday;
denTydne = Languages.of(context)!.thursday;
break;
case 5:
dayOWeek = Languages.of(context)!.friday;
denTydne = Languages.of(context)!.friday;
break;
case 6:
dayOWeek = Languages.of(context)!.saturday;
denTydne = Languages.of(context)!.saturday;
break;
case 7:
dayOWeek = Languages.of(context)!.sunday;
denTydne = Languages.of(context)!.sunday;
break;
default:
dayOWeek = Languages.of(context)!.monday;
denTydne = Languages.of(context)!.monday;
}
var uzivatel = await widget.canteen.ziskejUzivatele().catchError(
(o) {
if (!widget.canteen.prihlasen) {
Navigator.pushReplacement(
context, platformRouter((c) => const LoginPage()));
}
return Uzivatel(kredit: 0);
},
);
balance = uzivatel.kredit;
var jd = await widget.canteen.jidelnicekDen(den: day).catchError((_) {
showInfo(context, Languages.of(context)!.errorContacting);
return Jidelnicek(DateTime.now(), []);
});
setState(
() {
content = [];
if (jd.jidla.isEmpty) {
content.add(Text(
Languages.of(context)!.noFood,
style: const TextStyle(fontSize: 15),
));
} else {
for (var j in jd.jidla) {
content.add(
Padding(
padding: const EdgeInsets.only(top: 15),
child: InkWell(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(j.varianta),
const SizedBox(width: 10),
Flexible(
child: Text(
j.nazev,
widget.canteen.ziskejUzivatele().then((kr) {
kredit = kr.kredit;
widget.canteen.jidelnicekDen(den: den).then((jd) async {
setState(() {
obsah = [];
if (jd.jidla.isEmpty) {
obsah.add(Text(
Languages.of(context)!.noFood,
style: const TextStyle(fontSize: 15),
));
} else {
for (var j in jd.jidla) {
obsah.add(
Padding(
padding: const EdgeInsets.only(top: 15),
child: InkWell(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(j.varianta),
const SizedBox(width: 10),
Flexible(
child: Text(
j.nazev,
),
),
),
Text((j.naBurze)
? Languages.of(context)!.inExchange
: "${j.cena}"),
Checkbox(
value: j.objednano,
fillColor: (j.lzeObjednat)
? MaterialStateProperty.all(Colors.purple)
: MaterialStateProperty.all(Colors.grey),
onChanged: (v) async {
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (context) {
return PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(
children: [
Text((j.naBurze)
? Languages.of(context)!.inExchange
: "${j.cena}"),
Checkbox(
value: j.objednano,
fillColor: (j.lzeObjednat)
? MaterialStateProperty.all(Colors.purple)
: MaterialStateProperty.all(Colors.grey),
onChanged: (v) async {
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(Languages.of(context)!
.errorOrdering),
content: Text(
Languages.of(context)!.cannotOrder),
actions: [
TextButton(
child:
Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
});
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child:
CircularProgressIndicator(),
),
Text(Languages.of(context)!
.ordering)
]),
),
));
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true)
.pop();
nactiJidlo();
}).catchError((o) {
Navigator.of(context, rootNavigator: true)
.pop();
showDialog(
context: context,
builder: (bc) => AlertDialog(
title: Text(Languages.of(context)!
.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child: Text(
Languages.of(context)!
.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
));
});
}
})
],
),
onTap: () async {
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title:
Text(Languages.of(context)!.errorOrdering),
content:
Text(Languages.of(context)!.cannotOrder),
actions: [
TextButton(
child: Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
});
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
],
]),
),
),
),
);
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true).pop();
loadMeals();
}).catchError(
(o) {
Navigator.of(context, rootNavigator: true)
.pop();
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
)
],
),
);
},
);
}
},
)
],
),
onTap: () async {
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (context) {
return PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
]),
),
),
);
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true).pop();
loadMeals();
}).catchError(
(o) {
));
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true).pop();
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
)
],
),
);
},
);
}
},
onLongPress: () async {
if (!j.objednano || j.burzaUrl == null) return;
if (!j.naBurze) {
// if not in exchange, we ask
var d = await showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.verifyExchange,
actions: [
PlatformButton(
onPressed: () {
Navigator.pop(bc, true);
},
text: Languages.of(context)!.yes,
),
PlatformButton(
onPressed: () {
Navigator.pop(bc, false);
},
text: Languages.of(context)!.no,
),
],
),
);
if (d) {
widget.canteen
.doBurzy(j)
.then((_) => loadMeals())
.catchError((o) {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.exchangeError,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
)
],
),
);
});
nactiJidlo();
}).catchError(
(o) {
Navigator.of(context, rootNavigator: true).pop();
showDialog(
context: context,
builder: (bc) => AlertDialog(
title:
Text(Languages.of(context)!.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child: Text(Languages.of(context)!.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
),
);
},
);
}
} else {
// else no
widget.canteen.doBurzy(j).then((_) => loadMeals());
}
},
},
onLongPress: () async {
if (!j.objednano || j.burzaUrl == null) return;
if (!j.naBurze) {
// pokud není na burze, radši se zeptáme
var d = await showDialog(
context: context,
builder: (bc) => SimpleDialog(
title: Text(
Languages.of(context)!.verifyExchange),
children: [
SimpleDialogOption(
onPressed: () {
Navigator.pop(bc, true);
},
child: Text(Languages.of(context)!.yes),
),
SimpleDialogOption(
onPressed: () {
Navigator.pop(bc, false);
},
child: Text(Languages.of(context)!.no),
),
],
));
if (d) {
widget.canteen
.doBurzy(j)
.then((_) => nactiJidlo())
.catchError((o) {
showDialog(
context: context,
builder: (bc) => AlertDialog(
title:
Text(Languages.of(context)!.exchangeError),
content: SingleChildScrollView(
child: Text(o.toString())),
actions: [
TextButton(
child: Text(Languages.of(context)!.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
),
);
});
}
} else {
// jinak ne
widget.canteen.doBurzy(j).then((_) => nactiJidlo());
}
},
),
),
),
);
);
}
}
}
},
);
return;
});
});
}).catchError((o) {
if (!widget.canteen.prihlasen) {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (c) => const LoginPage()));
}
});
}
Future<void> click(String value, BuildContext context) async {
Future<void> kliknuti(String value, BuildContext context) async {
if (value == Languages.of(context)!.signOut) {
await showDialog<bool>(
context: context,
builder: (c) => PlatformDialog(
title: Languages.of(context)!.warning,
content: Languages.of(context)!.signOutWarn,
builder: (c) => AlertDialog(
title: Text(Languages.of(context)!.warning),
content: Text(Languages.of(context)!.signOutWarn),
actions: [
PlatformButton(
TextButton(
onPressed: () {
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushAndRemoveUntil(
context,
platformRouter((c) => const LoginPage()),
MaterialPageRoute(builder: (c) => const LoginPage()),
(route) => false);
},
text: Languages.of(context)!.yes),
PlatformButton(
onPressed: () => Navigator.of(context).pop(),
text: Languages.of(context)!.no,
)
child: Text(Languages.of(context)!.yes)),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(Languages.of(context)!.no))
],
),
);
} else if (value == Languages.of(context)!.review) {
launchUrl(
Uri.parse((Platform.isAndroid)
? "market://details?id=cz.hernikplays.opencanteen"
: "https://apps.apple.com/cz/app/opencanteen/id1621124445"),
launchUrl(Uri.parse("market://details?id=cz.hernikplays.opencanteen"),
mode: LaunchMode.externalApplication);
} else if (value == Languages.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
@ -366,29 +357,28 @@ class _MealViewState extends State<MealView> {
"${Languages.of(context)!.copyright}\n${Languages.of(context)!.license}",
applicationVersion: packageInfo.version,
children: [
PlatformButton(
onPressed: (() => launchUrl(
Uri.parse("https://git.mnau.xyz/hernik/opencanteen"),
mode: LaunchMode.externalApplication)),
text: Languages.of(context)!.source,
)
TextButton(
onPressed: (() => launchUrl(
Uri.parse("https://git.mnau.xyz/hernik/opencanteen"))),
child: Text(Languages.of(context)!.source))
]);
} else if (value == Languages.of(context)!.settings) {
Navigator.push(context, platformRouter((c) => const AndroidNastaveni()));
Navigator.push(
context, MaterialPageRoute(builder: (c) => const AndroidNastaveni()));
}
}
void loadSettings() async {
void nactiNastaveni() async {
var prefs = await SharedPreferences.getInstance();
_skipWeekend = prefs.getBool("skip") ?? false;
if (!mounted) return;
checkWeek(context);
kontrolaTyden(context);
}
void saveOffline() async {
void ulozitDoOffline() async {
var prefs = await SharedPreferences.getInstance();
if (prefs.getBool("offline") ?? false) {
// clear offline storage
// vyčistit offline
Directory appDocDir = await getApplicationDocumentsDirectory();
for (var f in appDocDir.listSync()) {
if (f.path.contains("jidelnicek")) {
@ -396,11 +386,11 @@ class _MealViewState extends State<MealView> {
}
}
// save X meal lists
// uložit *pocet* jídelníčků pro offline použití
var pocet = prefs.getInt("offline_pocet") ?? 1;
if (pocet > 7) pocet = 7;
for (var i = 0; i < pocet; i++) {
var d = day.add(Duration(days: i));
var d = den.add(Duration(days: i));
Jidelnicek? j;
try {
j = await widget.canteen.jidelnicekDen(den: d);
@ -437,9 +427,9 @@ class _MealViewState extends State<MealView> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
loadSettings();
saveOffline();
loadMeals();
nactiNastaveni();
ulozitDoOffline();
nactiJidlo();
}
@override
@ -450,7 +440,7 @@ class _MealViewState extends State<MealView> {
title: Text(Languages.of(context)!.menu),
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
onSelected: ((String value) => kliknuti(value, context)),
itemBuilder: (BuildContext context) {
return {
Languages.of(context)!.reportBugs,
@ -469,71 +459,62 @@ class _MealViewState extends State<MealView> {
],
),
body: RefreshIndicator(
onRefresh: loadMeals,
onRefresh: nactiJidlo,
child: Center(
child: SizedBox(
width: MediaQuery.of(context).size.width - 50,
child: Column(
children: [
const SizedBox(height: 10),
Text("${Languages.of(context)!.balance}$balance"),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
setState(() {
day = day.subtract(const Duration(days: 1));
if (day.weekday == 7 && _skipWeekend) {
day = day.subtract(const Duration(days: 2));
}
loadMeals();
});
},
icon: const Icon(Icons.arrow_left)),
PlatformButton(
Text("${Languages.of(context)!.balance}$kredit"),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
IconButton(
onPressed: () {
setState(() {
den = den.subtract(const Duration(days: 1));
if (den.weekday == 7 && _skipWeekend) {
den = den.subtract(const Duration(days: 2));
}
nactiJidlo();
});
},
icon: const Icon(Icons.arrow_left)),
TextButton(
onPressed: () async {
var datePicked = await showDatePicker(
context: context,
initialDate: day,
currentDate: day,
initialDate: den,
currentDate: den,
firstDate: DateTime(2019, 1, 1),
lastDate: DateTime(day.year + 1, 12, 31),
lastDate: DateTime(den.year + 1, 12, 31),
locale: Localizations.localeOf(context));
if (datePicked == null) return;
setState(() {
day = datePicked;
loadMeals();
den = datePicked;
nactiJidlo();
});
},
text: "${day.day}. ${day.month}. ${day.year} - $dayOWeek",
),
IconButton(
onPressed: () {
setState(() {
day = day.add(const Duration(days: 1));
if (day.weekday == 6 && _skipWeekend) {
day = day.add(const Duration(days: 2));
}
loadMeals();
});
},
icon: const Icon(Icons.arrow_right),
),
Tooltip(
message: Languages.of(context)!.todayTooltip,
child: IconButton(
onPressed: () => setState(
() {
day = DateTime.now();
loadMeals();
},
),
icon: const Icon(Icons.today),
),
)
],
),
child: Text(
"${den.day}. ${den.month}. ${den.year} - $denTydne")),
IconButton(
onPressed: () {
setState(() {
den = den.add(const Duration(days: 1));
if (den.weekday == 6 && _skipWeekend) {
den = den.add(const Duration(days: 2));
}
nactiJidlo();
});
},
icon: const Icon(Icons.arrow_right),
),
IconButton(
onPressed: () => setState(() {
den = DateTime.now();
nactiJidlo();
}),
icon: const Icon(Icons.today))
]),
SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: GestureDetector(
@ -543,27 +524,25 @@ class _MealViewState extends State<MealView> {
.onPrimary
.withOpacity(0),
height: MediaQuery.of(context).size.height / 1.3,
child: Column(children: content),
child: Column(children: obsah),
),
onHorizontalDragEnd: (details) {
if (details.primaryVelocity?.compareTo(0) == -1) {
setState(() {
day = day.add(const Duration(days: 1));
if (day.weekday == 6 && _skipWeekend) {
day = day.add(const Duration(days: 2));
den = den.add(const Duration(days: 1));
if (den.weekday == 6 && _skipWeekend) {
den = den.add(const Duration(days: 2));
}
loadMeals();
nactiJidlo();
});
} else {
setState(
() {
day = day.subtract(const Duration(days: 1));
if (day.weekday == 7 && _skipWeekend) {
day = day.subtract(const Duration(days: 2));
}
loadMeals();
},
);
setState(() {
den = den.subtract(const Duration(days: 1));
if (den.weekday == 7 && _skipWeekend) {
den = den.subtract(const Duration(days: 2));
}
nactiJidlo();
});
}
},
),

View file

@ -1,17 +1,16 @@
import 'dart:io';
import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:opencanteen/okna/welcome.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformfield.dart';
import '../../lang/lang.dart';
import '../../loginmanager.dart';
import '../../main.dart';
import '../../util.dart';
import '../pw/platformswitch.dart';
import 'jidelnicek.dart';
import 'offline_jidelnicek.dart';
@ -33,14 +32,14 @@ class _LoginPageState extends State<LoginPage> {
void initState() {
super.initState();
LoginManager.getDetails().then((r) async {
// request android notification access
// žádat o oprávnění na android
flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestPermission();
if (r != null) {
// Autologin
// Automaticky přihlásit
showDialog(
context: context,
barrierDismissible: false,
@ -75,26 +74,36 @@ class _LoginPageState extends State<LoginPage> {
if (odsouhlasil == null || odsouhlasil != "ano") {
Navigator.pushAndRemoveUntil(
context,
platformRouter(
(c) => WelcomePage(canteen: canteen),
MaterialPageRoute(
builder: (c) => WelcomePage(canteen: canteen),
),
(route) => false);
} else {
Navigator.pushAndRemoveUntil(
context,
platformRouter(
(context) => MealView(canteen: canteen),
MaterialPageRoute(
builder: (context) => JidelnicekView(canteen: canteen),
),
(route) => false);
}
} on PlatformException {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, Languages.of(context)!.corrupted);
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(Languages.of(context)!.corrupted),
),
);
} catch (_) {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, Languages.of(context)!.errorContacting);
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(Languages.of(context)!.errorContacting),
),
);
goOffline();
}
}
@ -104,150 +113,169 @@ class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Languages.of(context)!.logIn),
automaticallyImplyLeading: false,
),
body: Center(
child: SingleChildScrollView(
child: SizedBox(
width: MediaQuery.of(context).size.width - 50,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
Languages.of(context)!.appName,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 40),
),
Text(
Languages.of(context)!.logIn,
textAlign: TextAlign.center,
),
PlatformField(
controller: userControl,
autofillHints: const [AutofillHints.username],
labelText: Languages.of(context)!.username,
),
PlatformField(
autofillHints: const [AutofillHints.password],
labelText: Languages.of(context)!.password,
controller: passControl,
obscureText: true,
),
const SizedBox(
height: 10,
),
DropdownButton(
isExpanded: true,
value: dropdownUrl,
items: instance.map<DropdownMenuItem<String>>((e) {
return DropdownMenuItem<String>(
value: e["url"],
child: Text(e["name"]!),
);
}).toList(),
onChanged: (String? value) {
setState(() {
if (value == "") {
_showUrl = true;
} else {
_showUrl = false;
}
dropdownUrl = value!;
});
},
),
AnimatedOpacity(
opacity: _showUrl ? 1.0 : 0.0,
duration: const Duration(milliseconds: 300),
child: PlatformField(
autofillHints: const [AutofillHints.url],
labelText: Languages.of(context)!.iCanteenUrl,
keyboardType: TextInputType.url,
controller: canteenControl,
appBar: AppBar(
title: Text(Languages.of(context)!.logIn),
automaticallyImplyLeading: false,
),
body: Center(
child: SingleChildScrollView(
child: SizedBox(
width: MediaQuery.of(context).size.width - 50,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
Languages.of(context)!.appName,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 40),
),
),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
PlatformSwitch(
value: rememberMe,
onChanged: (value) {
Text(
Languages.of(context)!.logIn,
textAlign: TextAlign.center,
),
TextField(
controller: userControl,
autofillHints: const [AutofillHints.username],
decoration: InputDecoration(
labelText: Languages.of(context)!.username),
),
TextField(
autofillHints: const [AutofillHints.password],
decoration: InputDecoration(
labelText: Languages.of(context)!.password),
controller: passControl,
obscureText: true,
),
const SizedBox(
height: 10,
),
DropdownButton(
isExpanded: true,
value: dropdownUrl,
items: instance.map<DropdownMenuItem<String>>((e) {
return DropdownMenuItem<String>(
value: e["url"],
child: Text(e["name"]!),
);
}).toList(),
onChanged: (String? value) {
setState(() {
rememberMe = value;
if (value == "") {
_showUrl = true;
} else {
_showUrl = false;
}
dropdownUrl = value!;
});
},
),
Text(Languages.of(context)!.rememberMe)
]),
PlatformButton(
onPressed: () async {
var canteenUrl = (dropdownUrl == "")
? canteenControl.text
: dropdownUrl;
if (!canteenUrl.startsWith("https://") &&
!canteenUrl.startsWith("http://")) {
canteenUrl = "https://$canteenUrl";
}
var canteen = Canteen(canteenUrl);
try {
var l = await canteen.login(
userControl.text, passControl.text);
if (!l) {
AnimatedOpacity(
opacity: _showUrl ? 1.0 : 0.0,
duration: const Duration(milliseconds: 300),
child: TextField(
autofillHints: const [AutofillHints.url],
decoration: InputDecoration(
labelText: Languages.of(context)!.iCanteenUrl),
keyboardType: TextInputType.url,
controller: canteenControl,
),
),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Switch(
value: rememberMe,
onChanged: (value) {
setState(() {
rememberMe = value;
});
}),
Text(Languages.of(context)!.rememberMe)
]),
TextButton(
onPressed: () async {
var canteenUrl = (dropdownUrl == "")
? canteenControl.text
: dropdownUrl;
if (!canteenUrl.startsWith("https://") &&
!canteenUrl.startsWith("http://")) {
canteenUrl = "https://$canteenUrl";
}
var canteen = Canteen(canteenUrl);
try {
var l = await canteen.login(
userControl.text, passControl.text);
if (!l) {
if (!mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(Languages.of(context)!.loginFailed),
),
);
return;
}
if (rememberMe) {
LoginManager.setDetails(
userControl.text, passControl.text, canteenUrl);
}
// souhlas
const storage = FlutterSecureStorage();
var odsouhlasil =
await storage.read(key: "oc_souhlas");
if (!mounted) return;
showInfo(context, Languages.of(context)!.loginFailed);
return;
if (odsouhlasil == null || odsouhlasil != "ano") {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (c) => WelcomePage(
canteen: canteen,
)),
(route) => false);
} else {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => JidelnicekView(
canteen: canteen,
)),
(route) => false);
}
} on PlatformException {
if (!mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(Languages.of(context)!.corrupted),
),
);
} on Exception catch (_) {
if (!mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(Languages.of(context)!.errorContacting),
),
);
goOffline();
}
if (rememberMe) {
LoginManager.setDetails(
userControl.text, passControl.text, canteenUrl);
}
// souhlas
const storage = FlutterSecureStorage();
var odsouhlasil = await storage.read(key: "oc_souhlas");
if (!mounted) return;
if (odsouhlasil == null || odsouhlasil != "ano") {
Navigator.pushAndRemoveUntil(
context,
platformRouter(
(context) => WelcomePage(
canteen: canteen,
),
),
(route) => false);
} else {
Navigator.pushAndRemoveUntil(
context,
platformRouter(
(context) => MealView(
canteen: canteen,
),
),
(route) => false);
}
} on PlatformException {
if (!mounted) return;
showInfo(context, Languages.of(context)!.corrupted);
} on Exception catch (_) {
if (!mounted) return;
showInfo(
context, Languages.of(context)!.errorContacting);
//goOffline();
}
},
text: Languages.of(context)!.logIn),
],
},
child: Text(Languages.of(context)!.logIn)),
],
),
),
),
),
),
);
));
}
/// Switch to offline view
/// Získá offline soubor a zobrazí údaje
void goOffline() async {
if (!mounted) return;
Navigator.pushAndRemoveUntil(context,
platformRouter((context) => const OfflineMealView()), (route) => false);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: ((context) => const AndroidOfflineJidelnicek())),
(route) => false);
}
}

View file

@ -5,10 +5,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformdialog.dart';
import 'package:opencanteen/pw/platformfield.dart';
import 'package:opencanteen/pw/platformswitch.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:timezone/timezone.dart' as tz;
@ -26,48 +22,45 @@ class AndroidNastaveni extends StatefulWidget {
}
class _AndroidNastaveniState extends State<AndroidNastaveni> {
bool _saveOffline = false;
bool _skipWeekend = false;
bool _checkWeek = false;
bool _notifyMeal = false;
bool _remember = false;
TimeOfDay _notifTime = TimeOfDay.now();
bool _ukladatOffline = false;
bool _preskakovatVikend = false;
bool _kontrolovatTyden = false;
bool _oznameniObed = false;
bool _zapamatovany = false;
TimeOfDay _oznameniCas = TimeOfDay.now();
final TextEditingController _countController =
TextEditingController(text: "1");
SharedPreferences? preferences;
void loadSettings() async {
void najitNastaveni() async {
preferences = await SharedPreferences.getInstance();
_remember = await LoginManager.rememberme();
setState(
() {
_saveOffline = preferences!.getBool("offline") ?? false;
_skipWeekend = preferences!.getBool("skip") ?? false;
_checkWeek = preferences!.getBool("tyden") ?? false;
_notifyMeal = preferences!.getBool("oznamit") ?? false;
_countController.text =
(preferences!.getInt("offline_pocet") ?? 1).toString();
var casStr = preferences!.getString("oznameni_cas");
if (casStr == null) {
var now = DateTime.now();
_notifTime = TimeOfDay.fromDateTime(
DateTime.now().add(const Duration(hours: 1)));
preferences!.setString("oznameni_cas", now.toString());
} else {
_notifTime = TimeOfDay.fromDateTime(DateTime.parse(casStr));
}
},
);
_zapamatovany = await LoginManager.zapamatovat();
setState(() {
_ukladatOffline = preferences!.getBool("offline") ?? false;
_preskakovatVikend = preferences!.getBool("skip") ?? false;
_kontrolovatTyden = preferences!.getBool("tyden") ?? false;
_oznameniObed = preferences!.getBool("oznamit") ?? false;
_countController.text =
(preferences!.getInt("offline_pocet") ?? 1).toString();
var casStr = preferences!.getString("oznameni_cas");
if (casStr == null) {
var now = DateTime.now();
_oznameniCas = TimeOfDay.fromDateTime(
DateTime.now().add(const Duration(hours: 1)));
preferences!.setString("oznameni_cas", now.toString());
} else {
_oznameniCas = TimeOfDay.fromDateTime(DateTime.parse(casStr));
}
});
}
void changeSetting(String key, bool value) async {
void zmenitNastaveni(String key, bool value) async {
preferences!.setBool(key, value);
}
@override
void initState() {
super.initState();
loadSettings();
najitNastaveni();
}
@override
@ -77,168 +70,168 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
title: Text(Languages.of(context)!.settings),
),
body: Center(
child: SizedBox(
width: MediaQuery.of(context).size.width / 1.1,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveOffline),
PlatformSwitch(
value: _saveOffline,
child: SizedBox(
width: MediaQuery.of(context).size.width / 1.1,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveOffline),
Switch(
value: _ukladatOffline,
activeColor: Colors.purple,
onChanged: (value) {
setState(() {
_saveOffline = value;
clear(value);
changeSetting("offline", value);
_ukladatOffline = value;
cistit(value);
zmenitNastaveni("offline", value);
});
})
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveCount),
SizedBox(
width: 35,
child: TextField(
controller: _countController,
enabled: _ukladatOffline,
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
onChanged: (c) {
var cislo = int.tryParse(c);
if (cislo != null) {
preferences!.setInt("offline_pocet", cislo);
}
},
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveCount),
SizedBox(
width: 35,
child: PlatformField(
controller: _countController,
enabled: _saveOffline,
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
onChanged: (c) {
var cislo = int.tryParse(c);
if (cislo != null) {
preferences!.setInt("offline_pocet", cislo);
}
},
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.skipWeekend),
PlatformSwitch(
value: _skipWeekend,
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.skipWeekend),
Switch(
activeColor: Colors.purple,
value: _preskakovatVikend,
onChanged: (value) {
setState(
() {
_skipWeekend = value;
changeSetting("skip", value);
},
);
},
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.checkOrdered)),
PlatformSwitch(
value: _checkWeek,
setState(() {
_preskakovatVikend = value;
zmenitNastaveni("skip", value);
});
})
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.checkOrdered)),
Switch(
activeColor: Colors.purple,
value: _kontrolovatTyden,
onChanged: (value) {
setState(
() {
_checkWeek = value;
changeSetting("tyden", value);
},
);
},
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.notifyLunch)),
PlatformSwitch(
value: _notifyMeal,
thumbColor: (!_remember ? Colors.grey : null),
setState(() {
_kontrolovatTyden = value;
zmenitNastaveni("tyden", value);
});
})
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.notifyLunch)),
Switch(
activeColor: Colors.purple,
value: _oznameniObed,
thumbColor: (!_zapamatovany
? MaterialStateProperty.all(Colors.grey)
: null),
onChanged: (value) {
if (!_remember) {
if (!_zapamatovany) {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.error,
content: Languages.of(context)!.needRemember,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
)
],
),
);
context: context,
builder: (bc) => AlertDialog(
title: Text(Languages.of(context)!.error),
content:
Text(Languages.of(context)!.needRemember),
actions: [
TextButton(
child: Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
));
} else {
setState(() {
_notifyMeal = value;
if (_notifyMeal) {
_oznameniObed = value;
if (_oznameniObed) {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.warning,
content: Languages.of(context)!.notifyWarning,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
)
],
),
);
createNotif(timeToDate(_notifTime));
context: context,
builder: (context) => AlertDialog(
title:
Text(Languages.of(context)!.warning),
content: Text(
Languages.of(context)!.notifyWarning),
actions: [
TextButton(
child:
Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
));
vytvoritOznameni(casNaDate(_oznameniCas));
}
changeSetting("oznamit", value);
zmenitNastaveni("oznamit", value);
});
}
},
)
],
),
Text(Languages.of(context)!.notifyAt),
PlatformButton(
onPressed: () async {
if (_notifyMeal) {
var cas = await showTimePicker(
context: context, initialTime: _notifTime);
if (cas != null) {
var prefs = await SharedPreferences.getInstance();
prefs.setString(
"oznameni_cas",
timeToDate(cas)
.toString()); // aktualizovat vybraný čas
var den = timeToDate(cas);
debugPrint(den.isAfter(DateTime.now()).toString());
if (den.isAfter(DateTime.now())) {
// znovu vytvořit oznámení POUZE když je čas v budoucnosti
createNotif(den);
}
})
],
),
Text(Languages.of(context)!.notifyAt),
TextButton(
onPressed: () async {
if (_oznameniObed) {
var cas = await showTimePicker(
context: context, initialTime: _oznameniCas);
if (cas != null) {
var prefs = await SharedPreferences.getInstance();
prefs.setString("oznameni_cas",
casNaDate(cas).toString()); // aktualizovat vybraný čas
var den = casNaDate(cas);
debugPrint(den.isAfter(DateTime.now()).toString());
if (den.isAfter(DateTime.now())) {
// znovu vytvořit oznámení POUZE když je čas v budoucnosti
vytvoritOznameni(den);
}
setState(() {
_notifTime = cas ?? _notifTime;
});
}
},
text:
"${(_notifTime.hour < 10 ? "0" : "") + _notifTime.hour.toString()}:${(_notifTime.minute < 10 ? "0" : "") + _notifTime.minute.toString()}",
setState(() {
_oznameniCas = cas ?? _oznameniCas;
});
}
},
child: Text(
"${(_oznameniCas.hour < 10 ? "0" : "") + _oznameniCas.hour.toString()}:${(_oznameniCas.minute < 10 ? "0" : "") + _oznameniCas.minute.toString()}",
style: TextStyle(
color: (!_oznameniObed) ? Colors.grey : Colors.purple),
),
],
),
),
],
),
),
)),
);
}
void clear(bool value) async {
void cistit(bool value) async {
if (!value) {
Directory appDocDir = await getApplicationDocumentsDirectory();
for (var f in appDocDir.listSync()) {
@ -250,10 +243,11 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
}
}
void createNotif(DateTime den) async {
void vytvoritOznameni(DateTime den) async {
await flutterLocalNotificationsPlugin.cancelAll();
var d = await LoginManager.getDetails(); // grab details
var d = await LoginManager.getDetails(); // získat údaje
if (d != null) {
// Nové oznámení
var c = Canteen(d["url"]!);
if (await c.login(d["user"]!, d["pass"]!)) {
var jidla = await c.jidelnicekDen();
@ -270,7 +264,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
tz.getLocation(await FlutterNativeTimezone.getLocalTimezone());
if (!mounted) return;
await flutterLocalNotificationsPlugin.zonedSchedule(
// schedules a notification
// Vytvoří nové oznámení pro daný čas a datum
0,
Languages.of(context)!.lunchNotif,
"${jidlo.varianta} - ${jidlo.nazev}",
@ -280,7 +274,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime);
} on StateError catch (_) {
// no meal found
// nenalezeno
}
}
}

View file

@ -4,7 +4,6 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:opencanteen/okna/login.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/util.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
@ -13,90 +12,90 @@ import 'package:url_launcher/url_launcher.dart';
import '../../lang/lang.dart';
class OfflineMealView extends StatefulWidget {
const OfflineMealView({Key? key}) : super(key: key);
class AndroidOfflineJidelnicek extends StatefulWidget {
const AndroidOfflineJidelnicek({Key? key}) : super(key: key);
@override
State<OfflineMealView> createState() => _OfflineMealViewState();
State<AndroidOfflineJidelnicek> createState() =>
_AndroidOfflineJidelnicekState();
}
class _OfflineMealViewState extends State<OfflineMealView> {
List<Widget> content = [const CircularProgressIndicator()]; // view content
var _skipWeekend = false; // skip weekend setting
DateTime currentDay = DateTime.now(); // the day we are supposed to show
String dayOWeek = ""; // the name of the day (to show to user)
List<List<OfflineMeal>> data = []; // meal data
var mealIndex = 0; // index of the currently shown day
class _AndroidOfflineJidelnicekState extends State<AndroidOfflineJidelnicek> {
List<Widget> obsah = [const CircularProgressIndicator()];
var _skipWeekend = false;
DateTime den = DateTime.now();
String denTydne = "";
List<List<OfflineJidlo>> data = [];
var jidloIndex = 0;
/// Loads the offline data from local storage
void loadFromFile() async {
void nactiZeSouboru() async {
Directory appDocDir = await getApplicationDocumentsDirectory();
for (var f in appDocDir.listSync()) {
if (f.path.contains("jidelnicek")) {
var soubor = File(f.path);
var input = await soubor.readAsString();
var r = jsonDecode(input);
List<OfflineMeal> jidla = [];
List<OfflineJidlo> jidla = [];
for (var j in r) {
jidla.add(OfflineMeal(
name: j["nazev"],
variant: j["varianta"],
ordered: j["objednano"],
price: j["cena"],
onExchange: j["naBurze"],
day: DateTime.parse(j["den"])));
jidla.add(OfflineJidlo(
nazev: j["nazev"],
varianta: j["varianta"],
objednano: j["objednano"],
cena: j["cena"],
naBurze: j["naBurze"],
den: DateTime.parse(j["den"])));
}
data.add(jidla);
}
}
loadFood();
nactiJidlo();
}
Future<void> loadFood() async {
var jidelnicek = data[mealIndex];
currentDay = jidelnicek[0].day;
switch (currentDay.weekday) {
Future<void> nactiJidlo() async {
var jidelnicek = data[jidloIndex];
den = jidelnicek[0].den;
switch (den.weekday) {
case 2:
dayOWeek = Languages.of(context)!.tuesday;
denTydne = Languages.of(context)!.tuesday;
break;
case 3:
dayOWeek = Languages.of(context)!.wednesday;
denTydne = Languages.of(context)!.wednesday;
break;
case 4:
dayOWeek = Languages.of(context)!.thursday;
denTydne = Languages.of(context)!.thursday;
break;
case 5:
dayOWeek = Languages.of(context)!.friday;
denTydne = Languages.of(context)!.friday;
break;
case 6:
dayOWeek = Languages.of(context)!.saturday;
denTydne = Languages.of(context)!.saturday;
break;
case 7:
dayOWeek = Languages.of(context)!.sunday;
denTydne = Languages.of(context)!.sunday;
break;
default:
dayOWeek = Languages.of(context)!.monday;
denTydne = Languages.of(context)!.monday;
}
content = [];
for (OfflineMeal j in jidelnicek) {
content.add(
obsah = [];
for (OfflineJidlo j in jidelnicek) {
obsah.add(
Padding(
padding: const EdgeInsets.only(top: 15),
child: InkWell(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(j.variant),
Text(j.varianta),
const SizedBox(width: 10),
Flexible(
child: Text(
j.name,
j.nazev,
),
),
Text((j.onExchange)
Text((j.naBurze)
? Languages.of(context)!.inExchange
: "${j.price}"),
: "${j.cena}"),
Checkbox(
value: j.ordered,
value: j.objednano,
fillColor: MaterialStateProperty.all(Colors.grey),
onChanged: (v) async {
return;
@ -111,17 +110,14 @@ class _OfflineMealViewState extends State<OfflineMealView> {
setState(() {});
}
void click(String value, BuildContext context) async {
void kliknuti(String value, BuildContext context) async {
if (value == Languages.of(context)!.signOut) {
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushReplacement(
context, platformRouter((c) => const LoginPage()));
context, MaterialPageRoute(builder: (c) => const LoginPage()));
} else if (value == Languages.of(context)!.review) {
launchUrl(
Uri.parse((Platform.isAndroid)
? "market://details?id=cz.hernikplays.opencanteen"
: "https://apps.apple.com/cz/app/opencanteen/id1621124445"),
launchUrl(Uri.parse("market://details?id=cz.hernikplays.opencanteen"),
mode: LaunchMode.externalApplication);
} else if (value == Languages.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
@ -130,33 +126,31 @@ class _OfflineMealViewState extends State<OfflineMealView> {
var packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
showAboutDialog(
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${Languages.of(context)!.copyright}\n${Languages.of(context)!.license}",
applicationVersion: packageInfo.version,
children: [
PlatformButton(
onPressed: (() => launchUrl(
Uri.parse("https://git.mnau.xyz/hernik/opencanteen"))),
text: Languages.of(context)!.source,
)
],
);
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${Languages.of(context)!.copyright}\n${Languages.of(context)!.license}",
applicationVersion: packageInfo.version,
children: [
TextButton(
onPressed: (() => launchUrl(
Uri.parse("https://git.mnau.xyz/hernik/opencanteen"))),
child: Text(Languages.of(context)!.source))
]);
}
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
loadSettings();
nactiNastaveni();
}
void loadSettings() async {
void nactiNastaveni() async {
var prefs = await SharedPreferences.getInstance();
_skipWeekend = prefs.getBool("skip") ?? false;
if (!mounted) return;
loadFromFile();
nactiZeSouboru();
}
@override
@ -167,7 +161,7 @@ class _OfflineMealViewState extends State<OfflineMealView> {
automaticallyImplyLeading: false,
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
onSelected: ((String value) => kliknuti(value, context)),
itemBuilder: (BuildContext context) {
return {
Languages.of(context)!.reportBugs,
@ -201,69 +195,69 @@ class _OfflineMealViewState extends State<OfflineMealView> {
IconButton(
onPressed: () {
if (data.length <= 1) return;
content = [const CircularProgressIndicator()];
obsah = [const CircularProgressIndicator()];
setState(() {
if (currentDay.weekday == 1 && _skipWeekend) {
if (den.weekday == 1 && _skipWeekend) {
// pokud je pondělí a chceme přeskočit víkend
if (mealIndex - 2 >= 0) {
mealIndex -= data.length - 3;
if (jidloIndex - 2 >= 0) {
jidloIndex -= data.length - 3;
} else {
mealIndex = data.length - 1;
jidloIndex = data.length - 1;
}
} else if (mealIndex == 0) {
mealIndex = data.length - 1;
} else if (jidloIndex == 0) {
jidloIndex = data.length - 1;
} else {
mealIndex -= 1;
jidloIndex -= 1;
}
loadFood();
nactiJidlo();
});
},
icon: const Icon(Icons.arrow_left)),
PlatformButton(
TextButton(
onPressed: () async {},
text:
"${currentDay.day}. ${currentDay.month}. ${currentDay.year} - $dayOWeek"),
child: Text(
"${den.day}. ${den.month}. ${den.year} - $denTydne")),
IconButton(
onPressed: () {
if (data.length <= 1) return;
content = [const CircularProgressIndicator()];
obsah = [const CircularProgressIndicator()];
setState(() {
if (currentDay.weekday == 5 && _skipWeekend) {
if (den.weekday == 5 && _skipWeekend) {
// pokud je pondělí a chceme přeskočit víkend
if (mealIndex + 2 <= data.length - 1) {
mealIndex += 2;
if (jidloIndex + 2 <= data.length - 1) {
jidloIndex += 2;
} else {
mealIndex = 0;
jidloIndex = 0;
}
} else if (mealIndex == data.length) {
mealIndex = 0;
} else if (jidloIndex == data.length) {
jidloIndex = 0;
} else {
mealIndex += 1;
jidloIndex += 1;
}
loadFood();
nactiJidlo();
});
},
icon: const Icon(Icons.arrow_right),
),
IconButton(
onPressed: () {
mealIndex = 0;
jidloIndex = 0;
},
icon: const Icon(Icons.today))
]),
SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Column(
children: content,
children: obsah,
),
),
],
),
),
),
onRefresh: () => Navigator.pushReplacement(
context, platformRouter((context) => const LoginPage())),
onRefresh: () => Navigator.pushReplacement(context,
MaterialPageRoute(builder: ((context) => const LoginPage()))),
),
);
}

View file

@ -4,7 +4,6 @@ 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';
import 'package:opencanteen/util.dart';
class WelcomePage extends StatefulWidget {
const WelcomePage({Key? key, required this.canteen}) : super(key: key);
@ -69,7 +68,8 @@ class _WelcomePageState extends State<WelcomePage> {
await storage.write(key: "oc_souhlas", value: "ano");
if (!mounted) return;
Navigator.of(context).pushAndRemoveUntil(
platformRouter((c) => MealView(canteen: widget.canteen)),
MaterialPageRoute(
builder: (c) => JidelnicekView(canteen: widget.canteen)),
(route) => false);
},
),

View file

@ -1,18 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:opencanteen/pw/platformwidget.dart';
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
final String text;
final void Function()? onPressed;
const PlatformButton(
{super.key, required this.text, required this.onPressed});
@override
TextButton createAndroidWidget(BuildContext context) =>
TextButton(onPressed: onPressed, child: Text(text));
@override
CupertinoButton createIosWidget(BuildContext context) =>
CupertinoButton(onPressed: onPressed, child: Text(text));
}

View file

@ -1,30 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:opencanteen/pw/platformwidget.dart';
class PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
final String title;
final String? content;
final List<Widget> actions;
const PlatformDialog(
{super.key, required this.title, this.content, this.actions = const []});
@override
AlertDialog createAndroidWidget(BuildContext context) => AlertDialog(
title: Text(title),
content: (content != null)
? SingleChildScrollView(child: Text(content!))
: null,
actions: actions,
);
@override
CupertinoAlertDialog createIosWidget(BuildContext context) =>
CupertinoAlertDialog(
title: Text(title),
content: (content != null)
? SingleChildScrollView(child: Text(content!))
: null,
actions: actions,
);
}

View file

@ -1,54 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:opencanteen/pw/platformwidget.dart';
class PlatformField extends PlatformWidget<TextField, CupertinoTextField> {
final TextEditingController? controller;
final bool? enabled;
final bool obscureText;
final String? labelText;
final bool autocorrect;
final TextInputType? keyboardType;
final List<TextInputFormatter> inputFormatters;
final void Function(String)? onChanged;
final List<String>? autofillHints;
const PlatformField({
super.key,
this.controller,
this.enabled,
this.labelText,
this.obscureText = false,
this.autocorrect = false,
this.keyboardType,
this.inputFormatters = const [],
this.onChanged,
this.autofillHints,
});
@override
TextField createAndroidWidget(BuildContext context) => TextField(
controller: controller,
enabled: enabled,
obscureText: obscureText,
decoration: InputDecoration(labelText: labelText),
autocorrect: autocorrect,
keyboardType: keyboardType,
inputFormatters: inputFormatters,
onChanged: onChanged,
autofillHints: autofillHints,
);
@override
CupertinoTextField createIosWidget(BuildContext context) =>
CupertinoTextField(
controller: controller,
enabled: enabled,
obscureText: obscureText,
prefix: (labelText == null) ? null : Text(labelText!),
autocorrect: autocorrect,
keyboardType: keyboardType,
inputFormatters: inputFormatters,
onChanged: onChanged,
);
}

View file

@ -1,28 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:opencanteen/pw/platformwidget.dart';
class PlatformSwitch extends PlatformWidget<Switch, CupertinoSwitch> {
final bool value;
final void Function(bool)? onChanged;
final Color? thumbColor;
const PlatformSwitch(
{super.key,
required this.value,
required this.onChanged,
this.thumbColor});
@override
Switch createAndroidWidget(BuildContext context) => Switch(
value: value,
onChanged: onChanged,
thumbColor: MaterialStateProperty.all(thumbColor),
);
@override
CupertinoSwitch createIosWidget(BuildContext context) => CupertinoSwitch(
value: value,
onChanged: onChanged,
thumbColor: thumbColor,
);
}

View file

@ -1,22 +0,0 @@
import 'dart:io';
import 'package:flutter/material.dart';
/// Abstract class used to create widgets for the respective platform UI library
abstract class PlatformWidget<A extends Widget, I extends Widget>
extends StatelessWidget {
const PlatformWidget({super.key});
@override
Widget build(BuildContext context) {
if (Platform.isAndroid) {
return createAndroidWidget(context);
} else {
return createIosWidget(context);
}
}
A createAndroidWidget(BuildContext context);
I createIosWidget(BuildContext context);
}

View file

@ -1,9 +1,7 @@
import 'dart:io';
import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:opencanteen/okna/burza.dart';
import 'package:opencanteen/okna/jidelnicek.dart';
import 'lang/lang.dart';
@ -30,7 +28,8 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
title: Text(Languages.of(context)!.exchange),
onTap: () => Navigator.push(
context,
platformRouter((context) => BurzaView(canteen: canteen)),
MaterialPageRoute(
builder: (context) => BurzaView(canteen: canteen)),
),
),
],
@ -50,7 +49,8 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
title: Text(Languages.of(context)!.home),
onTap: () => Navigator.push(
context,
platformRouter((c) => MealView(canteen: canteen)),
MaterialPageRoute(
builder: (c) => JidelnicekView(canteen: canteen)),
),
),
ListTile(
@ -66,60 +66,31 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
return drawer;
}
class OfflineMeal {
String name;
String variant;
bool ordered;
double price;
bool onExchange;
DateTime day;
class OfflineJidlo {
String nazev;
String varianta;
bool objednano;
double cena;
bool naBurze;
DateTime den;
OfflineMeal(
{required this.name,
required this.variant,
required this.ordered,
required this.price,
required this.onExchange,
required this.day});
OfflineJidlo(
{required this.nazev,
required this.varianta,
required this.objednano,
required this.cena,
required this.naBurze,
required this.den});
}
/// Parses [DateTime] from [TimeOfDay]
DateTime timeToDate(TimeOfDay c) {
/// Vytvoří [DateTime] z [TimeOfDay]
DateTime casNaDate(TimeOfDay c) {
var now = DateTime.now();
return DateTime.parse(
"${now.year}-${(now.month < 10 ? "0" : "") + now.month.toString()}-${(now.day < 10 ? "0" : "") + now.day.toString()} ${(c.hour < 10 ? "0" : "") + c.hour.toString()}:${(c.minute < 10 ? "0" : "") + c.minute.toString()}:00");
}
/// List of instances to be used in the dropdown menu
List<Map<String, String>> instance = [
{"name": "SŠTE Brno, Olomoucká", "url": "https://stravovani.sstebrno.cz"},
{"name": "Jiné", "url": ""}
];
/// Used to display either a toas or a snackbar
void showInfo(BuildContext context, String message) {
if (Platform.isAndroid) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
duration: const Duration(seconds: 4),
),
);
} else {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 3,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0,
);
}
}
Route platformRouter(Widget Function(BuildContext context) builder) =>
(Platform.isAndroid)
? MaterialPageRoute(builder: builder)
: CupertinoPageRoute(builder: builder);

View file

@ -5,120 +5,105 @@ packages:
dependency: transitive
description:
name: archive
sha256: d6347d54a2d8028e0437e3c099f66fdb8ae02c4720c1e7534c9f24c10351f85d
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.6"
version: "3.3.4"
args:
dependency: transitive
description:
name: args
sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.2"
version: "2.3.1"
async:
dependency: transitive
description:
name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.10.0"
canteenlib:
dependency: "direct main"
description:
name: canteenlib
sha256: c15aa1d11fb9d6d01d633b8cbb6780d3e63c9058f8cc3b0f7de2fbc21cf4903d
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
characters:
dependency: transitive
description:
name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.17.0"
version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
crypto:
dependency: transitive
description:
name: crypto
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
dbus:
dependency: transitive
description:
name: dbus
sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.8"
dots_indicator:
dependency: transitive
description:
name: dots_indicator
sha256: e59dfc90030ee5a4fd4c53144a8ce97cc7a823c2067b8fb9814960cd1ae63f89
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
ffi:
dependency: transitive
description:
name: ffi
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
@ -130,40 +115,35 @@ packages:
dependency: "direct dev"
description:
name: flutter_launcher_icons
sha256: ce0e501cfc258907842238e4ca605e74b7fd1cdf04b3b43e86c43f3e40a1592c
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_local_notifications:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: f222919a34545931e47b06000836b5101baeffb0e6eb5a4691d2d42851740dd9
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "12.0.4"
version: "12.0.3+1"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: "3c6d6db334f609a92be0c0915f40871ec56f5d2adf01e77ae364162c587c0ca8"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
sha256: "5ec1feac5f7f7d9266759488bc5f76416152baba9aa1b26fe572246caa00d1ab"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
flutter_localizations:
@ -175,351 +155,315 @@ packages:
dependency: "direct main"
description:
name: flutter_native_timezone
sha256: ed7bfb982f036243de1c068e269182a877100c994f05143c8b26a325e28c1b02
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_secure_storage:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "1b7c2f80ee41861543bc63fee56122a114129c15234731312418ca1eda7d3d7f"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.2"
flutter_secure_storage_linux:
dependency: transitive
description:
name: flutter_secure_storage_linux
sha256: "736436adaf91552433823f51ce22e098c2f0551db06b6596f58597a25b8ea797"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.1"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.1"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
name: flutter_secure_storage_platform_interface
sha256: b3773190e385a3c8a382007893d678ae95462b3c2279e987b55d140d3b0cb81b
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.0"
flutter_secure_storage_web:
dependency: transitive
description:
name: flutter_secure_storage_web
sha256: "42938e70d4b872e856e678c423cc0e9065d7d294f45bc41fc1981a4eb4beaffe"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.0.2"
flutter_secure_storage_windows:
dependency: transitive
description:
name: flutter_secure_storage_windows
sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.1.2"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
sha256: "7cc92eabe01e3f1babe1571c5560b135dfc762a34e41e9056881e2196b178ec1"
url: "https://pub.dev"
source: hosted
version: "8.1.2"
http:
dependency: transitive
description:
name: http
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.0"
version: "3.2.2"
intl:
dependency: "direct main"
description:
name: intl
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
introduction_screen:
dependency: "direct main"
description:
name: introduction_screen
sha256: "73965475d6b271846f81c5fce5b459546a4ea36c285408691522437fd6bbeb69"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
version: "3.0.2"
js:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5"
version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "4.8.0"
version: "4.7.0"
lints:
dependency: transitive
description:
name: lints
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: f62d7253edc197fe3c88d7c2ddab82d68f555e778d55390ccc3537eca8e8d637
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.3+1"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
sha256: "04b575f44233d30edbb80a94e57cad9107aada334fc02aabb42b6becd13c43fc"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
package_info_plus_macos:
dependency: transitive
description:
name: package_info_plus_macos
sha256: a2ad8b4acf4cd479d4a0afa5a74ea3f5b1c7563b77e52cc32b3ee6956d5482a6
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: f7a0c8f1e7e981bc65f8b64137a53fd3c195b18d429fba960babc59a5a1c7ae8
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
package_info_plus_web:
dependency: transitive
description:
name: package_info_plus_web
sha256: f0829327eb534789e0a16ccac8936a80beed4e2401c4d3a74f3f39094a822d3b
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
sha256: "79524f11c42dd9078b96d797b3cf79c0a2883a50c4920dc43da8562c115089bc"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
path:
dependency: transitive
description:
name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
version: "2.0.11"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.22"
path_provider_foundation:
version: "2.0.21"
path_provider_ios:
dependency: transitive
description:
name: path_provider_foundation
sha256: "62a68e7e1c6c459f9289859e2fae58290c981ce21d1697faf54910fe1faa4c74"
url: "https://pub.dev"
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.0.11"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
platform:
dependency: transitive
description:
name: platform
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.2"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.17"
version: "2.0.15"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
shared_preferences_foundation:
version: "2.0.14"
shared_preferences_ios:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "1ffa239043ab8baf881ec3094a3c767af9d10399b2839020b9e4d44c0bb23951"
url: "https://pub.dev"
name: shared_preferences_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.1"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.1"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.1"
sky_engine:
dependency: transitive
description: flutter
@ -529,146 +473,128 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
timezone:
dependency: "direct main"
description:
name: timezone
sha256: "24c8fcdd49a805d95777a39064862133ff816ebfffe0ceff110fb5960e557964"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1"
version: "0.9.0"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.8"
version: "6.1.6"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.23"
version: "6.0.21"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: bb328b24d3bccc20bdf1024a0990ac4f869d57663660de9c936fb8c043edefe3
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.18"
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
version: "3.0.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
version: "3.0.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.14"
version: "2.0.13"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.3"
version: "3.0.1"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.2"
win32:
dependency: transitive
description:
name: win32
sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
version: "3.1.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
version: "0.2.0+2"
xml:
dependency: transitive
description:
name: xml
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "6.2.2"
version: "6.1.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
url: "https://pub.dev"
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.18.2 <4.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.0.0"

View file

@ -6,10 +6,10 @@ publish_to: 'none'
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
version: 1.7.0+27
version: 1.6.1+26
environment:
sdk: ">=2.18.2 <3.0.0"
sdk: ">=2.16.1 <3.0.0"
dependencies:
flutter:
@ -27,7 +27,6 @@ dependencies:
flutter_native_timezone: ^2.0.0
intl: ^0.17.0
package_info_plus: ^1.4.3+1
fluttertoast: ^8.1.2
dev_dependencies:
flutter_lints: ^2.0.1