diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5a344d9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# 0.1.1 +- Přidán RefreshIndicator na obrazovku s jídelníčkem +- Přidáno odsazení od okrajů u jídelníčku +- Domovská obrazovka nyní zobrazuje zprávu, pokud na dnešní den není žádné jídlo v jídelníčku +- Upgrade knihovny +# 0.1.0 +- První verze \ No newline at end of file diff --git a/lib/okna/burza.dart b/lib/okna/burza.dart index 256eb48..922e7aa 100644 --- a/lib/okna/burza.dart +++ b/lib/okna/burza.dart @@ -49,7 +49,7 @@ class _BurzaPageState extends State { Text("${b.pocet}x"), TextButton( onPressed: () { - widget.canteen.objednatZBurzy(b).then((_) { + widget.canteen.objednatZBurzy(b).then((a) { nactiBurzu(); }); }, diff --git a/lib/okna/home.dart b/lib/okna/home.dart index d0f3888..012e683 100644 --- a/lib/okna/home.dart +++ b/lib/okna/home.dart @@ -28,6 +28,14 @@ class _HomePageState extends State { setState(() { kredit = kr.kredit; dnes = jd; + if (jd.jidla.isEmpty) { + obsah = [ + const Text( + "Žádné jídlo pro dnešní den", + style: TextStyle(fontSize: 20), + ) + ]; + } for (var j in jd.jidla) { if (j.objednano) jidloDnes = j; obsah.add( @@ -99,30 +107,33 @@ class _HomePageState extends State { physics: const AlwaysScrollableScrollPhysics(), child: Center( child: SizedBox( - child: Column( - children: [ - const SizedBox( - height: 5, - ), - Text( - "${widget.user} - $kredit kč", - style: const TextStyle(fontSize: 13), - ), - const SizedBox( - height: 10, - ), - Text( - "Dnes je ${DateTime.now().day}. ${DateTime.now().month}.", - style: const TextStyle( - fontSize: 20, fontWeight: FontWeight.bold), - ), - Padding( - padding: const EdgeInsets.only(top: 20), - child: Column(children: obsah), - ), - ], + child: SizedBox( + height: MediaQuery.of(context).size.height / 1.5, + child: Column( + children: [ + const SizedBox( + height: 5, + ), + Text( + "${widget.user} - $kredit kč", + style: const TextStyle(fontSize: 13), + ), + const SizedBox( + height: 10, + ), + Text( + "Dnes je ${DateTime.now().day}. ${DateTime.now().month}.", + style: const TextStyle( + fontSize: 20, fontWeight: FontWeight.bold), + ), + Padding( + padding: const EdgeInsets.only(top: 20), + child: Column(children: obsah), + ), + ], + ), + width: MediaQuery.of(context).size.width - 50, ), - width: MediaQuery.of(context).size.width - 50, ), ), ), diff --git a/lib/okna/jidelnicek.dart b/lib/okna/jidelnicek.dart index 12df675..983ed1a 100644 --- a/lib/okna/jidelnicek.dart +++ b/lib/okna/jidelnicek.dart @@ -182,66 +182,73 @@ class _JidelnicekPageState extends State { appBar: AppBar( title: const Text('Jídelníček'), ), - body: Center( - child: Column( - children: [ - const SizedBox(height: 10), - Text("Kredit: $kredit Kč"), - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - IconButton( - onPressed: () { - setState(() { - den = den.subtract(const Duration(days: 1)); - nactiJidlo(); - }); - }, - icon: const Icon(Icons.arrow_left)), - TextButton( - onPressed: () async { - var datePicked = await showDatePicker( - context: context, - initialDate: den, - currentDate: den, - firstDate: DateTime(2019, 1, 1), - lastDate: DateTime(den.year + 1, 12, 31), - locale: const Locale("cs")); - if (datePicked == null) return; - setState(() { - den = datePicked; - nactiJidlo(); - }); - }, - child: Text( - "${den.day}. ${den.month}. ${den.year} - $denTydne")), - IconButton( - onPressed: () { - setState(() { - den = den.add(const Duration(days: 1)); - nactiJidlo(); - }); - }, - icon: const Icon(Icons.arrow_right)), - ]), - SingleChildScrollView( - child: GestureDetector( - child: Column(children: obsah), - onHorizontalDragEnd: (details) { - if (details.primaryVelocity?.compareTo(0) == -1) { - setState(() { - den = den.subtract(const Duration(days: 1)); - nactiJidlo(); - }); - } else { - setState(() { - den = den.add(const Duration(days: 1)); - nactiJidlo(); - }); - } - }, - ), - ) - ], + body: RefreshIndicator( + child: Center( + child: SizedBox( + child: Column( + children: [ + const SizedBox(height: 10), + Text("Kredit: $kredit Kč"), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + IconButton( + onPressed: () { + setState(() { + den = den.subtract(const Duration(days: 1)); + nactiJidlo(); + }); + }, + icon: const Icon(Icons.arrow_left)), + TextButton( + onPressed: () async { + var datePicked = await showDatePicker( + context: context, + initialDate: den, + currentDate: den, + firstDate: DateTime(2019, 1, 1), + lastDate: DateTime(den.year + 1, 12, 31), + locale: const Locale("cs")); + if (datePicked == null) return; + setState(() { + den = datePicked; + nactiJidlo(); + }); + }, + child: Text( + "${den.day}. ${den.month}. ${den.year} - $denTydne")), + IconButton( + onPressed: () { + setState(() { + den = den.add(const Duration(days: 1)); + nactiJidlo(); + }); + }, + icon: const Icon(Icons.arrow_right)), + ]), + SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: GestureDetector( + child: Column(children: obsah), + onHorizontalDragEnd: (details) { + if (details.primaryVelocity?.compareTo(0) == -1) { + setState(() { + den = den.subtract(const Duration(days: 1)); + nactiJidlo(); + }); + } else { + setState(() { + den = den.add(const Duration(days: 1)); + nactiJidlo(); + }); + } + }, + ), + ) + ], + ), + width: MediaQuery.of(context).size.width - 50, + ), ), + onRefresh: nactiJidlo, ), ); } diff --git a/pubspec.lock b/pubspec.lock index 33a09a9..8a3e0a1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -28,7 +28,7 @@ packages: name: canteenlib url: "https://pub.dartlang.org" source: hosted - version: "0.1.0-alpha.13" + version: "0.1.0-alpha.14" characters: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2b06d37..5752a27 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: 0.1.0+1 +version: 0.1.1+2 environment: sdk: ">=2.16.1 <3.0.0" @@ -16,7 +16,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - canteenlib: ^0.1.0-alpha.13 + canteenlib: ^0.1.0-alpha.14 cupertino_icons: ^1.0.2 connectivity_plus: ^2.2.1 flutter_secure_storage: ^5.0.2