fix: opravit async v setstate
This commit is contained in:
parent
dfe8875356
commit
a42125049a
2 changed files with 15 additions and 12 deletions
|
@ -54,18 +54,9 @@ class _NastaveniState extends State<Nastaveni> {
|
|||
Switch(
|
||||
value: _ukladatOffline,
|
||||
onChanged: (value) {
|
||||
setState(() async {
|
||||
setState(() {
|
||||
_ukladatOffline = value;
|
||||
if (!value) {
|
||||
Directory appDocDir =
|
||||
await getApplicationDocumentsDirectory();
|
||||
for (var f in appDocDir.listSync()) {
|
||||
// Vymažeme obsah
|
||||
if (f.path.contains("jidelnicek")) {
|
||||
f.deleteSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
cistit(value);
|
||||
zmenitNastaveni("offline", value);
|
||||
});
|
||||
})
|
||||
|
@ -90,4 +81,16 @@ class _NastaveniState extends State<Nastaveni> {
|
|||
)),
|
||||
);
|
||||
}
|
||||
|
||||
void cistit(bool value) async {
|
||||
if (!value) {
|
||||
Directory appDocDir = await getApplicationDocumentsDirectory();
|
||||
for (var f in appDocDir.listSync()) {
|
||||
// Vymažeme obsah
|
||||
if (f.path.contains("jidelnicek")) {
|
||||
f.deleteSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.2+6
|
||||
version: 1.1.3+7
|
||||
|
||||
environment:
|
||||
sdk: ">=2.16.1 <3.0.0"
|
||||
|
|
Reference in a new issue