Compare commits

..

No commits in common. "b948959e671ce2a4efab278bc489f7f1228f1f7a" and "2615769679b8b411f21e363fbfa9c03414b3983b" have entirely different histories.

21 changed files with 856 additions and 256 deletions

View file

@ -1,8 +1,3 @@
# 1.7.0
- Implementovat Material 3 (Android)
- Upravit chování dle platformy
- Předělat jazykový systém na ARB
- Aktualizovat flutter_secure_storage
# 1.6.1
- opravit chybu s přidáváním do burzy aktualizací knihovny
# 1.6.0

View file

@ -4,7 +4,7 @@
<dict>
<key>CFBundleLocalizations</key>
<array>
<string>cs</string>
<string>Czech</string>
<string>en</string>
</array>
<key>CFBundleDevelopmentRegion</key>

View file

@ -1,3 +0,0 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

View file

@ -1,69 +0,0 @@
import 'package:flutter/material.dart';
const lightColorScheme = ColorScheme(
brightness: Brightness.light,
primary: Color(0xFF5F52A7),
onPrimary: Color(0xFFFFFFFF),
primaryContainer: Color(0xFFE5DEFF),
onPrimaryContainer: Color(0xFF1A0261),
secondary: Color(0xFF5F5C71),
onSecondary: Color(0xFFFFFFFF),
secondaryContainer: Color(0xFFE5DFF9),
onSecondaryContainer: Color(0xFF1C192B),
tertiary: Color(0xFF763EC3),
onTertiary: Color(0xFFFFFFFF),
tertiaryContainer: Color(0xFFEDDCFF),
onTertiaryContainer: Color(0xFF290056),
error: Color(0xFFBA1A1A),
errorContainer: Color(0xFFFFDAD6),
onError: Color(0xFFFFFFFF),
onErrorContainer: Color(0xFF410002),
background: Color(0xFFFFFBFF),
onBackground: Color(0xFF1C1B1F),
surface: Color(0xFFFFFBFF),
onSurface: Color(0xFF1C1B1F),
surfaceVariant: Color(0xFFE5E0EC),
onSurfaceVariant: Color(0xFF48454E),
outline: Color(0xFF79767F),
onInverseSurface: Color(0xFFF4EFF4),
inverseSurface: Color(0xFF313033),
inversePrimary: Color(0xFFC8BFFF),
shadow: Color(0xFF000000),
surfaceTint: Color(0xFF5F52A7),
outlineVariant: Color(0xFFC9C5D0),
scrim: Color(0xFF000000),
);
const darkColorScheme = ColorScheme(
brightness: Brightness.dark,
primary: Color(0xFFC8BFFF),
onPrimary: Color(0xFF302175),
primaryContainer: Color(0xFF473A8D),
onPrimaryContainer: Color(0xFFE5DEFF),
secondary: Color(0xFFC9C3DC),
onSecondary: Color(0xFF312E41),
secondaryContainer: Color(0xFF484459),
onSecondaryContainer: Color(0xFFE5DFF9),
tertiary: Color(0xFFD7BAFF),
onTertiary: Color(0xFF440088),
tertiaryContainer: Color(0xFF5D20A9),
onTertiaryContainer: Color(0xFFEDDCFF),
error: Color(0xFFFFB4AB),
errorContainer: Color(0xFF93000A),
onError: Color(0xFF690005),
onErrorContainer: Color(0xFFFFDAD6),
background: Color(0xFF1C1B1F),
onBackground: Color(0xFFE5E1E6),
surface: Color(0xFF1C1B1F),
onSurface: Color(0xFFE5E1E6),
surfaceVariant: Color(0xFF48454E),
onSurfaceVariant: Color(0xFFC9C5D0),
outline: Color(0xFF938F99),
onInverseSurface: Color(0xFF1C1B1F),
inverseSurface: Color(0xFFE5E1E6),
inversePrimary: Color(0xFF5F52A7),
shadow: Color(0xFF000000),
surfaceTint: Color(0xFFC8BFFF),
outlineVariant: Color(0xFF48454E),
scrim: Color(0xFF000000),
);

View file

