added map tab in view cams
This commit is contained in:
2
Todo.txt
2
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
|
||||
|
||||
@@ -140,11 +140,6 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
DropdownMenuItem<String> buildMenuItem(String item) => DropdownMenuItem(
|
||||
value: item,
|
||||
child: Text(item),
|
||||
);
|
||||
}
|
||||
|
||||
// Karte
|
||||
@@ -166,9 +161,7 @@ class Karte extends StatefulWidget {
|
||||
}
|
||||
|
||||
class KarteState extends State<Karte> {
|
||||
List<Marker> markers = [
|
||||
const Marker(point: LatLng(0, 0), child: Icon(Icons.location_on))
|
||||
];
|
||||
List<Marker> markers = [ ];
|
||||
LatLng? selectedPosition;
|
||||
Position? updatedPosition;
|
||||
bool saveVisible = false;
|
||||
|
||||
@@ -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<ViewCams> {
|
||||
// var declaration
|
||||
late Future<List<Map<String, dynamic>>> place;
|
||||
late Future<List<Map<String, dynamic>>> templates;
|
||||
late List<Marker> markers;
|
||||
|
||||
// loads the entries
|
||||
@override
|
||||
@@ -106,14 +107,13 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
@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<ViewCams> {
|
||||
),
|
||||
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<ViewCams> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
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<Map<String, dynamic>> 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)
|
||||
]);
|
||||
}
|
||||
})
|
||||
],
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user