|
...
|
...
|
@@ -16,6 +16,10 @@ import 'package:permission_handler/permission_handler.dart'; |
|
|
|
// import 'package:demo/widgets/network_state/page_loading.dart';
|
|
|
|
|
|
|
|
class MapChoicePointPage extends StatefulWidget {
|
|
|
|
final String long;
|
|
|
|
final String lat;
|
|
|
|
MapChoicePointPage({Key key, this.long, this.lat}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_MapChoicePointPageState createState() => _MapChoicePointPageState();
|
|
|
|
}
|
|
...
|
...
|
@@ -37,6 +41,13 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { |
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
if (widget.long != null && widget.long != '') {
|
|
|
|
longitude = double.parse(widget.long);
|
|
|
|
}
|
|
|
|
if (widget.lat != null && widget.lat != '') {
|
|
|
|
latitude = double.parse(widget.lat);
|
|
|
|
}
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
_requestLocationPermission();
|
|
|
|
});
|
|
...
|
...
|
@@ -96,14 +107,16 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { |
|
|
|
// App.sp.setString("lng", "118.17630045");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
latitude = location.latLng.latitude;
|
|
|
|
longitude = location.latLng.longitude;
|
|
|
|
if (_controller != null) {
|
|
|
|
_controller.setCenterCoordinate(
|
|
|
|
LatLng(location.latLng.latitude, location.latLng.longitude));
|
|
|
|
if (widget.long == null || widget.long == '') {
|
|
|
|
latitude = location.latLng.latitude;
|
|
|
|
longitude = location.latLng.longitude;
|
|
|
|
if (_controller != null) {
|
|
|
|
_controller.setCenterCoordinate(
|
|
|
|
LatLng(location.latLng.latitude, location.latLng.longitude));
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
...
|
...
|
|