@ -1 +0,0 @@
{"about":"O Aplikaci","agree":"Souhlasím","appName":"OpenCanteen","balance":"Kredit: ","cannotOrder":"Toto jídlo není možné objednat.","close":"Zavřít","copyright":"© 2022 Matyáš Caras a přispěvatelé","disagree":"Nesouhlasím","errorContacting":"Nastala chyba při kontaktování serveru, zkontrolujte připojení","errorOrdering":"Jídlo se nepodařilo objednat","exchange":"Burza","exchangeError":"Nepodařilo se vložit jídlo na burzu","friday":"Pátek","home":"Domů","httpLogin":"Snažíte se přihlásit přes nešifrované spojení HTTP, jste si jisti, že tak chcete učinit?","iCanteenUrl":"iCanteen URL","inExchange":"V BURZE","license":"Vydáno pod licencí GNU GPLv3","loading":"Načítání...","logIn":"Přihlášení","loggingIn":"Přihlašuji vás...","loginFailed":"Přihlášení se nezdařilo","menu":"Jídelníček","monday":"Pondělí","mustLogout":"Online přejdete přetažením dolů.","no":"Ne","noChange":"Ne, změnit","noExchange":"Žádné jídlo v burze","noFood":"Žádné jídlo pro tento den","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. Pokračováním souhlasíte.","offline":"JSTE OFFLINE","ok":"OK","order":"Objednat","orderSuccess":"Jídlo bylo úspěšně objednáno","ordered":"Objednáno","ordering":"Objednávám...","password":"Heslo","pullToReload":"Potáhněte zvrchu pro načtení","rememberMe":"Zapamatovat si mě","reportBugs":"Zpětná vazba","saturday":"Sobota","saveOffline":"Ukládat jídelníček na dnešní den offline","settings":"Nastavení","signOut":"Odhlásit se","skipWeekend":"Při procházení menu přeskočit víkend","sunday":"Neděle","thursday":"Čtvrtek","tuesday":"Úterý","username":"Uživatelské jméno","verifyExchange":"Opravdu chcete vložit jídlo na burzu?","warning":"Pozor!","wednesday":"Středa","yes":"Ano","aboutFromExch":"Žádné jídlo? Žádný problém!","aboutOrder":"Klepnutím objednáte","aboutToExch":"Nemáte chuť?","appDesc":"OpenCanteen je neoficiální aplikace pro přístup do obědového systému iCanteen","howFromExch":"Z vysunovacího menu přejděte do burzy a objednejte si z dostupných jídel","howOrder":"Jednoduše klepněte na jídlo s modrým políčkem a máte objednáno","howToExch":"Stačí dlouze podržet jméno objednaného jídla a můžete ho přesunout na nebo z burzy","welcome":"Vítejte v OpenCanteen","next":"Další","checkOrdered":"Kontrolovat, jestli mám objednáno na příští týden","noOrder":"Na přístí týden nemáte objednané žádné jídlo!","corrupted":"Nastal problém s dešifrováním uložených údajů, prosím zkuste vyčistit veškerá data této aplikace.","notifyAt":"Odeslat v","notifyLunch":"V určený čas odeslat notifikaci s informacemi o obědě","lunchNotif":"Dnes máte objednáno","error":"Chyba","needRemember":"Musíte své přihlašovací údaje uložit na přihlašovací obrazovce","notifyWarning":"Vaše zařízení může mít povolenou optimalizaci baterie, což může způsobovat neodesílání oznámení. Zkontrolujte nastavení ve vašem zařízení.","signOutWarn":"Opravdu se chcete odhlásit?","jump":"Přeskočit","source":"Zdrojový kód","review":"Ohodnotit aplikaci","saveCount":"Počet dnů dostupných offline (Akt. limit je 7)","errorSaving":"Při ukládání offline nastala chyba, zkuste to znovu později.","todayTooltip":"Přejít na dnešní jídelníček"}

View file

@ -1 +0,0 @@
{"about":"About","agree":"I agree","appName":"OpenCanteen","balance":"Balance: ","cannotOrder":"This food cannot be ordered.","close":"Close","copyright":"© 2022 Matyáš Caras and contributors","disagree":"I disagree","errorContacting":"Failed to contact the server, check your connection.","errorOrdering":"Could not order food.","exchange":"Exchange","exchangeError":"Could not put food on exchange.","friday":"Friday","home":"Home","httpLogin":"You are trying to sign in using an insecure HTTP connection, are you sure you want to continue?","iCanteenUrl":"iCanteen URL","inExchange":"ON EXCHANGE","license":"Released under the GNU GPLv3","loading":"Loading...","logIn":"Sign in","loggingIn":"Signing you in...","loginFailed":"Sign in failed","menu":"Food Menu","monday":"Monday","mustLogout":"To go online, pull down.","no":"No","noChange":"No, change","noExchange":"No meal in exchange","noFood":"No meal for this day","notOfficial":"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.","offline":"YOU ARE OFFLINE","ok":"OK","order":"Order","orderSuccess":"Meal ordered succesfully","ordered":"Ordered","ordering":"Ordering...","password":"Password","pullToReload":"Pull to reload","rememberMe":"Remember me","reportBugs":"Feedback","saturday":"Saturday","saveOffline":"Save today's menu offline","settings":"Settings","signOut":"Sign out","skipWeekend":"Skip weekends when browsing menu","sunday":"Sunday","thursday":"Thursday","tuesday":"Tuesday","username":"Username","verifyExchange":"Are you sure you want to put this meal on exchange?","warning":"Warning!","wednesday":"Wednesday","yes":"Yes","appDesc":"OpenCanteen is a mobile app for accessing iCanteen.","welcome":"Welcome to OpenCanteen","aboutOrder":"Order with a tap","howOrder":"Simply tap on a meal with a blue checkbox next to it and it's done!","aboutToExch":"Don't want your food?","howToExch":"If you cannot cancel your order, simply long-tap on the ordered food and put it into the exchange.","aboutFromExch":"No food? No problem!","howFromExch":"Simply check the exchange from the sidebar and order when a meal is available.","next":"Next","checkOrdered":"Check if I have ordered food for the next week","noOrder":"You did not order any food for the next week!","corrupted":"The saved credentials seem to be corrupted, please try clearing the application's data.","notifyAt":"Send notification at","notifyLunch":"Send a notification with meal info","lunchNotif":"Today's ordered meal","error":"Error","needRemember":"You need to save your login details on the login screen first","notifyWarning":"Your device may have battery optimization enabled. This may cause notifications to not be sent. Check the application info in your device's settings.","signOutWarn":"Do you really want to sign out?","jump":"Jump","source":"Source code","review":"Review the app","saveCount":"Number of days to save offline (Current limit is 7)","errorSaving":"An error occured while trying to save menu offline, try again later.","todayTooltip":"Go to today's meal"}

177
lib/lang/lang.dart Normal file
View file

@ -0,0 +1,177 @@
import 'package:flutter/material.dart';
abstract class Languages {
static Languages? of(BuildContext context) {
return Localizations.of<Languages>(context, Languages);
}
String get appName;
String get home;
// Login
String get errorContacting;
String get loggingIn;
String get logIn;
String get username;
String get password;
String get iCanteenUrl;
String get rememberMe;
String get httpLogin;
String get yes;
String get noChange;
String get notOfficial;
String get agree;
String get disagree;
String get loginFailed;
String get warning;
String get corrupted;
// Jídelníček
String get todayTooltip;
String get loading;
String get monday;
String get tuesday;
String get wednesday;
String get thursday;
String get friday;
String get saturday;
String get sunday;
String get noFood;
String get inExchange;
String get ordering;
String get errorOrdering;
String get close;
String get verifyExchange;
String get no;
String get exchangeError;
String get signOut;
String get reportBugs;
String get review;
String get about;
String get menu;
String get balance;
String get noOrder;
String get signOutWarn;
String get jump;
// 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
String get exchange;
String get noExchange;
String get pullToReload;
String get ordered;
String get orderSuccess;
String get ok;
String get cannotOrder;
String get order;
// About
String get license;
String get copyright;
String get source;
// Nastavení
String get settings;
String get saveOffline;
String get saveCount;
String get skipWeekend;
String get checkOrdered;
String get notifyLunch;
String get notifyAt;
String get notifyWarning;
// Offline
String get offline;
String get mustLogout;
String get errorSaving;
// Oznámit před obědem
String get lunchNotif;
String get error;
String get needRemember;
}

