Vylepšení

This commit is contained in:
Matyáš Caras 2022-04-09 17:54:08 +02:00
parent 453b06e242
commit d106e78cb3
6 changed files with 111 additions and 86 deletions

7
CHANGELOG.md Normal file
View file

@ -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

View file

@ -49,7 +49,7 @@ class _BurzaPageState extends State<BurzaPage> {
Text("${b.pocet}x"),
TextButton(
onPressed: () {
widget.canteen.objednatZBurzy(b).then((_) {
widget.canteen.objednatZBurzy(b).then((a) {
nactiBurzu();
});
},

View file

@ -28,6 +28,14 @@ class _HomePageState extends State<HomePage> {
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<HomePage> {
physics: const AlwaysScrollableScrollPhysics(),
child: Center(
child: SizedBox(
child: Column(
children: [
const SizedBox(
height: 5,
),
Text(
"${widget.user} - $kredit",
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",
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,
),
),
),

View file

@ -182,66 +182,73 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
appBar: AppBar(
title: const Text('Jídelníček'),
),
body: Center(
child: Column(
children: [
const SizedBox(height: 10),
Text("Kredit: $kredit"),
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"),
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,
),
);
}

View file

@ -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:

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: 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