fix delete single

This commit is contained in:
Nico
2025-06-19 17:00:37 +02:00
parent fccc0f8522
commit ce73ffcbcf

View File

@@ -34,7 +34,7 @@ class _ViewEntriesState extends State<ViewEntries> {
// loads the entries
@override
void initState() {
reloadAllEntries();
reloadAllEntries().then((val) => setState(() {}));
super.initState();
}
@@ -158,14 +158,13 @@ class _ViewEntriesState extends State<ViewEntries> {
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (context) {
DeleteMainEntries.deleteSingle(
onPressed: (context) async {
await DeleteMainEntries.deleteSingle(
widget.dbType,
mainEntries[index]['ID'.toString()],
);
setState(() {
reloadAllEntries();
});
reloadAllEntries()
.then((val) => setState(() {}));
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
@@ -176,14 +175,14 @@ class _ViewEntriesState extends State<ViewEntries> {
],
),
child: ListTile(
title: Text(
'${index + 1}'),
title: Text('${index + 1}'),
subtitle: Text(
dateFormat.format(DateTime.parse(
mainEntries[index]["Datum"])),
),
trailing: Checkbox(
value: mainEntries[index]['Sent'] == "0" || mainEntries[index]["Sent"] == ""
value: mainEntries[index]['Sent'] == "0" ||
mainEntries[index]["Sent"] == ""
? false
: true,
onChanged: null,
@@ -253,14 +252,13 @@ class _ViewEntriesState extends State<ViewEntries> {
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (context) {
DeleteTemplates.deleteSingle(
onPressed: (context) async {
await DeleteTemplates.deleteSingle(
widget.dbType,
templates[index]['ID'].toString(),
);
setState(() {
reloadAllEntries();
});
reloadAllEntries()
.then((val) => setState(() {}));
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
@@ -298,8 +296,7 @@ class _ViewEntriesState extends State<ViewEntries> {
});
}
},
title: Text(
'${index + 1}'),
title: Text('${index + 1}'),
subtitle: Text(
dateFormat.format(
DateTime.parse(templates[index]["Datum"])),