250
lib/lang/lang_cz.dart Normal file
View file

@ -0,0 +1,250 @@
import 'package:opencanteen/lang/lang.dart';
class LanguageCz extends Languages {
@override
String get about => "O Aplikaci";
@override
String get agree => "Souhlasím";
@override
String get appName => "OpenCanteen";
@override
String get balance => "Kredit: ";
@override
String get cannotOrder => "Toto jídlo není možné objednat.";
@override
String get close => "Zavřít";
@override
String get copyright => "© 2022 Matyáš Caras a přispěvatelé";
@override
String get disagree => "Nesouhlasím";
@override
String get errorContacting =>
"Nastala chyba při kontaktování serveru, zkontrolujte připojení";
@override
String get errorOrdering => "Jídlo se nepodařilo objednat";
@override
String get exchange => "Burza";
@override
String get exchangeError => "Nepodařilo se vložit jídlo na burzu";
@override
String get friday => "Pátek";
@override
String get home => "Domů";
@override
String get httpLogin =>
"Snažíte se přihlásit přes nešifrované spojení HTTP, jste si jisti, že tak chcete učinit?";
@override
String get iCanteenUrl => "iCanteen URL";
@override
String get inExchange => "V BURZE";
@override
String get license => "Vydáno pod licencí GNU GPLv3";
@override
String get loading => "Načítání...";
@override
String get logIn => "Přihlášení";
@override
String get loggingIn => "Přihlašuji vás...";
@override
String get loginFailed => "Přihlášení se nezdařilo";
@override
String get menu => "Jídelníček";
@override
String get monday => "Pondělí";
@override
String get mustLogout => "Online přejdete přetažením dolů.";
@override
String get no => "Ne";
@override
String get noChange => "Ne, změnit";
@override
String get noExchange => "Žádné jídlo v burze";
@override
String get noFood => "Žádné jídlo pro tento den";
@override
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. Pokračováním souhlasíte.";
@override
String get offline => "JSTE OFFLINE";
@override
String get ok => "OK";
@override
String get order => "Objednat";
@override
String get orderSuccess => "Jídlo bylo úspěšně objednáno";
@override
String get ordered => "Objednáno";
@override
String get ordering => "Objednávám...";
@override
String get password => "Heslo";
@override
String get pullToReload => "Potáhněte zvrchu pro načtení";
@override
String get rememberMe => "Zapamatovat si mě";
@override
String get reportBugs => "Zpětná vazba";
@override
String get saturday => "Sobota";
@override
String get saveOffline => "Ukládat jídelníček na dnešní den offline";
@override
String get settings => "Nastavení";
@override
String get signOut => "Odhlásit se";
@override
String get skipWeekend => "Při procházení menu přeskočit víkend";
@override
String get sunday => "Neděle";
@override
String get thursday => "Čtvrtek";
@override
String get tuesday => "Úterý";
@override
String get username => "Uživatelské jméno";
@override
String get verifyExchange => "Opravdu chcete vložit jídlo na burzu?";
@override
String get warning => "Pozor!";
@override
String get wednesday => "Středa";
@override
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ší";
@override
String get checkOrdered =>
"Kontrolovat, jestli mám objednáno na příští týden";
@override
String get noOrder => "Na přístí týden nemáte objednané žádné jídlo!";
@override
String get corrupted =>
"Nastal problém s dešifrováním uložených údajů, prosím zkuste vyčistit veškerá data této aplikace.";
@override
String get notifyAt => "Odeslat v";
@override
String get notifyLunch =>
"V určený čas odeslat notifikaci s informacemi o obědě";
@override
String get lunchNotif => "Dnes máte objednáno";
@override
String get error => "Chyba";
@override
String get needRemember =>
"Musíte své přihlašovací údaje uložit na přihlašovací obrazovce";
@override
String get notifyWarning =>
"Vaše zařízení může mít povolenou optimalizaci baterie, což může způsobovat neodesílání oznámení. Zkontrolujte nastavení ve vašem zařízení.";
@override
String get signOutWarn => "Opravdu se chcete odhlásit?";
@override
String get jump => "Přeskočit";
@override
String get source => "Zdrojový kód";
@override
String get review => "Ohodnotit aplikaci";
@override
String get saveCount => "Počet dnů dostupných offline (Akt. limit je 7)";
@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";
}

248
lib/lang/lang_en.dart Normal file
View file

