added visibility to save button in map and cleaned up db helper a bit
This commit is contained in:
@@ -232,6 +232,7 @@ class StandortState extends State<Standort> {
|
||||
List<Marker> markers = [];
|
||||
LatLng? selectedPosition;
|
||||
Position? updatedPosition;
|
||||
bool saveVisible = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -239,28 +240,35 @@ class StandortState extends State<Standort> {
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.map),
|
||||
actions: [
|
||||
Text(AppLocalizations.of(context)!.saveMap),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (selectedPosition != null) {
|
||||
setState(() {
|
||||
updatedPosition = Position(
|
||||
longitude: selectedPosition!.longitude,
|
||||
latitude: selectedPosition!.latitude,
|
||||
timestamp: DateTime.now(),
|
||||
accuracy: 0.0,
|
||||
altitude: 0.0,
|
||||
altitudeAccuracy: 0.0,
|
||||
heading: 0.0,
|
||||
headingAccuracy: 0.0,
|
||||
speed: 0.0,
|
||||
speedAccuracy: 0.0);
|
||||
widget.onPositionChange(updatedPosition!);
|
||||
});
|
||||
}
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Icon(Icons.save),
|
||||
Visibility(
|
||||
visible: saveVisible,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(AppLocalizations.of(context)!.saveMap),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (selectedPosition != null) {
|
||||
setState(() {
|
||||
updatedPosition = Position(
|
||||
longitude: selectedPosition!.longitude,
|
||||
latitude: selectedPosition!.latitude,
|
||||
timestamp: DateTime.now(),
|
||||
accuracy: 0.0,
|
||||
altitude: 0.0,
|
||||
altitudeAccuracy: 0.0,
|
||||
heading: 0.0,
|
||||
headingAccuracy: 0.0,
|
||||
speed: 0.0,
|
||||
speedAccuracy: 0.0);
|
||||
widget.onPositionChange(updatedPosition!);
|
||||
});
|
||||
}
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Icon(Icons.save),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -296,6 +304,7 @@ class StandortState extends State<Standort> {
|
||||
),
|
||||
);
|
||||
selectedPosition = latlng;
|
||||
saveVisible = true;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
|
||||
Reference in New Issue
Block a user