Compare commits

...

6 commits

Author SHA1 Message Date
Matyáš Caras
b948959e67 feat: implementovat Material 3 a upravit systém lokalizací (#37)
Reviewed-on: #37
2023-01-28 15:59:41 +01:00
Matyáš Caras
2227bb59ce chore: aktualizovat changelogy 2023-01-28 15:57:48 +01:00
Matyáš Caras
6a3d0249ab chore: aktualizovat secure_storage 2023-01-28 15:54:21 +01:00
Matyáš Caras
fb737dc40f fix: locale? 2023-01-28 15:44:06 +01:00
Matyáš Caras
17d14cb175 feat: předělat jazykový systém 2023-01-28 15:41:17 +01:00
Matyáš Caras
813c8cf3da feat: Material 3 2023-01-28 15:02:44 +01:00
21 changed files with 256 additions and 856 deletions

View file

@ -1,3 +1,8 @@
# 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>Czech</string>
<string>cs</string>
<string>en</string>
</array>
<key>CFBundleDevelopmentRegion</key>

3
l10n.yaml Normal file
View file

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

69
lib/color_schemes.g.dart Normal file
View file

@ -0,0 +1,69 @@
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),
);

1
lib/l10n/app_cs.arb Normal file
View file

@ -0,0 +1 @@
{"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"}

1
lib/l10n/app_en.arb Normal file
View file

@ -0,0 +1 @@
{"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"}

View file

@ -1,177 +0,0 @@
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;
}

View file

@ -1,250 +0,0 @@
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";
}

View file