@ -0,0 +1,248 @@
import 'package:opencanteen/lang/lang.dart';
class LanguageEn extends Languages {
@override
String get about => "About";
@override
String get agree => "I agree";
@override
String get appName => "OpenCanteen";
@override
String get balance => "Balance: ";
@override
String get cannotOrder => "This food cannot be ordered.";
@override
String get close => "Close";
@override
String get copyright => "© 2022 Matyáš Caras and contributors";
@override
String get disagree => "I disagree";
@override
String get errorContacting =>
"Failed to contact the server, check your connection.";
@override
String get errorOrdering => "Could not order food.";
@override
String get exchange => "Exchange";
@override
String get exchangeError => "Could not put food on exchange.";
@override
String get friday => "Friday";
@override
String get home => "Home";
@override
String get httpLogin =>
"You are trying to sign in using an insecure HTTP connection, are you sure you want to continue?";
@override
String get iCanteenUrl => "iCanteen URL";
@override
String get inExchange => "ON EXCHANGE";
@override
String get license => "Released under the GNU GPLv3";
@override
String get loading => "Loading...";
@override
String get logIn => "Sign in";
@override
String get loggingIn => "Signing you in...";
@override
String get loginFailed => "Sign in failed";
@override
String get menu => "Food Menu";
@override
String get monday => "Monday";
@override
String get mustLogout => "To go online, pull down.";
@override
String get no => "No";
@override
String get noChange => "No, change";
@override
String get noExchange => "No meal in exchange";
@override
String get noFood => "No meal for this day";
@override
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. By continuing you agree.";
@override
String get offline => "YOU ARE OFFLINE";
@override
String get ok => "OK";
@override
String get order => "Order";
@override
String get orderSuccess => "Meal ordered succesfully";
@override
String get ordered => "Ordered";
@override
String get ordering => "Ordering...";
@override
String get password => "Password";
@override
String get pullToReload => "Pull to reload";
@override
String get rememberMe => "Remember me";
@override
String get reportBugs => "Feedback";
@override
String get saturday => "Saturday";
@override
String get saveOffline => "Save today's menu offline";
@override
String get settings => "Settings";
@override
String get signOut => "Sign out";
@override
String get skipWeekend => "Skip weekends when browsing menu";
@override
String get sunday => "Sunday";
@override
String get thursday => "Thursday";
@override
String get tuesday => "Tuesday";
@override
String get username => "Username";
@override
String get verifyExchange =>
"Are you sure you want to put this meal on exchange?";
@override
String get warning => "Warning!";
@override
String get wednesday => "Wednesday";
@override
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";
@override
String get checkOrdered => "Check if I have ordered food for the next week";
@override
String get noOrder => "You did not order any food for the next week!";
@override
String get corrupted =>
"The saved credentials seem to be corrupted, please try clearing the application's data.";
@override
String get notifyAt => "Send notification at";
@override
String get notifyLunch => "Send a notification with meal info";
@override
String get lunchNotif => "Today's ordered meal";
@override
String get error => "Error";
@override
String get needRemember =>
"You need to save your login details on the login screen first";
@override
String get notifyWarning =>
"Your device may have battery optimization enabled. This may cause notifications to not be sent. Check the application info in your device's settings.";
@override
String get signOutWarn => "Do you really want to sign out?";
@override
String get jump => "Jump";
@override
String get source => "Source code";
@override
String get review => "Review the app";
@override
String get saveCount => "Number of days to save offline (Current limit is 7)";
@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

@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
import 'package:opencanteen/lang/lang_cz.dart';
import 'package:opencanteen/loginmanager.dart';
import 'package:canteenlib/canteenlib.dart';
import 'package:opencanteen/okna/login.dart';
import 'package:opencanteen/util.dart';
@ -13,9 +15,9 @@ import 'package:intl/intl.dart';
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'color_schemes.g.dart';
import 'loginmanager.dart';
import 'lang/lang.dart';
import 'lang/lang_en.dart';
/*
Copyright (C) 2022 Matyáš Caras a přispěvatelé
@ -43,10 +45,10 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
String locale = Intl.getCurrentLocale();
switch (locale) {
case "cs_CZ":
title = "Dnes máte objednáno";
title = LanguageCz().lunchNotif;
break;
default:
title = "Today's ordered meal";
title = LanguageEn().lunchNotif;
}
/*if (prefs.getBool("offline") ?? false) {
@ -128,25 +130,27 @@ class MyApp extends StatelessWidget {
? MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
AppLocalizations.delegate,
AppLocalizationsDelegate(),
...GlobalMaterialLocalizations.delegates
],
supportedLocales: AppLocalizations.supportedLocales,
supportedLocales: const [Locale("cs", ""), Locale("en", "")],
title: "OpenCanteen",
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
theme: ThemeData(
primarySwatch: Colors.purple,
),
darkTheme: ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
colorScheme: darkColorScheme),
primarySwatch: Colors.purple,
),
home: const LoginPage(),
)
: const CupertinoApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizations.delegate,
AppLocalizationsDelegate(),
...GlobalMaterialLocalizations.delegates
],
supportedLocales: AppLocalizations.supportedLocales,
supportedLocales: [Locale("cs", ""), Locale("en", "")],
title: "OpenCanteen",
theme: CupertinoThemeData(
primaryColor: Colors.purple,
@ -155,3 +159,25 @@ class MyApp extends StatelessWidget {
);
}
}
class AppLocalizationsDelegate extends LocalizationsDelegate<Languages> {
const AppLocalizationsDelegate();
@override
bool isSupported(Locale locale) => ['cs', 'en'].contains(locale.languageCode);
@override
Future<Languages> load(Locale locale) => _load(locale);
static Future<Languages> _load(Locale locale) async {
switch (locale.languageCode) {
case 'cs':
return LanguageCz();
default:
return LanguageEn();
}
}
@override
bool shouldReload(LocalizationsDelegate<Languages> old) => false;
}

View file

@ -5,7 +5,7 @@ import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformdialog.dart';
import 'package:opencanteen/util.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../lang/lang.dart';
class BurzaView extends StatefulWidget {
const BurzaView({Key? key, required this.canteen}) : super(key: key);
@ -34,10 +34,10 @@ class _BurzaViewState extends State<BurzaView> {
if (burza.isEmpty) {
content = [
Text(
AppLocalizations.of(context)!.noExchange,
Languages.of(context)!.noExchange,
style: const TextStyle(fontSize: 20),
),
Text(AppLocalizations.of(context)!.pullToReload)
Text(Languages.of(context)!.pullToReload)
];
} else {
for (var b in burza) {
@ -63,12 +63,11 @@ class _BurzaViewState extends State<BurzaView> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: AppLocalizations.of(context)!.ordered,
content:
AppLocalizations.of(context)!.orderSuccess,
title: Languages.of(context)!.ordered,
content: Languages.of(context)!.orderSuccess,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
@ -79,13 +78,11 @@ class _BurzaViewState extends State<BurzaView> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title:
AppLocalizations.of(context)!.cannotOrder,
content:
AppLocalizations.of(context)!.errorOrdering,
title: Languages.of(context)!.cannotOrder,
content: Languages.of(context)!.errorOrdering,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
@ -97,7 +94,7 @@ class _BurzaViewState extends State<BurzaView> {
},
);
},
text: AppLocalizations.of(context)!.order,
text: Languages.of(context)!.order,
),
],
),
@ -120,7 +117,7 @@ class _BurzaViewState extends State<BurzaView> {
return Scaffold(
drawer: drawerGenerator(context, widget.canteen, 3),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.exchange),
title: Text(Languages.of(context)!.exchange),
),
body: RefreshIndicator(
child: Center(
@ -129,7 +126,7 @@ class _BurzaViewState extends State<BurzaView> {
child: Column(
children: [
const SizedBox(height: 10),
Text("${AppLocalizations.of(context)!.balance}$balance"),
Text("${Languages.of(context)!.balance}$balance"),
const SizedBox(height: 10),
SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),

View file

@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../lang/lang.dart';
class MealView extends StatefulWidget {
const MealView({Key? key, required this.canteen}) : super(key: key);
@ -44,7 +44,7 @@ class _MealViewState extends State<MealView> {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.noOrder),
content: Text(Languages.of(context)!.noOrder),
duration: const Duration(seconds: 5),
action: SnackBarAction(
onPressed: () => setState(
@ -53,7 +53,7 @@ class _MealViewState extends State<MealView> {
loadMeals();
},
),
label: AppLocalizations.of(context)!.jump,
label: Languages.of(context)!.jump,
),
),
);
@ -67,25 +67,25 @@ class _MealViewState extends State<MealView> {
content = [const CircularProgressIndicator()];
switch (day.weekday) {
case 2:
dayOWeek = AppLocalizations.of(context)!.tuesday;
dayOWeek = Languages.of(context)!.tuesday;
break;
case 3:
dayOWeek = AppLocalizations.of(context)!.wednesday;
dayOWeek = Languages.of(context)!.wednesday;
break;
case 4:
dayOWeek = AppLocalizations.of(context)!.thursday;
dayOWeek = Languages.of(context)!.thursday;
break;
case 5:
dayOWeek = AppLocalizations.of(context)!.friday;
dayOWeek = Languages.of(context)!.friday;
break;
case 6:
dayOWeek = AppLocalizations.of(context)!.saturday;
dayOWeek = Languages.of(context)!.saturday;
break;
case 7:
dayOWeek = AppLocalizations.of(context)!.sunday;
dayOWeek = Languages.of(context)!.sunday;
break;
default:
dayOWeek = AppLocalizations.of(context)!.monday;
dayOWeek = Languages.of(context)!.monday;
}
var uzivatel = await widget.canteen.ziskejUzivatele().catchError(
(o) {
@ -98,7 +98,7 @@ class _MealViewState extends State<MealView> {
);
balance = uzivatel.kredit;
var jd = await widget.canteen.jidelnicekDen(den: day).catchError((_) {
showInfo(context, AppLocalizations.of(context)!.errorContacting);
showInfo(context, Languages.of(context)!.errorContacting);
return Jidelnicek(DateTime.now(), []);
});
setState(
@ -106,7 +106,7 @@ class _MealViewState extends State<MealView> {
content = [];
if (jd.jidla.isEmpty) {
content.add(Text(
AppLocalizations.of(context)!.noFood,
Languages.of(context)!.noFood,
style: const TextStyle(fontSize: 15),
));
} else {
@ -126,7 +126,7 @@ class _MealViewState extends State<MealView> {
),
),
Text((j.naBurze)
? AppLocalizations.of(context)!.inExchange
? Languages.of(context)!.inExchange
: "${j.cena}"),
Checkbox(
value: j.objednano,
@ -139,13 +139,11 @@ class _MealViewState extends State<MealView> {
context: context,
builder: (context) {
return PlatformDialog(
title: AppLocalizations.of(context)!
.errorOrdering,
content:
AppLocalizations.of(context)!.cannotOrder,
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -167,8 +165,7 @@ class _MealViewState extends State<MealView> {
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(AppLocalizations.of(context)!
.ordering)
Text(Languages.of(context)!.ordering)
],
),
),
@ -184,13 +181,11 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: AppLocalizations.of(context)!
.errorOrdering,
title: Languages.of(context)!.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text:
AppLocalizations.of(context)!.close,
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -211,11 +206,11 @@ class _MealViewState extends State<MealView> {
context: context,
builder: (context) {
return PlatformDialog(
title: AppLocalizations.of(context)!.errorOrdering,
content: AppLocalizations.of(context)!.cannotOrder,
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -236,7 +231,7 @@ class _MealViewState extends State<MealView> {
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(AppLocalizations.of(context)!.ordering)
Text(Languages.of(context)!.ordering)
]),
),
),
@ -250,12 +245,11 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title:
AppLocalizations.of(context)!.errorOrdering,
title: Languages.of(context)!.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.close,
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -274,19 +268,19 @@ class _MealViewState extends State<MealView> {
var d = await showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: AppLocalizations.of(context)!.verifyExchange,
title: Languages.of(context)!.verifyExchange,
actions: [
PlatformButton(
onPressed: () {
Navigator.pop(bc, true);
},
text: AppLocalizations.of(context)!.yes,
text: Languages.of(context)!.yes,
),
PlatformButton(
onPressed: () {
Navigator.pop(bc, false);
},
text: AppLocalizations.of(context)!.no,
text: Languages.of(context)!.no,
),
],
),
@ -299,12 +293,11 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title:
AppLocalizations.of(context)!.exchangeError,
title: Languages.of(context)!.exchangeError,
content: o.toString(),
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.close,
text: Languages.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -330,12 +323,12 @@ class _MealViewState extends State<MealView> {
}
Future<void> click(String value, BuildContext context) async {
if (value == AppLocalizations.of(context)!.signOut) {
if (value == Languages.of(context)!.signOut) {
await showDialog<bool>(
context: context,
builder: (c) => PlatformDialog(
title: AppLocalizations.of(context)!.warning,
content: AppLocalizations.of(context)!.signOutWarn,
title: Languages.of(context)!.warning,
content: Languages.of(context)!.signOutWarn,
actions: [
PlatformButton(
onPressed: () {
@ -346,41 +339,41 @@ class _MealViewState extends State<MealView> {
platformRouter((c) => const LoginPage()),
(route) => false);
},
text: AppLocalizations.of(context)!.yes),
text: Languages.of(context)!.yes),
PlatformButton(
onPressed: () => Navigator.of(context).pop(),
text: AppLocalizations.of(context)!.no,
text: Languages.of(context)!.no,
)
],
),
);
} else if (value == AppLocalizations.of(context)!.review) {
} 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"),
mode: LaunchMode.externalApplication);
} else if (value == AppLocalizations.of(context)!.reportBugs) {
} else if (value == Languages.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
mode: LaunchMode.externalApplication);
} else if (value == AppLocalizations.of(context)!.about) {
} else if (value == Languages.of(context)!.about) {
var packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
showAboutDialog(
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${AppLocalizations.of(context)!.copyright}\n${AppLocalizations.of(context)!.license}",
"${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: AppLocalizations.of(context)!.source,
text: Languages.of(context)!.source,
)
]);
} else if (value == AppLocalizations.of(context)!.settings) {
} else if (value == Languages.of(context)!.settings) {
Navigator.push(context, platformRouter((c) => const AndroidNastaveni()));
}
}
@ -416,7 +409,7 @@ class _MealViewState extends State<MealView> {
if (!mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!.errorSaving),
content: Text(Languages.of(context)!.errorSaving),
duration: const Duration(seconds: 5),
));
break;
@ -454,17 +447,17 @@ class _MealViewState extends State<MealView> {
return Scaffold(
drawer: drawerGenerator(context, widget.canteen, 1),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.menu),
title: Text(Languages.of(context)!.menu),
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
itemBuilder: (BuildContext context) {
return {
AppLocalizations.of(context)!.reportBugs,
AppLocalizations.of(context)!.review,
AppLocalizations.of(context)!.settings,
AppLocalizations.of(context)!.about,
AppLocalizations.of(context)!.signOut
Languages.of(context)!.reportBugs,
Languages.of(context)!.review,
Languages.of(context)!.settings,
Languages.of(context)!.about,
Languages.of(context)!.signOut
}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
@ -483,7 +476,7 @@ class _MealViewState extends State<MealView> {
child: Column(
children: [
const SizedBox(height: 10),
Text("${AppLocalizations.of(context)!.balance}$balance"),
Text("${Languages.of(context)!.balance}$balance"),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -528,7 +521,7 @@ class _MealViewState extends State<MealView> {
icon: const Icon(Icons.arrow_right),
),
Tooltip(
message: AppLocalizations.of(context)!.todayTooltip,
message: Languages.of(context)!.todayTooltip,
child: IconButton(
onPressed: () => setState(
() {

View file

@ -7,7 +7,7 @@ import 'package:opencanteen/okna/welcome.dart';
import 'package:opencanteen/pw/platformbutton.dart';
import 'package:opencanteen/pw/platformfield.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../lang/lang.dart';
import '../../loginmanager.dart';
import '../../main.dart';
import '../../util.dart';
@ -52,7 +52,7 @@ class _LoginPageState extends State<LoginPage> {
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(AppLocalizations.of(context)!.loggingIn)
Text(Languages.of(context)!.loggingIn)
]),
),
));
@ -64,7 +64,7 @@ class _LoginPageState extends State<LoginPage> {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.loginFailed),
content: Text(Languages.of(context)!.loginFailed),
),
);
return;
@ -90,11 +90,11 @@ class _LoginPageState extends State<LoginPage> {
} on PlatformException {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, AppLocalizations.of(context)!.corrupted);
showInfo(context, Languages.of(context)!.corrupted);
} catch (_) {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, AppLocalizations.of(context)!.errorContacting);
showInfo(context, Languages.of(context)!.errorContacting);
goOffline();
}
}
@ -105,7 +105,7 @@ class _LoginPageState extends State<LoginPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.logIn),
title: Text(Languages.of(context)!.logIn),
automaticallyImplyLeading: false,
),
body: Center(
@ -116,23 +116,23 @@ class _LoginPageState extends State<LoginPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
AppLocalizations.of(context)!.appName,
Languages.of(context)!.appName,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 40),
),
Text(
AppLocalizations.of(context)!.logIn,
Languages.of(context)!.logIn,
textAlign: TextAlign.center,
),
PlatformField(
controller: userControl,
autofillHints: const [AutofillHints.username],
labelText: AppLocalizations.of(context)!.username,
labelText: Languages.of(context)!.username,
),
PlatformField(
autofillHints: const [AutofillHints.password],
labelText: AppLocalizations.of(context)!.password,
labelText: Languages.of(context)!.password,
controller: passControl,
obscureText: true,
),
@ -164,7 +164,7 @@ class _LoginPageState extends State<LoginPage> {
duration: const Duration(milliseconds: 300),
child: PlatformField(
autofillHints: const [AutofillHints.url],
labelText: AppLocalizations.of(context)!.iCanteenUrl,
labelText: Languages.of(context)!.iCanteenUrl,
keyboardType: TextInputType.url,
controller: canteenControl,
),
@ -178,7 +178,7 @@ class _LoginPageState extends State<LoginPage> {
});
},
),
Text(AppLocalizations.of(context)!.rememberMe)
Text(Languages.of(context)!.rememberMe)
]),
PlatformButton(
onPressed: () async {
@ -195,8 +195,7 @@ class _LoginPageState extends State<LoginPage> {
userControl.text, passControl.text);
if (!l) {
if (!mounted) return;
showInfo(context,
AppLocalizations.of(context)!.loginFailed);
showInfo(context, Languages.of(context)!.loginFailed);
return;
}
if (rememberMe) {
@ -228,16 +227,15 @@ class _LoginPageState extends State<LoginPage> {
}
} on PlatformException {
if (!mounted) return;
showInfo(
context, AppLocalizations.of(context)!.corrupted);
showInfo(context, Languages.of(context)!.corrupted);
} on Exception catch (_) {
if (!mounted) return;
showInfo(context,
AppLocalizations.of(context)!.errorContacting);
showInfo(
context, Languages.of(context)!.errorContacting);
//goOffline();
}
},
text: AppLocalizations.of(context)!.logIn),
text: Languages.of(context)!.logIn),
],
),
),

View file

@ -13,7 +13,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:timezone/timezone.dart' as tz;
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../lang/lang.dart';
import '../../loginmanager.dart';
import '../../main.dart';
import '../../util.dart';
@ -74,7 +74,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.settings),
title: Text(Languages.of(context)!.settings),
),
body: Center(
child: SizedBox(
@ -84,7 +84,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(AppLocalizations.of(context)!.saveOffline),
Text(Languages.of(context)!.saveOffline),
PlatformSwitch(
value: _saveOffline,
onChanged: (value) {
@ -100,7 +100,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(AppLocalizations.of(context)!.saveCount),
Text(Languages.of(context)!.saveCount),
SizedBox(
width: 35,
child: PlatformField(
@ -121,7 +121,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(AppLocalizations.of(context)!.skipWeekend),
Text(Languages.of(context)!.skipWeekend),
PlatformSwitch(
value: _skipWeekend,
onChanged: (value) {
@ -138,8 +138,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(AppLocalizations.of(context)!.checkOrdered)),
Flexible(child: Text(Languages.of(context)!.checkOrdered)),
PlatformSwitch(
value: _checkWeek,
onChanged: (value) {
@ -156,8 +155,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(AppLocalizations.of(context)!.notifyLunch)),
Flexible(child: Text(Languages.of(context)!.notifyLunch)),
PlatformSwitch(
value: _notifyMeal,
thumbColor: (!_remember ? Colors.grey : null),
@ -166,11 +164,11 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: AppLocalizations.of(context)!.error,
content: AppLocalizations.of(context)!.needRemember,
title: Languages.of(context)!.error,
content: Languages.of(context)!.needRemember,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -185,12 +183,11 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: AppLocalizations.of(context)!.warning,
content:
AppLocalizations.of(context)!.notifyWarning,
title: Languages.of(context)!.warning,
content: Languages.of(context)!.notifyWarning,
actions: [
PlatformButton(
text: AppLocalizations.of(context)!.ok,
text: Languages.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -207,7 +204,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
)
],
),
Text(AppLocalizations.of(context)!.notifyAt),
Text(Languages.of(context)!.notifyAt),
PlatformButton(
onPressed: () async {
if (_notifyMeal) {
@ -275,7 +272,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
await flutterLocalNotificationsPlugin.zonedSchedule(
// schedules a notification
0,
AppLocalizations.of(context)!.lunchNotif,
Languages.of(context)!.lunchNotif,
"${jidlo.varianta} - ${jidlo.nazev}",
tz.TZDateTime.from(den, l),
const NotificationDetails(android: androidSpec),

View file

@ -11,7 +11,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../lang/lang.dart';
class OfflineMealView extends StatefulWidget {
const OfflineMealView({Key? key}) : super(key: key);
@ -56,25 +56,25 @@ class _OfflineMealViewState extends State<OfflineMealView> {
currentDay = jidelnicek[0].day;
switch (currentDay.weekday) {
case 2:
dayOWeek = AppLocalizations.of(context)!.tuesday;
dayOWeek = Languages.of(context)!.tuesday;
break;
case 3:
dayOWeek = AppLocalizations.of(context)!.wednesday;
dayOWeek = Languages.of(context)!.wednesday;
break;
case 4:
dayOWeek = AppLocalizations.of(context)!.thursday;
dayOWeek = Languages.of(context)!.thursday;
break;
case 5:
dayOWeek = AppLocalizations.of(context)!.friday;
dayOWeek = Languages.of(context)!.friday;
break;
case 6:
dayOWeek = AppLocalizations.of(context)!.saturday;
dayOWeek = Languages.of(context)!.saturday;
break;
case 7:
dayOWeek = AppLocalizations.of(context)!.sunday;
dayOWeek = Languages.of(context)!.sunday;
break;
default:
dayOWeek = AppLocalizations.of(context)!.monday;
dayOWeek = Languages.of(context)!.monday;
}
content = [];
for (OfflineMeal j in jidelnicek) {
@ -93,7 +93,7 @@ class _OfflineMealViewState extends State<OfflineMealView> {
),
),
Text((j.onExchange)
? AppLocalizations.of(context)!.inExchange
? Languages.of(context)!.inExchange
: "${j.price}"),
Checkbox(
value: j.ordered,
@ -112,34 +112,34 @@ class _OfflineMealViewState extends State<OfflineMealView> {
}
void click(String value, BuildContext context) async {
if (value == AppLocalizations.of(context)!.signOut) {
if (value == Languages.of(context)!.signOut) {
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushReplacement(
context, platformRouter((c) => const LoginPage()));
} else if (value == AppLocalizations.of(context)!.review) {
} 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"),
mode: LaunchMode.externalApplication);
} else if (value == AppLocalizations.of(context)!.reportBugs) {
} else if (value == Languages.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
mode: LaunchMode.externalApplication);
} else if (value == AppLocalizations.of(context)!.about) {
} else if (value == Languages.of(context)!.about) {
var packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
showAboutDialog(
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${AppLocalizations.of(context)!.copyright}\n${AppLocalizations.of(context)!.license}",
"${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: AppLocalizations.of(context)!.source,
text: Languages.of(context)!.source,
)
],
);
@ -163,17 +163,17 @@ class _OfflineMealViewState extends State<OfflineMealView> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.menu),
title: Text(Languages.of(context)!.menu),
automaticallyImplyLeading: false,
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
itemBuilder: (BuildContext context) {
return {
AppLocalizations.of(context)!.reportBugs,
AppLocalizations.of(context)!.review,
AppLocalizations.of(context)!.about,
AppLocalizations.of(context)!.signOut
Languages.of(context)!.reportBugs,
Languages.of(context)!.review,
Languages.of(context)!.about,
Languages.of(context)!.signOut
}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
@ -192,10 +192,10 @@ class _OfflineMealViewState extends State<OfflineMealView> {
children: [
const SizedBox(height: 10),
Text(
AppLocalizations.of(context)!.offline,
Languages.of(context)!.offline,
style: const TextStyle(fontWeight: FontWeight.bold),
),
Text(AppLocalizations.of(context)!.mustLogout),
Text(Languages.of(context)!.mustLogout),
const SizedBox(height: 10),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
IconButton(

View file

@ -2,7 +2,7 @@ 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:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:opencanteen/lang/lang.dart';
import 'package:opencanteen/okna/jidelnicek.dart';
import 'package:opencanteen/util.dart';
@ -20,39 +20,39 @@ class _WelcomePageState extends State<WelcomePage> {
Widget build(BuildContext context) {
var listPagesViewModel = [
PageViewModel(
title: AppLocalizations.of(context)!.welcome,
body: AppLocalizations.of(context)!.appDesc,
title: Languages.of(context)!.welcome,
body: Languages.of(context)!.appDesc,
image: const Center(
child: Icon(Icons.waving_hand_outlined, size: 175),
),
),
PageViewModel(
title: AppLocalizations.of(context)!.aboutOrder,
body: AppLocalizations.of(context)!.howOrder,
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: AppLocalizations.of(context)!.aboutToExch,
body: AppLocalizations.of(context)!.howToExch,
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: AppLocalizations.of(context)!.aboutFromExch,
body: AppLocalizations.of(context)!.howFromExch,
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: AppLocalizations.of(context)!.warning,
body: AppLocalizations.of(context)!.notOfficial,
title: Languages.of(context)!.warning,
body: Languages.of(context)!.notOfficial,
image: const Center(
child: Icon(Icons.warning_amber_outlined, size: 175),
),
@ -61,8 +61,8 @@ class _WelcomePageState extends State<WelcomePage> {
return Scaffold(
body: IntroductionScreen(
pages: listPagesViewModel,
next: Text(AppLocalizations.of(context)!.next),
done: Text(AppLocalizations.of(context)!.ok,
next: Text(Languages.of(context)!.next),
done: Text(Languages.of(context)!.ok,
style: const TextStyle(fontWeight: FontWeight.w600)),
onDone: () async {
const storage = FlutterSecureStorage();

View file

@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:opencanteen/okna/burza.dart';
import 'package:opencanteen/okna/jidelnicek.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'lang/lang.dart';
Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
Drawer drawer = const Drawer();
@ -17,17 +17,17 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
child: ListView(
children: [
DrawerHeader(
child: Text(AppLocalizations.of(context)!.appName),
child: Text(Languages.of(context)!.appName),
),
ListTile(
selected: true,
title: Text(AppLocalizations.of(context)!.home),
title: Text(Languages.of(context)!.home),
leading: const Icon(Icons.home),
onTap: () => Navigator.pop(context),
),
ListTile(
leading: const Icon(Icons.store),
title: Text(AppLocalizations.of(context)!.exchange),
title: Text(Languages.of(context)!.exchange),
onTap: () => Navigator.push(
context,
platformRouter((context) => BurzaView(canteen: canteen)),
@ -43,11 +43,11 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
child: ListView(
children: [
DrawerHeader(
child: Text(AppLocalizations.of(context)!.appName),
child: Text(Languages.of(context)!.appName),
),
ListTile(
leading: const Icon(Icons.home),
title: Text(AppLocalizations.of(context)!.home),
title: Text(Languages.of(context)!.home),
onTap: () => Navigator.push(
context,
platformRouter((c) => MealView(canteen: canteen)),
@ -56,7 +56,7 @@ Drawer drawerGenerator(BuildContext context, Canteen canteen, int p) {
ListTile(
leading: const Icon(Icons.store),
selected: true,
title: Text(AppLocalizations.of(context)!.exchange),
title: Text(Languages.of(context)!.exchange),
onTap: () => Navigator.pop(context),
),
],

View file

@ -1,3 +0,0 @@
- Aktualizovány knihovny
- Vylepšen kódový základ
- Přidána podpora Material 3

View file

@ -1,3 +0,0 @@
- Updated libraries
- Polished codebase
- Added Material 3 support

View file

@ -183,10 +183,10 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: f2afec1f1762c040a349ea2a588e32f442da5d0db3494a52a929a97c9e550bc5
sha256: "1b7c2f80ee41861543bc63fee56122a114129c15234731312418ca1eda7d3d7f"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "5.0.2"
flutter_secure_storage_linux:
dependency: transitive
description:
@ -199,10 +199,10 @@ packages:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: ff0768a6700ea1d9620e03518e2e25eac86a8bd07ca3556e9617bfa5ace4bd00
sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "1.1.2"
flutter_secure_storage_platform_interface:
dependency: transitive
description:

View file

@ -17,7 +17,7 @@ dependencies:
flutter_localizations:
sdk: flutter
canteenlib: ^1.1.1
flutter_secure_storage: ^7.0.1
flutter_secure_storage: 5.0.2
url_launcher: ^6.0.20
path_provider: ^2.0.9
shared_preferences: ^2.0.13
@ -42,7 +42,6 @@ flutter_icons:
flutter:
uses-material-design: true
generate: true
# To add assets to your application, add an assets section, like this:
assets: