set location enabled in function to get live location
This commit is contained in:
parent
4b384b378a
commit
ec8d3d466b
@ -8,7 +8,6 @@ import 'package:app/view/locationSearch.dart';
|
||||
import 'package:app/view/status.dart';
|
||||
import 'package:app/view/map.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -32,6 +31,10 @@ class _HomePageState extends State<HomeView> {
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
locationEnabled = true;
|
||||
});
|
||||
|
||||
Position? position;
|
||||
try {
|
||||
position = await Geolocator.getCurrentPosition();
|
||||
@ -91,9 +94,6 @@ class _HomePageState extends State<HomeView> {
|
||||
LatLng? latLng = await getLatLng();
|
||||
if (latLng != null) {
|
||||
mapState.getMapController.move(latLng, 16);
|
||||
setState(() {
|
||||
locationEnabled = true;
|
||||
});
|
||||
}
|
||||
mapState.setLoading(false);
|
||||
},
|
||||
|
Reference in New Issue
Block a user