fixed error where complete entries are shown as incomplete and made ui enhancements to overview
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:fforte/l10n/app_localizations.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
// * Site that shows all entries in the databases
|
||||
|
||||
@@ -28,11 +29,13 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
List<Map<String, dynamic>> templates = [];
|
||||
List<Marker> marker = [];
|
||||
|
||||
final DateFormat dateFormat = DateFormat('dd.MM.yyyy');
|
||||
|
||||
// loads the entries
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
reloadAllEntries();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> reloadAllEntries() async {
|
||||
@@ -89,7 +92,9 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
Tab(text: AppLocalizations.of(context)!.map),
|
||||
],
|
||||
),
|
||||
title: widget.dbType == DatabasesEnum.place ? Text(AppLocalizations.of(context)!.viewplacesappbar) : Text(AppLocalizations.of(context)!.viewExcursionen) ,
|
||||
title: widget.dbType == DatabasesEnum.place
|
||||
? Text(AppLocalizations.of(context)!.viewplacesappbar)
|
||||
: Text(AppLocalizations.of(context)!.viewExcursionen),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
@@ -97,11 +102,14 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
child: Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.delete),
|
||||
onPressed: () {
|
||||
ViewEntriesDialogHelper.deleteAllMainEntries(
|
||||
onPressed: () async {
|
||||
await ViewEntriesDialogHelper.deleteAllMainEntries(
|
||||
context,
|
||||
widget.dbType,
|
||||
);
|
||||
setState(() {
|
||||
reloadAllEntries();
|
||||
});
|
||||
},
|
||||
),
|
||||
body: Column(
|
||||
@@ -170,15 +178,15 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
],
|
||||
),
|
||||
child: ListTile(
|
||||
title: Text('Standort ${index + 1}'),
|
||||
title: Text(
|
||||
'${widget.dbType == DatabasesEnum.place ? AppLocalizations.of(context)!.justplace : AppLocalizations.of(context)!.excursion} ${mainEntries[index]["ID"]}'),
|
||||
subtitle: Text(
|
||||
'ID: ${mainEntries[index]['ID']} DATUM: ${widget.dbType == DatabasesEnum.place ? mainEntries[index]['Datum'] : mainEntries[index]["LogDat"]}',
|
||||
dateFormat.format(DateTime.parse(mainEntries[index]["Datum"])),
|
||||
),
|
||||
trailing: Checkbox(
|
||||
value:
|
||||
mainEntries[index]['Sent'] == 0
|
||||
? false
|
||||
: true,
|
||||
value: mainEntries[index]['Sent'] == 0
|
||||
? false
|
||||
: true,
|
||||
onChanged: null,
|
||||
),
|
||||
onTap: () async {
|
||||
@@ -186,14 +194,12 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => AddCamMain(
|
||||
isSent:
|
||||
mainEntries[index]['Sent'] == 1
|
||||
? true
|
||||
: false,
|
||||
existingData: mainEntries[index],
|
||||
),
|
||||
builder: (context) => AddCamMain(
|
||||
isSent: mainEntries[index]['Sent'] == 1
|
||||
? true
|
||||
: false,
|
||||
existingData: mainEntries[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (widget.dbType ==
|
||||
@@ -201,14 +207,12 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => ExcursionMain(
|
||||
isSent:
|
||||
mainEntries[index]['Sent'] == 1
|
||||
? true
|
||||
: false,
|
||||
existingData: mainEntries[index],
|
||||
),
|
||||
builder: (context) => ExcursionMain(
|
||||
isSent: mainEntries[index]['Sent'] == 1
|
||||
? true
|
||||
: false,
|
||||
existingData: mainEntries[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -226,11 +230,14 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
child: Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.delete),
|
||||
onPressed: () {
|
||||
ViewEntriesDialogHelper.deleteAllTemplates(
|
||||
onPressed: () async {
|
||||
await ViewEntriesDialogHelper.deleteAllTemplates(
|
||||
context,
|
||||
widget.dbType,
|
||||
);
|
||||
setState(() {
|
||||
reloadAllEntries();
|
||||
});
|
||||
},
|
||||
),
|
||||
body: Column(
|
||||
@@ -263,16 +270,14 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
),
|
||||
child: ListTile(
|
||||
onTap: () {
|
||||
|
||||
if (widget.dbType == DatabasesEnum.place) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => AddCamMain(
|
||||
isTemplate: true,
|
||||
existingData: templates[index],
|
||||
),
|
||||
builder: (context) => AddCamMain(
|
||||
isTemplate: true,
|
||||
existingData: templates[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (widget.dbType ==
|
||||
@@ -280,34 +285,18 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => ExcursionMain(
|
||||
isTemplate: true,
|
||||
existingData: templates[index],
|
||||
),
|
||||
builder: (context) => ExcursionMain(
|
||||
isTemplate: true,
|
||||
existingData: templates[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder:
|
||||
// (context) => AddCamMain(
|
||||
// isTemplate: true,
|
||||
// existingData: templates[index],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
|
||||
|
||||
|
||||
title: Text('Place ${index + 1}'),
|
||||
title: Text(
|
||||
'${widget.dbType == DatabasesEnum.place ? AppLocalizations.of(context)!.justplace : AppLocalizations.of(context)!.excursion} ${templates[index]["ID"]}'),
|
||||
subtitle: Text(
|
||||
'ID: ${templates[index]['CID']} DATUM: ${templates[index]['Datum']} RUDEL: ${templates[index]['Rudel']} STATUS: ${templates[index]['Status']}',
|
||||
dateFormat.format(DateTime.parse(templates[index]["Datum"])),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -322,13 +311,11 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
Tab(
|
||||
child: FlutterMap(
|
||||
options: MapOptions(
|
||||
initialCenter:
|
||||
marker.isEmpty
|
||||
? const LatLng(50, 10)
|
||||
: marker.first.point,
|
||||
initialCenter: marker.isEmpty
|
||||
? const LatLng(50, 10)
|
||||
: marker.first.point,
|
||||
interactionOptions: const InteractionOptions(
|
||||
flags:
|
||||
InteractiveFlag.pinchZoom |
|
||||
flags: InteractiveFlag.pinchZoom |
|
||||
InteractiveFlag.drag |
|
||||
InteractiveFlag.pinchMove,
|
||||
),
|
||||
@@ -337,7 +324,7 @@ class _ViewEntriesState extends State<ViewEntries> {
|
||||
TileLayer(
|
||||
urlTemplate:
|
||||
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
userAgentPackageName: 'com.example.app',
|
||||
userAgentPackageName: 'de.lupus.apps',
|
||||
),
|
||||
MarkerLayer(markers: marker),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user