Flutter get coordinates from google maps
I use the package google_maps_flutter
to use Google maps in my app. My problem is how to set a listener, show when I press in the map to get the coordination of this place. I don't find anything in documentation.
The only thing which I find is with controllerMap, which I use to set marker listener, is that it has a method,
.addListener(listener)
Any idea?
google-maps dart flutter
add a comment |
I use the package google_maps_flutter
to use Google maps in my app. My problem is how to set a listener, show when I press in the map to get the coordination of this place. I don't find anything in documentation.
The only thing which I find is with controllerMap, which I use to set marker listener, is that it has a method,
.addListener(listener)
Any idea?
google-maps dart flutter
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35
add a comment |
I use the package google_maps_flutter
to use Google maps in my app. My problem is how to set a listener, show when I press in the map to get the coordination of this place. I don't find anything in documentation.
The only thing which I find is with controllerMap, which I use to set marker listener, is that it has a method,
.addListener(listener)
Any idea?
google-maps dart flutter
I use the package google_maps_flutter
to use Google maps in my app. My problem is how to set a listener, show when I press in the map to get the coordination of this place. I don't find anything in documentation.
The only thing which I find is with controllerMap, which I use to set marker listener, is that it has a method,
.addListener(listener)
Any idea?
google-maps dart flutter
google-maps dart flutter
asked Nov 20 '18 at 16:53
Filippos SerFilippos Ser
119111
119111
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35
add a comment |
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35
add a comment |
3 Answers
3
active
oldest
votes
I have solved the problem using the onMarkerTapped callback methods below:
Note: mapController below is an instance of the GoogleMap Controller
mapController.**onMarkerTapped**.add((marker){
String title= marker.options.infoWindowText.title;
String latitude= marker.options.position.latitude.toString();
String longitude= marker.options.position.longitude.toString();
});
add a comment |
google map plugin has a lot of errors:), I prefer using this plugin : flutter_map
full example :
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class ContactPage extends StatefulWidget {
@override
ContactPageState createState() => new ContactPageState();
}
class ContactPageState extends State<ContactPage>
with TickerProviderStateMixin {
static LatLng myLocation = new LatLng(51.5, -0.09);
@override
void initState() {
super.initState();
setState(() {
new LatLng(51.5, -0.09);
});
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
double heigh = screenSize.height;
TextStyle whiteStyle = new TextStyle(fontSize: 20.0, color: Colors.white);
return new Directionality(
textDirection: TextDirection.rtl,
child: new Container(
padding: new EdgeInsets.only(bottom: 10.0, left: 1.0, right: 1.0),
color: Colors.white,
child: new FlutterMap(
options: new MapOptions(
center: myLocation,
zoom: 15.0,
maxZoom: 15.0,
minZoom: 3.0,
onTap: _handleTap),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
new MarkerLayerOptions(markers: markers)
],
)
)),
);
}
_handleTap(LatLng point) {
setState(() {
myLocation = point;
});
}
}
add a comment |
This functionality is currently not available in version 2.0 of the google flutter plugin, however there are two pull requests that have added this functionality.
- 1121
- 941
Pull request 1121 has example code on how to use the tap functionality.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397826%2fflutter-get-coordinates-from-google-maps%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have solved the problem using the onMarkerTapped callback methods below:
Note: mapController below is an instance of the GoogleMap Controller
mapController.**onMarkerTapped**.add((marker){
String title= marker.options.infoWindowText.title;
String latitude= marker.options.position.latitude.toString();
String longitude= marker.options.position.longitude.toString();
});
add a comment |
I have solved the problem using the onMarkerTapped callback methods below:
Note: mapController below is an instance of the GoogleMap Controller
mapController.**onMarkerTapped**.add((marker){
String title= marker.options.infoWindowText.title;
String latitude= marker.options.position.latitude.toString();
String longitude= marker.options.position.longitude.toString();
});
add a comment |
I have solved the problem using the onMarkerTapped callback methods below:
Note: mapController below is an instance of the GoogleMap Controller
mapController.**onMarkerTapped**.add((marker){
String title= marker.options.infoWindowText.title;
String latitude= marker.options.position.latitude.toString();
String longitude= marker.options.position.longitude.toString();
});
I have solved the problem using the onMarkerTapped callback methods below:
Note: mapController below is an instance of the GoogleMap Controller
mapController.**onMarkerTapped**.add((marker){
String title= marker.options.infoWindowText.title;
String latitude= marker.options.position.latitude.toString();
String longitude= marker.options.position.longitude.toString();
});
edited Dec 24 '18 at 8:26
Pradeep
8,254101930
8,254101930
answered Dec 24 '18 at 8:06
lionelsanoulionelsanou
314
314
add a comment |
add a comment |
google map plugin has a lot of errors:), I prefer using this plugin : flutter_map
full example :
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class ContactPage extends StatefulWidget {
@override
ContactPageState createState() => new ContactPageState();
}
class ContactPageState extends State<ContactPage>
with TickerProviderStateMixin {
static LatLng myLocation = new LatLng(51.5, -0.09);
@override
void initState() {
super.initState();
setState(() {
new LatLng(51.5, -0.09);
});
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
double heigh = screenSize.height;
TextStyle whiteStyle = new TextStyle(fontSize: 20.0, color: Colors.white);
return new Directionality(
textDirection: TextDirection.rtl,
child: new Container(
padding: new EdgeInsets.only(bottom: 10.0, left: 1.0, right: 1.0),
color: Colors.white,
child: new FlutterMap(
options: new MapOptions(
center: myLocation,
zoom: 15.0,
maxZoom: 15.0,
minZoom: 3.0,
onTap: _handleTap),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
new MarkerLayerOptions(markers: markers)
],
)
)),
);
}
_handleTap(LatLng point) {
setState(() {
myLocation = point;
});
}
}
add a comment |
google map plugin has a lot of errors:), I prefer using this plugin : flutter_map
full example :
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class ContactPage extends StatefulWidget {
@override
ContactPageState createState() => new ContactPageState();
}
class ContactPageState extends State<ContactPage>
with TickerProviderStateMixin {
static LatLng myLocation = new LatLng(51.5, -0.09);
@override
void initState() {
super.initState();
setState(() {
new LatLng(51.5, -0.09);
});
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
double heigh = screenSize.height;
TextStyle whiteStyle = new TextStyle(fontSize: 20.0, color: Colors.white);
return new Directionality(
textDirection: TextDirection.rtl,
child: new Container(
padding: new EdgeInsets.only(bottom: 10.0, left: 1.0, right: 1.0),
color: Colors.white,
child: new FlutterMap(
options: new MapOptions(
center: myLocation,
zoom: 15.0,
maxZoom: 15.0,
minZoom: 3.0,
onTap: _handleTap),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
new MarkerLayerOptions(markers: markers)
],
)
)),
);
}
_handleTap(LatLng point) {
setState(() {
myLocation = point;
});
}
}
add a comment |
google map plugin has a lot of errors:), I prefer using this plugin : flutter_map
full example :
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class ContactPage extends StatefulWidget {
@override
ContactPageState createState() => new ContactPageState();
}
class ContactPageState extends State<ContactPage>
with TickerProviderStateMixin {
static LatLng myLocation = new LatLng(51.5, -0.09);
@override
void initState() {
super.initState();
setState(() {
new LatLng(51.5, -0.09);
});
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
double heigh = screenSize.height;
TextStyle whiteStyle = new TextStyle(fontSize: 20.0, color: Colors.white);
return new Directionality(
textDirection: TextDirection.rtl,
child: new Container(
padding: new EdgeInsets.only(bottom: 10.0, left: 1.0, right: 1.0),
color: Colors.white,
child: new FlutterMap(
options: new MapOptions(
center: myLocation,
zoom: 15.0,
maxZoom: 15.0,
minZoom: 3.0,
onTap: _handleTap),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
new MarkerLayerOptions(markers: markers)
],
)
)),
);
}
_handleTap(LatLng point) {
setState(() {
myLocation = point;
});
}
}
google map plugin has a lot of errors:), I prefer using this plugin : flutter_map
full example :
import 'package:location/location.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class ContactPage extends StatefulWidget {
@override
ContactPageState createState() => new ContactPageState();
}
class ContactPageState extends State<ContactPage>
with TickerProviderStateMixin {
static LatLng myLocation = new LatLng(51.5, -0.09);
@override
void initState() {
super.initState();
setState(() {
new LatLng(51.5, -0.09);
});
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
double heigh = screenSize.height;
TextStyle whiteStyle = new TextStyle(fontSize: 20.0, color: Colors.white);
return new Directionality(
textDirection: TextDirection.rtl,
child: new Container(
padding: new EdgeInsets.only(bottom: 10.0, left: 1.0, right: 1.0),
color: Colors.white,
child: new FlutterMap(
options: new MapOptions(
center: myLocation,
zoom: 15.0,
maxZoom: 15.0,
minZoom: 3.0,
onTap: _handleTap),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
new MarkerLayerOptions(markers: markers)
],
)
)),
);
}
_handleTap(LatLng point) {
setState(() {
myLocation = point;
});
}
}
answered Nov 21 '18 at 3:12
Yousuf AL-MawaliYousuf AL-Mawali
786
786
add a comment |
add a comment |
This functionality is currently not available in version 2.0 of the google flutter plugin, however there are two pull requests that have added this functionality.
- 1121
- 941
Pull request 1121 has example code on how to use the tap functionality.
add a comment |
This functionality is currently not available in version 2.0 of the google flutter plugin, however there are two pull requests that have added this functionality.
- 1121
- 941
Pull request 1121 has example code on how to use the tap functionality.
add a comment |
This functionality is currently not available in version 2.0 of the google flutter plugin, however there are two pull requests that have added this functionality.
- 1121
- 941
Pull request 1121 has example code on how to use the tap functionality.
This functionality is currently not available in version 2.0 of the google flutter plugin, however there are two pull requests that have added this functionality.
- 1121
- 941
Pull request 1121 has example code on how to use the tap functionality.
answered Feb 1 at 9:56
JasonJason
35239
35239
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397826%2fflutter-get-coordinates-from-google-maps%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
github.com/flutter/plugins/tree/master/packages/… You should look through the examples. The plugin is in alpha. Here is the how to add on tap listener
– user1462442
Nov 20 '18 at 17:14
I have seen it but I didn't find anything relevant. Can you be more specific? The only tap thing which I find and I use is the onMarkerTapped
– Filippos Ser
Nov 20 '18 at 17:17
If its not there then, it is probably not implemented github.com/flutter/plugins/blob/… GoogleMapController has very little features at the moment. The plugin is in alpha
– user1462442
Nov 20 '18 at 17:35