trip destination from current location
Some checks failed
Build and release APK / Build APK (pull_request) Failing after 5m54s

This commit is contained in:
2024-09-25 15:10:49 +02:00
parent 88b825ea31
commit d37fb09d62
7 changed files with 72 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ import 'dart:developer';
import 'package:anyway/structs/trip.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:shared_preferences/shared_preferences.dart';
class NewTripLocationSearch extends StatefulWidget {
@@ -66,7 +67,17 @@ class _NewTripLocationSearchState extends State<NewTripLocationSearch> {
late Widget useCurrentLocationButton = ElevatedButton(
onPressed: () async {
// this widget is only shown if the user has already granted location permissions
Position position = await Geolocator.getCurrentPosition();
widget.trip.landmarks.clear();
widget.trip.addLandmark(
Landmark(
uuid: 'pending',
name: 'start',
location: [position.latitude, position.longitude],
type: typeStart
)
);
},
child: Text('Use current location'),
);