Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-App
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Reason Pun
2022-10-13 11:07:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6a91e74d2b68e5a6fa6ec17b011707f3cb14f317
6a91e74d
1 parent
27cf4a8d
修复google map定位问题
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
lib/poem/page/select_address_page.dart
lib/poem/page/select_address_page.dart
View file @
6a91e74
...
...
@@ -39,6 +39,7 @@ class AddressSelectPageState extends State<AddressSelectPage> {
@override
void
initState
()
{
super
.
initState
();
_getCurrentLocation
();
}
Future
<
void
>
_getCurrentLocation
()
async
{
...
...
@@ -64,28 +65,22 @@ class AddressSelectPageState extends State<AddressSelectPage> {
_locationSubscription
=
location
.
onLocationChanged
.
listen
((
LocationData
currentLocation
)
{
_center
=
LatLng
(
currentLocation
.
latitude
!,
currentLocation
.
longitude
!);
});
}
void
_onMapCreated
(
GoogleMapController
controller
)
{
mapController
=
controller
;
final
String
markerIdVal
=
'marker_id_
$_markerIdCounter
'
;
_markerIdCounter
++;
final
MarkerId
markerId
=
MarkerId
(
markerIdVal
);
final
Marker
marker
=
Marker
(
markerId:
markerId
,
position:
LatLng
(
currentLocation
.
latitude
!,
currentLocation
.
longitude
!)
,
position:
_center
,
);
LatLng
sydney
=
LatLng
(
currentLocation
.
latitude
!,
currentLocation
.
longitude
!);
mapController
.
moveCamera
(
CameraUpdate
.
newLatLng
(
sydney
));
mapController
.
moveCamera
(
CameraUpdate
.
newLatLng
(
_center
));
setState
(()
{
markers
[
markerId
]
=
marker
;
});
});
}
void
_onMapCreated
(
GoogleMapController
controller
)
{
mapController
=
controller
;
_getCurrentLocation
();
}
@override
...
...
Please
register
or
login
to post a comment