@ -1,248 +0,0 @@
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,8 +5,6 @@ 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';
@ -15,9 +13,9 @@ import 'package:intl/intl.dart';
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import 'lang/lang.dart';
import 'lang/lang_en.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'color_schemes.g.dart';
import 'loginmanager.dart';
/*
Copyright (C) 2022 Matyáš Caras a přispěvatelé
@ -45,10 +43,10 @@ void setupNotification(SharedPreferences prefs, tz.Location l) async {
String locale = Intl.getCurrentLocale();
switch (locale) {
case "cs_CZ":
title = LanguageCz().lunchNotif;
title = "Dnes máte objednáno";
break;
default:
title = LanguageEn().lunchNotif;
title = "Today's ordered meal";
}
/*if (prefs.getBool("offline") ?? false) {
@ -130,27 +128,25 @@ class MyApp extends StatelessWidget {
? MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
AppLocalizationsDelegate(),
AppLocalizations.delegate,
...GlobalMaterialLocalizations.delegates
],
supportedLocales: const [Locale("cs", ""), Locale("en", "")],
supportedLocales: AppLocalizations.supportedLocales,
title: "OpenCanteen",
theme: ThemeData(
primarySwatch: Colors.purple,
),
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
darkTheme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.purple,
),
useMaterial3: true,
colorScheme: darkColorScheme),
home: const LoginPage(),
)
: const CupertinoApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizationsDelegate(),
AppLocalizations.delegate,
...GlobalMaterialLocalizations.delegates
],
supportedLocales: [Locale("cs", ""), Locale("en", "")],
supportedLocales: AppLocalizations.supportedLocales,
title: "OpenCanteen",
theme: CupertinoThemeData(
primaryColor: Colors.purple,
@ -159,25 +155,3 @@ 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 '../../lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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(
Languages.of(context)!.noExchange,
AppLocalizations.of(context)!.noExchange,
style: const TextStyle(fontSize: 20),
),
Text(Languages.of(context)!.pullToReload)
Text(AppLocalizations.of(context)!.pullToReload)
];
} else {
for (var b in burza) {
@ -63,11 +63,12 @@ class _BurzaViewState extends State<BurzaView> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.ordered,
content: Languages.of(context)!.orderSuccess,
title: AppLocalizations.of(context)!.ordered,
content:
AppLocalizations.of(context)!.orderSuccess,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
@ -78,11 +79,13 @@ class _BurzaViewState extends State<BurzaView> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.cannotOrder,
content: Languages.of(context)!.errorOrdering,
title:
AppLocalizations.of(context)!.cannotOrder,
content:
AppLocalizations.of(context)!.errorOrdering,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () =>
Navigator.of(context).pop(),
)
@ -94,7 +97,7 @@ class _BurzaViewState extends State<BurzaView> {
},
);
},
text: Languages.of(context)!.order,
text: AppLocalizations.of(context)!.order,
),
],
),
@ -117,7 +120,7 @@ class _BurzaViewState extends State<BurzaView> {
return Scaffold(
drawer: drawerGenerator(context, widget.canteen, 3),
appBar: AppBar(
title: Text(Languages.of(context)!.exchange),
title: Text(AppLocalizations.of(context)!.exchange),
),
body: RefreshIndicator(
child: Center(
@ -126,7 +129,7 @@ class _BurzaViewState extends State<BurzaView> {
child: Column(
children: [
const SizedBox(height: 10),
Text("${Languages.of(context)!.balance}$balance"),
Text("${AppLocalizations.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 '../../lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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(Languages.of(context)!.noOrder),
content: Text(AppLocalizations.of(context)!.noOrder),
duration: const Duration(seconds: 5),
action: SnackBarAction(
onPressed: () => setState(
@ -53,7 +53,7 @@ class _MealViewState extends State<MealView> {
loadMeals();
},
),
label: Languages.of(context)!.jump,
label: AppLocalizations.of(context)!.jump,
),
),
);
@ -67,25 +67,25 @@ class _MealViewState extends State<MealView> {
content = [const CircularProgressIndicator()];
switch (day.weekday) {
case 2:
dayOWeek = Languages.of(context)!.tuesday;
dayOWeek = AppLocalizations.of(context)!.tuesday;
break;
case 3:
dayOWeek = Languages.of(context)!.wednesday;
dayOWeek = AppLocalizations.of(context)!.wednesday;
break;
case 4:
dayOWeek = Languages.of(context)!.thursday;
dayOWeek = AppLocalizations.of(context)!.thursday;
break;
case 5:
dayOWeek = Languages.of(context)!.friday;
dayOWeek = AppLocalizations.of(context)!.friday;
break;
case 6:
dayOWeek = Languages.of(context)!.saturday;
dayOWeek = AppLocalizations.of(context)!.saturday;
break;
case 7:
dayOWeek = Languages.of(context)!.sunday;
dayOWeek = AppLocalizations.of(context)!.sunday;
break;
default:
dayOWeek = Languages.of(context)!.monday;
dayOWeek = AppLocalizations.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, Languages.of(context)!.errorContacting);
showInfo(context, AppLocalizations.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(
Languages.of(context)!.noFood,
AppLocalizations.of(context)!.noFood,
style: const TextStyle(fontSize: 15),
));
} else {
@ -126,7 +126,7 @@ class _MealViewState extends State<MealView> {
),
),
Text((j.naBurze)
? Languages.of(context)!.inExchange
? AppLocalizations.of(context)!.inExchange
: "${j.cena}"),
Checkbox(
value: j.objednano,
@ -139,11 +139,13 @@ class _MealViewState extends State<MealView> {
context: context,
builder: (context) {
return PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
title: AppLocalizations.of(context)!
.errorOrdering,
content:
AppLocalizations.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -165,7 +167,8 @@ class _MealViewState extends State<MealView> {
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
Text(AppLocalizations.of(context)!
.ordering)
],
),
),
@ -181,11 +184,13 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.errorOrdering,
title: AppLocalizations.of(context)!
.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
text:
AppLocalizations.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -206,11 +211,11 @@ class _MealViewState extends State<MealView> {
context: context,
builder: (context) {
return PlatformDialog(
title: Languages.of(context)!.errorOrdering,
content: Languages.of(context)!.cannotOrder,
title: AppLocalizations.of(context)!.errorOrdering,
content: AppLocalizations.of(context)!.cannotOrder,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -231,7 +236,7 @@ class _MealViewState extends State<MealView> {
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
Text(AppLocalizations.of(context)!.ordering)
]),
),
),
@ -245,11 +250,12 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.errorOrdering,
title:
AppLocalizations.of(context)!.errorOrdering,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
text: AppLocalizations.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -268,19 +274,19 @@ class _MealViewState extends State<MealView> {
var d = await showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.verifyExchange,
title: AppLocalizations.of(context)!.verifyExchange,
actions: [
PlatformButton(
onPressed: () {
Navigator.pop(bc, true);
},
text: Languages.of(context)!.yes,
text: AppLocalizations.of(context)!.yes,
),
PlatformButton(
onPressed: () {
Navigator.pop(bc, false);
},
text: Languages.of(context)!.no,
text: AppLocalizations.of(context)!.no,
),
],
),
@ -293,11 +299,12 @@ class _MealViewState extends State<MealView> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.exchangeError,
title:
AppLocalizations.of(context)!.exchangeError,
content: o.toString(),
actions: [
PlatformButton(
text: Languages.of(context)!.close,
text: AppLocalizations.of(context)!.close,
onPressed: () {
Navigator.pop(bc);
},
@ -323,12 +330,12 @@ class _MealViewState extends State<MealView> {
}
Future<void> click(String value, BuildContext context) async {
if (value == Languages.of(context)!.signOut) {
if (value == AppLocalizations.of(context)!.signOut) {
await showDialog<bool>(
context: context,
builder: (c) => PlatformDialog(
title: Languages.of(context)!.warning,
content: Languages.of(context)!.signOutWarn,
title: AppLocalizations.of(context)!.warning,
content: AppLocalizations.of(context)!.signOutWarn,
actions: [
PlatformButton(
onPressed: () {
@ -339,41 +346,41 @@ class _MealViewState extends State<MealView> {
platformRouter((c) => const LoginPage()),
(route) => false);
},
text: Languages.of(context)!.yes),
text: AppLocalizations.of(context)!.yes),
PlatformButton(
onPressed: () => Navigator.of(context).pop(),
text: Languages.of(context)!.no,
text: AppLocalizations.of(context)!.no,
)
],
),
);
} else if (value == Languages.of(context)!.review) {
} else if (value == AppLocalizations.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 == Languages.of(context)!.reportBugs) {
} else if (value == AppLocalizations.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
mode: LaunchMode.externalApplication);
} else if (value == Languages.of(context)!.about) {
} else if (value == AppLocalizations.of(context)!.about) {
var packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
showAboutDialog(
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${Languages.of(context)!.copyright}\n${Languages.of(context)!.license}",
"${AppLocalizations.of(context)!.copyright}\n${AppLocalizations.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,
text: AppLocalizations.of(context)!.source,
)
]);
} else if (value == Languages.of(context)!.settings) {
} else if (value == AppLocalizations.of(context)!.settings) {
Navigator.push(context, platformRouter((c) => const AndroidNastaveni()));
}
}
@ -409,7 +416,7 @@ class _MealViewState extends State<MealView> {
if (!mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(Languages.of(context)!.errorSaving),
content: Text(AppLocalizations.of(context)!.errorSaving),
duration: const Duration(seconds: 5),
));
break;
@ -447,17 +454,17 @@ class _MealViewState extends State<MealView> {
return Scaffold(
drawer: drawerGenerator(context, widget.canteen, 1),
appBar: AppBar(
title: Text(Languages.of(context)!.menu),
title: Text(AppLocalizations.of(context)!.menu),
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
itemBuilder: (BuildContext context) {
return {
Languages.of(context)!.reportBugs,
Languages.of(context)!.review,
Languages.of(context)!.settings,
Languages.of(context)!.about,
Languages.of(context)!.signOut
AppLocalizations.of(context)!.reportBugs,
AppLocalizations.of(context)!.review,
AppLocalizations.of(context)!.settings,
AppLocalizations.of(context)!.about,
AppLocalizations.of(context)!.signOut
}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
@ -476,7 +483,7 @@ class _MealViewState extends State<MealView> {
child: Column(
children: [
const SizedBox(height: 10),
Text("${Languages.of(context)!.balance}$balance"),
Text("${AppLocalizations.of(context)!.balance}$balance"),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -521,7 +528,7 @@ class _MealViewState extends State<MealView> {
icon: const Icon(Icons.arrow_right),
),
Tooltip(
message: Languages.of(context)!.todayTooltip,
message: AppLocalizations.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 '../../lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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(Languages.of(context)!.loggingIn)
Text(AppLocalizations.of(context)!.loggingIn)
]),
),
));
@ -64,7 +64,7 @@ class _LoginPageState extends State<LoginPage> {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(Languages.of(context)!.loginFailed),
content: Text(AppLocalizations.of(context)!.loginFailed),
),
);
return;
@ -90,11 +90,11 @@ class _LoginPageState extends State<LoginPage> {
} on PlatformException {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, Languages.of(context)!.corrupted);
showInfo(context, AppLocalizations.of(context)!.corrupted);
} catch (_) {
if (!mounted) return;
Navigator.of(context).pop();
showInfo(context, Languages.of(context)!.errorContacting);
showInfo(context, AppLocalizations.of(context)!.errorContacting);
goOffline();
}
}
@ -105,7 +105,7 @@ class _LoginPageState extends State<LoginPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Languages.of(context)!.logIn),
title: Text(AppLocalizations.of(context)!.logIn),
automaticallyImplyLeading: false,
),
body: Center(
@ -116,23 +116,23 @@ class _LoginPageState extends State<LoginPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
Languages.of(context)!.appName,
AppLocalizations.of(context)!.appName,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 40),
),
Text(
Languages.of(context)!.logIn,
AppLocalizations.of(context)!.logIn,
textAlign: TextAlign.center,
),
PlatformField(
controller: userControl,
autofillHints: const [AutofillHints.username],
labelText: Languages.of(context)!.username,
labelText: AppLocalizations.of(context)!.username,
),
PlatformField(
autofillHints: const [AutofillHints.password],
labelText: Languages.of(context)!.password,
labelText: AppLocalizations.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: Languages.of(context)!.iCanteenUrl,
labelText: AppLocalizations.of(context)!.iCanteenUrl,
keyboardType: TextInputType.url,
controller: canteenControl,
),
@ -178,7 +178,7 @@ class _LoginPageState extends State<LoginPage> {
});
},
),
Text(Languages.of(context)!.rememberMe)
Text(AppLocalizations.of(context)!.rememberMe)
]),
PlatformButton(
onPressed: () async {
@ -195,7 +195,8 @@ class _LoginPageState extends State<LoginPage> {
userControl.text, passControl.text);
if (!l) {
if (!mounted) return;
showInfo(context, Languages.of(context)!.loginFailed);
showInfo(context,
AppLocalizations.of(context)!.loginFailed);
return;
}
if (rememberMe) {
@ -227,15 +228,16 @@ class _LoginPageState extends State<LoginPage> {
}
} on PlatformException {
if (!mounted) return;
showInfo(context, Languages.of(context)!.corrupted);
showInfo(
context, AppLocalizations.of(context)!.corrupted);
} on Exception catch (_) {
if (!mounted) return;
showInfo(
context, Languages.of(context)!.errorContacting);
showInfo(context,
AppLocalizations.of(context)!.errorContacting);
//goOffline();
}
},
text: Languages.of(context)!.logIn),
text: AppLocalizations.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 '../../lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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(Languages.of(context)!.settings),
title: Text(AppLocalizations.of(context)!.settings),
),
body: Center(
child: SizedBox(
@ -84,7 +84,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveOffline),
Text(AppLocalizations.of(context)!.saveOffline),
PlatformSwitch(
value: _saveOffline,
onChanged: (value) {
@ -100,7 +100,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.saveCount),
Text(AppLocalizations.of(context)!.saveCount),
SizedBox(
width: 35,
child: PlatformField(
@ -121,7 +121,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(Languages.of(context)!.skipWeekend),
Text(AppLocalizations.of(context)!.skipWeekend),
PlatformSwitch(
value: _skipWeekend,
onChanged: (value) {
@ -138,7 +138,8 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.checkOrdered)),
Flexible(
child: Text(AppLocalizations.of(context)!.checkOrdered)),
PlatformSwitch(
value: _checkWeek,
onChanged: (value) {
@ -155,7 +156,8 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(Languages.of(context)!.notifyLunch)),
Flexible(
child: Text(AppLocalizations.of(context)!.notifyLunch)),
PlatformSwitch(
value: _notifyMeal,
thumbColor: (!_remember ? Colors.grey : null),
@ -164,11 +166,11 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
showDialog(
context: context,
builder: (bc) => PlatformDialog(
title: Languages.of(context)!.error,
content: Languages.of(context)!.needRemember,
title: AppLocalizations.of(context)!.error,
content: AppLocalizations.of(context)!.needRemember,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -183,11 +185,12 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
showDialog(
context: context,
builder: (context) => PlatformDialog(
title: Languages.of(context)!.warning,
content: Languages.of(context)!.notifyWarning,
title: AppLocalizations.of(context)!.warning,
content:
AppLocalizations.of(context)!.notifyWarning,
actions: [
PlatformButton(
text: Languages.of(context)!.ok,
text: AppLocalizations.of(context)!.ok,
onPressed: () {
Navigator.of(context).pop();
},
@ -204,7 +207,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
)
],
),
Text(Languages.of(context)!.notifyAt),
Text(AppLocalizations.of(context)!.notifyAt),
PlatformButton(
onPressed: () async {
if (_notifyMeal) {
@ -272,7 +275,7 @@ class _AndroidNastaveniState extends State<AndroidNastaveni> {
await flutterLocalNotificationsPlugin.zonedSchedule(
// schedules a notification
0,
Languages.of(context)!.lunchNotif,
AppLocalizations.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 '../../lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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 = Languages.of(context)!.tuesday;
dayOWeek = AppLocalizations.of(context)!.tuesday;
break;
case 3:
dayOWeek = Languages.of(context)!.wednesday;
dayOWeek = AppLocalizations.of(context)!.wednesday;
break;
case 4:
dayOWeek = Languages.of(context)!.thursday;
dayOWeek = AppLocalizations.of(context)!.thursday;
break;
case 5:
dayOWeek = Languages.of(context)!.friday;
dayOWeek = AppLocalizations.of(context)!.friday;
break;
case 6:
dayOWeek = Languages.of(context)!.saturday;
dayOWeek = AppLocalizations.of(context)!.saturday;
break;
case 7:
dayOWeek = Languages.of(context)!.sunday;
dayOWeek = AppLocalizations.of(context)!.sunday;
break;
default:
dayOWeek = Languages.of(context)!.monday;
dayOWeek = AppLocalizations.of(context)!.monday;
}
content = [];
for (OfflineMeal j in jidelnicek) {
@ -93,7 +93,7 @@ class _OfflineMealViewState extends State<OfflineMealView> {
),
),
Text((j.onExchange)
? Languages.of(context)!.inExchange
? AppLocalizations.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 == Languages.of(context)!.signOut) {
if (value == AppLocalizations.of(context)!.signOut) {
const storage = FlutterSecureStorage();
storage.deleteAll();
Navigator.pushReplacement(
context, platformRouter((c) => const LoginPage()));
} else if (value == Languages.of(context)!.review) {
} else if (value == AppLocalizations.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 == Languages.of(context)!.reportBugs) {
} else if (value == AppLocalizations.of(context)!.reportBugs) {
launchUrl(Uri.parse("https://forms.gle/jKN7QeFJwpaApSbC8"),
mode: LaunchMode.externalApplication);
} else if (value == Languages.of(context)!.about) {
} else if (value == AppLocalizations.of(context)!.about) {
var packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
showAboutDialog(
context: context,
applicationName: "OpenCanteen",
applicationLegalese:
"${Languages.of(context)!.copyright}\n${Languages.of(context)!.license}",
"${AppLocalizations.of(context)!.copyright}\n${AppLocalizations.of(context)!.license}",
applicationVersion: packageInfo.version,
children: [
PlatformButton(
onPressed: (() => launchUrl(
Uri.parse("https://git.mnau.xyz/hernik/opencanteen"))),
text: Languages.of(context)!.source,
text: AppLocalizations.of(context)!.source,
)
],
);
@ -163,17 +163,17 @@ class _OfflineMealViewState extends State<OfflineMealView> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Languages.of(context)!.menu),
title: Text(AppLocalizations.of(context)!.menu),
automaticallyImplyLeading: false,
actions: [
PopupMenuButton(
onSelected: ((String value) => click(value, context)),
itemBuilder: (BuildContext context) {
return {
Languages.of(context)!.reportBugs,
Languages.of(context)!.review,
Languages.of(context)!.about,
Languages.of(context)!.signOut
AppLocalizations.of(context)!.reportBugs,
AppLocalizations.of(context)!.review,
AppLocalizations.of(context)!.about,
AppLocalizations.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(
Languages.of(context)!.offline,
AppLocalizations.of(context)!.offline,
style: const TextStyle(fontWeight: FontWeight.bold),
),
Text(Languages.of(context)!.mustLogout),
Text(AppLocalizations.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:opencanteen/lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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: Languages.of(context)!.welcome,
body: Languages.of(context)!.appDesc,
title: AppLocalizations.of(context)!.welcome,
body: AppLocalizations.of(context)!.appDesc,
image: const Center(
child: Icon(Icons.waving_hand_outlined, size: 175),
),
),
PageViewModel(
title: Languages.of(context)!.aboutOrder,
body: Languages.of(context)!.howOrder,
title: AppLocalizations.of(context)!.aboutOrder,
body: AppLocalizations.of(context)!.howOrder,
image: Center(
child: Image.asset('assets/objednavam.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
title: Languages.of(context)!.aboutToExch,
body: Languages.of(context)!.howToExch,
title: AppLocalizations.of(context)!.aboutToExch,
body: AppLocalizations.of(context)!.howToExch,
image: Center(
child: Image.asset('assets/doburzy.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
title: Languages.of(context)!.aboutFromExch,
body: Languages.of(context)!.howFromExch,
title: AppLocalizations.of(context)!.aboutFromExch,
body: AppLocalizations.of(context)!.howFromExch,
image: Center(
child: Image.asset('assets/burza.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
title: Languages.of(context)!.warning,
body: Languages.of(context)!.notOfficial,
title: AppLocalizations.of(context)!.warning,
body: AppLocalizations.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(Languages.of(context)!.next),
done: Text(Languages.of(context)!.ok,
next: Text(AppLocalizations.of(context)!.next),
done: Text(AppLocalizations.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 'lang/lang.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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(Languages.of(context)!.appName),
child: Text(AppLocalizations.of(context)!.appName),
),
ListTile(
selected: true,
title: Text(Languages.of(context)!.home),
title: Text(AppLocalizations.of(context)!.home),
leading: const Icon(Icons.home),
onTap: () => Navigator.pop(context),
),
ListTile(
leading: const Icon(Icons.store),
title: Text(Languages.of(context)!.exchange),
title: Text(AppLocalizations.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(Languages.of(context)!.appName),
child: Text(AppLocalizations.of(context)!.appName),
),
ListTile(
leading: const Icon(Icons.home),
title: Text(Languages.of(context)!.home),
title: Text(AppLocalizations.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(Languages.of(context)!.exchange),
title: Text(AppLocalizations.of(context)!.exchange),
onTap: () => Navigator.pop(context),
),
],

View file

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

View file

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

View file

@ -183,10 +183,10 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "1b7c2f80ee41861543bc63fee56122a114129c15234731312418ca1eda7d3d7f"
sha256: f2afec1f1762c040a349ea2a588e32f442da5d0db3494a52a929a97c9e550bc5
url: "https://pub.dev"
source: hosted
version: "5.0.2"
version: "7.0.1"
flutter_secure_storage_linux:
dependency: transitive
description:
@ -199,10 +199,10 @@ packages:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd"
sha256: ff0768a6700ea1d9620e03518e2e25eac86a8bd07ca3556e9617bfa5ace4bd00
url: "https://pub.dev"
source: hosted
version: "1.1.2"
version: "2.0.1"
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: 5.0.2
flutter_secure_storage: ^7.0.1
url_launcher: ^6.0.20
path_provider: ^2.0.9
shared_preferences: ^2.0.13
@ -42,6 +42,7 @@ flutter_icons:
flutter:
uses-material-design: true
generate: true
# To add assets to your application, add an assets section, like this:
assets: