From 79aa728ced95b9831bfeaada39afd743f5827cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 25 Apr 2022 20:09:13 +0200 Subject: [PATCH] =?UTF-8?q?Vylep=C5=A1en=C3=AD=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Práce na #3, closes #6 --- lib/main.dart | 5 ++++- lib/okna/jidelnicek.dart | 29 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 4d010da..680ed5c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -87,7 +87,10 @@ class _LoginPageState extends State { child: SizedBox( height: 100, child: Row(children: const [ - CircularProgressIndicator(), + Padding( + padding: EdgeInsets.all(10), + child: CircularProgressIndicator(), + ), Text("Přihlašuji vás") ]), ), diff --git a/lib/okna/jidelnicek.dart b/lib/okna/jidelnicek.dart index 3dd0d99..f5c052a 100644 --- a/lib/okna/jidelnicek.dart +++ b/lib/okna/jidelnicek.dart @@ -84,16 +84,31 @@ class _JidelnicekPageState extends State { ), onTap: () async { if (!j.lzeObjednat) return; - - widget.canteen - .objednat(j) - .then((value) => nactiJidlo()) - .catchError((o) { + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => Dialog( + child: SizedBox( + height: 100, + child: Row(children: const [ + Padding( + padding: EdgeInsets.all(10), + child: CircularProgressIndicator(), + ), + Text("Objednávám...") + ]), + ), + )); + 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: const Text( - "Nepodařilo se vložit jídlo na burzu"), + "Jídlo se nepodařilo objednat."), content: Text(o.toString()), actions: [ TextButton( @@ -107,7 +122,7 @@ class _JidelnicekPageState extends State { }); }, onLongPress: () async { - if (!j.objednano) return; + if (!j.objednano || j.burzaUrl == null) return; if (!j.naBurze) { // pokud není na burze, radši se zeptáme var d = await showDialog(