feat: vylepšit oznámení o neobjednaném jídle
This commit is contained in:
parent
28eba7d9ab
commit
ce9eb97ac9
4 changed files with 36 additions and 13 deletions
|
@ -91,6 +91,8 @@ abstract class Languages {
|
||||||
|
|
||||||
String get signOutWarn;
|
String get signOutWarn;
|
||||||
|
|
||||||
|
String get jump;
|
||||||
|
|
||||||
// Uvítací obrazovka
|
// Uvítací obrazovka
|
||||||
|
|
||||||
String get welcome;
|
String get welcome;
|
||||||
|
|
|
@ -231,4 +231,7 @@ class LanguageCz extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get signOutWarn => "Opravdu se chcete odhlásit?";
|
String get signOutWarn => "Opravdu se chcete odhlásit?";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get jump => "Přeskočit";
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,4 +229,7 @@ class LanguageEn extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get signOutWarn => "Do you really want to sign out?";
|
String get signOutWarn => "Do you really want to sign out?";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get jump => "Jump";
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,18 +35,31 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
||||||
var prefs = await SharedPreferences.getInstance();
|
var prefs = await SharedPreferences.getInstance();
|
||||||
if (prefs.getBool("tyden") ?? false) {
|
if (prefs.getBool("tyden") ?? false) {
|
||||||
// Zjistit jestli je objednáno na přístí týden
|
// Zjistit jestli je objednáno na přístí týden
|
||||||
var pristi = den.add(const Duration(days: 7));
|
var pristi = den.add(const Duration(days: 6));
|
||||||
var jidelnicek = await widget.canteen.jidelnicekDen(den: pristi);
|
for (var i = 0; i < 5; i++) {
|
||||||
|
var jidelnicek = await widget.canteen
|
||||||
|
.jidelnicekDen(den: pristi.add(Duration(days: i + 1)));
|
||||||
if (jidelnicek.jidla.isNotEmpty &&
|
if (jidelnicek.jidla.isNotEmpty &&
|
||||||
!jidelnicek.jidla.any((element) => element.objednano == true)) {
|
!jidelnicek.jidla.any((element) => element.objednano == true)) {
|
||||||
if (!mounted) return;
|
if (!mounted) break;
|
||||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(Languages.of(context)!.noOrder),
|
content: Text(Languages.of(context)!.noOrder),
|
||||||
duration: const Duration(seconds: 5),
|
duration: const Duration(seconds: 5),
|
||||||
|
action: SnackBarAction(
|
||||||
|
onPressed: () => setState(
|
||||||
|
() {
|
||||||
|
den = pristi.add(Duration(days: i + 1));
|
||||||
|
nactiJidlo();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
label: Languages.of(context)!.jump,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +307,6 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kontrolaTyden(context);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catchError((o) {
|
}).catchError((o) {
|
||||||
|
@ -343,6 +355,9 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
||||||
void nactiNastaveni() async {
|
void nactiNastaveni() async {
|
||||||
var prefs = await SharedPreferences.getInstance();
|
var prefs = await SharedPreferences.getInstance();
|
||||||
_skipWeekend = prefs.getBool("skip") ?? false;
|
_skipWeekend = prefs.getBool("skip") ?? false;
|
||||||
|
print(mounted);
|
||||||
|
if (!mounted) return;
|
||||||
|
kontrolaTyden(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// uložení jídelníčku pro dnešek offline
|
/// uložení jídelníčku pro dnešek offline
|
||||||
|
|
Reference in a new issue