fix: synchronizovat opravy z dev větve

This commit is contained in:
Matyáš Caras 2022-05-19 20:01:47 +02:00 committed by GitHub
commit ce0c2d2858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 140 additions and 84 deletions

View file

@ -1,3 +1,7 @@
# 1.1.1
- Přidat informaci o neobjednatelném obědě (specialitka pro apple)
- Zobrazovat uvítací obrazovku při nedokončení i když je uživatel zapamatován
- Kalendář se zobrazuje ve správném jazyce
# 1.1.0
- Přidat uvítací obrazovku při prvním spuštění
- Mírné vyčištění kódu

View file

@ -14,7 +14,7 @@ class LanguageCz extends Languages {
String get balance => "Kredit: ";
@override
String get cannotOrder => "Nelze objednat";
String get cannotOrder => "Toto jídlo není možné objednat.";
@override
String get close => "Zavřít";

View file

@ -14,7 +14,7 @@ class LanguageEn extends Languages {
String get balance => "Balance: ";
@override
String get cannotOrder => "Cannot order";
String get cannotOrder => "This food cannot be ordered.";
@override
String get close => "Close";

View file

@ -120,13 +120,22 @@ class _LoginPageState extends State<LoginPage> {
);
return;
}
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => JidelnicekPage(
canteen: canteen,
)),
);
const storage = FlutterSecureStorage();
var odsouhlasil = await storage.read(key: "oc_souhlas");
if (odsouhlasil == null || odsouhlasil != "ano") {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (c) => WelcomeScreen(canteen: canteen)));
} else {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => JidelnicekPage(
canteen: canteen,
)),
);
}
} catch (_) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(

View file

@ -86,89 +86,132 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
? MaterialStateProperty.all(Colors.blue)
: MaterialStateProperty.all(Colors.grey),
onChanged: (v) async {
if (!j.lzeObjednat) return;
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child:
CircularProgressIndicator(),
),
Text(
Languages.of(context)!.ordering)
]),
),
));
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true)
.pop();
nactiJidlo();
}).catchError((o) {
Navigator.of(context, rootNavigator: true)
.pop();
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (bc) => AlertDialog(
title: Text(Languages.of(context)!
.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child: Text(
Languages.of(context)!.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
builder: (context) {
return AlertDialog(
title: Text(Languages.of(context)!
.errorOrdering),
content: Text(
Languages.of(context)!.cannotOrder),
actions: [
TextButton(
child:
Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
});
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child:
CircularProgressIndicator(),
),
Text(Languages.of(context)!
.ordering)
]),
),
));
});
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true)
.pop();
nactiJidlo();
}).catchError((o) {
Navigator.of(context, rootNavigator: true)
.pop();
showDialog(
context: context,
builder: (bc) => AlertDialog(
title: Text(Languages.of(context)!
.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child: Text(
Languages.of(context)!
.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
));
});
}
})
],
),
onTap: () async {
if (!j.lzeObjednat) return;
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
]),
),
));
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true).pop();
nactiJidlo();
}).catchError((o) {
Navigator.of(context, rootNavigator: true).pop();
if (!j.lzeObjednat) {
showDialog(
context: context,
builder: (bc) => AlertDialog(
title: Text(
Languages.of(context)!.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child: Text(Languages.of(context)!.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
builder: (context) {
return AlertDialog(
title:
Text(Languages.of(context)!.errorOrdering),
content:
Text(Languages.of(context)!.cannotOrder),
actions: [
TextButton(
child: Text(Languages.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
});
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => Dialog(
child: SizedBox(
height: 100,
child: Row(children: [
const Padding(
padding: EdgeInsets.all(10),
child: CircularProgressIndicator(),
),
Text(Languages.of(context)!.ordering)
]),
),
));
});
widget.canteen.objednat(j).then((_) {
Navigator.of(context, rootNavigator: true).pop();
nactiJidlo();
}).catchError((o) {
Navigator.of(context, rootNavigator: true).pop();
showDialog(
context: context,
builder: (bc) => AlertDialog(
title: Text(
Languages.of(context)!.errorOrdering),
content: Text(o.toString()),
actions: [
TextButton(
child:
Text(Languages.of(context)!.close),
onPressed: () {
Navigator.pop(bc);
},
)
],
));
});
}
},
onLongPress: () async {
if (!j.objednano || j.burzaUrl == null) return;
@ -350,7 +393,7 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
currentDate: den,
firstDate: DateTime(2019, 1, 1),
lastDate: DateTime(den.year + 1, 12, 31),
locale: const Locale("cs"));
locale: Localizations.localeOf(context));
if (datePicked == null) return;
setState(() {
den = datePicked;

View file

@ -6,7 +6,7 @@ publish_to: 'none'
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
version: 1.1.0+4
version: 1.1.1+5
environment:
sdk: ">=2.16.1 <3.0.0"