diff --git a/Todo.txt b/Todo.txt index 796c96a..5dbc9f7 100644 --- a/Todo.txt +++ b/Todo.txt @@ -1,5 +1,4 @@ todo: -sandorte ansehen in karte (extra tab) Platzierung garnix als standart aber pflichtfeld fix send file to server im englischen abändern @@ -10,6 +9,7 @@ eintrg in db wenn http response (in sent column) not to do: +sandorte ansehen in karte (extra tab) einzelnen eintrag löschen zurückfeld in datenansicht maybe auch vorschläge aus templates in dropdown menüs anzeigen diff --git a/lib/addCam/cam_widgets.dart b/lib/addCam/cam_widgets.dart index 0e3217a..736c8dc 100644 --- a/lib/addCam/cam_widgets.dart +++ b/lib/addCam/cam_widgets.dart @@ -140,11 +140,6 @@ class _VarTextFieldState extends State { ], ); } - - DropdownMenuItem buildMenuItem(String item) => DropdownMenuItem( - value: item, - child: Text(item), - ); } // Karte @@ -166,9 +161,7 @@ class Karte extends StatefulWidget { } class KarteState extends State { - List markers = [ - const Marker(point: LatLng(0, 0), child: Icon(Icons.location_on)) - ]; + List markers = [ ]; LatLng? selectedPosition; Position? updatedPosition; bool saveVisible = false; diff --git a/lib/viewCam/view_cams.dart b/lib/viewCam/view_cams.dart index d9dd25f..f721e6e 100644 --- a/lib/viewCam/view_cams.dart +++ b/lib/viewCam/view_cams.dart @@ -1,10 +1,10 @@ import 'package:fforte/addCam/add_cam_main.dart'; import 'package:fforte/other/db_helper.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; +import 'package:latlong2/latlong.dart'; // * Site that shows all entries in the databases class ViewCams extends StatefulWidget { @@ -18,6 +18,7 @@ class _ViewCamsState extends State { // var declaration late Future>> place; late Future>> templates; + late List markers; // loads the entries @override @@ -106,14 +107,13 @@ class _ViewCamsState extends State { @override Widget build(BuildContext context) { return DefaultTabController( - length: 2, + length: 3, child: Scaffold( appBar: AppBar( bottom: TabBar(tabs: [ Tab(text: AppLocalizations.of(context)!.completed), - Tab( - text: AppLocalizations.of(context)!.uncompleted, - ) + Tab(text: AppLocalizations.of(context)!.uncompleted,), + Tab(text: AppLocalizations.of(context)!.map,), ]), title: Text(AppLocalizations.of(context)!.viewplacesappbar)), body: TabBarView( @@ -137,28 +137,32 @@ class _ViewCamsState extends State { ), body: Column( children: [ - const SizedBox(height: 10,), + const SizedBox( + height: 10, + ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ - const SizedBox(width: 10,), - Text( - style: const TextStyle( - decoration: TextDecoration.underline + const SizedBox( + width: 10, ), - AppLocalizations.of(context)!.placedata), + Text( + style: const TextStyle( + decoration: TextDecoration.underline), + AppLocalizations.of(context)!.placedata), ], ), Row( children: [ Text( - style: const TextStyle( - decoration: TextDecoration.underline - ), - AppLocalizations.of(context)!.sent), - const SizedBox(width: 10,), + style: const TextStyle( + decoration: TextDecoration.underline), + AppLocalizations.of(context)!.sent), + const SizedBox( + width: 10, + ), ], ), ], @@ -260,6 +264,44 @@ class _ViewCamsState extends State { ), ); } + }), + FutureBuilder( + future: place, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text("Error ${snapshot.error}"); + } else { + List> place = snapshot.data!; + markers = snapshot.data!.map((e) { + return Marker( + width: 80.0, + height: 80.0, + point: LatLng(double.parse(e['DECLAT'].toString()), double.parse(e['DECLNG'].toString())), + child: Column( + children: [ + const Icon(Icons.location_on, color: Colors.red,), + Text("ID: ${e['ID'].toString()}", style: const TextStyle(color: Colors.black),) + ], + )); + }).toList(); + return FlutterMap( + options: MapOptions( + initialCenter: markers.isEmpty ? const LatLng(50, 10) : markers.first.point, + interactionOptions: const InteractionOptions( + flags: InteractiveFlag.pinchZoom | + InteractiveFlag.drag | + InteractiveFlag.pinchMove)), + children: [ + TileLayer( + urlTemplate: + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.example.app', + ), + MarkerLayer(markers: markers) + ]); + } }) ], )), diff --git a/time.txt b/time.txt index 209eb5b..df91b0b 100644 --- a/time.txt +++ b/time.txt @@ -50,4 +50,4 @@ 20 apr 1h 30 min 24 apr 5h 30 apr 4h 15 min -1 mai 4h +1 mai 4h