Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 如何设置动态位置或用户';它在谷歌地图中圈出的位置会抖动,也会显示仅在圈内的标记_Google Maps_Flutter_Location_Marker_Google Maps Flutter - Fatal编程技术网

Google maps 如何设置动态位置或用户';它在谷歌地图中圈出的位置会抖动,也会显示仅在圈内的标记

Google maps 如何设置动态位置或用户';它在谷歌地图中圈出的位置会抖动,也会显示仅在圈内的标记,google-maps,flutter,location,marker,google-maps-flutter,Google Maps,Flutter,Location,Marker,Google Maps Flutter,import'包:cloud_firestore/cloud_firestore.dart'; 进口“包装:颤振/材料.省道”; 导入“包:google_-maps_-flatter/google_-maps_-flatter.dart”; 导入“package:location/location.dart”; 导入“package:rewahub/widgets/styles.dart”; 类Gmap扩展了StatefulWidget{ @凌驾 _GmapState createState()

import'包:cloud_firestore/cloud_firestore.dart';
进口“包装:颤振/材料.省道”;
导入“包:google_-maps_-flatter/google_-maps_-flatter.dart”;
导入“package:location/location.dart”;
导入“package:rewahub/widgets/styles.dart”;
类Gmap扩展了StatefulWidget{
@凌驾
_GmapState createState()=>GmapState();
}
类GmapState扩展状态{
谷歌地图控制器;
位置数据_当前位置;
var lng、lat、装载;
bool-sitiosToggle=false;
变量sitios=[];
Set allMarkers=Set();
void\u onMapCreated(谷歌地图控制器){
mapController=控制器;
}
设置圆=Set.from([
圈(
circleId:circleId(“myCircle”),
半径:500,
中心:_createCenter,
fillColor:Color.fromRGBO(171,39,133,0.1),
strokeColor:Color.fromRGBO(171,39,133,0.5),
onTap:(){
打印(“按下圆圈”);
})
]);
populateClients(){
sitios=[];
Firestore.instance.collection('retailers').getDocuments().then((文档){
if(docs.documents.isNotEmpty){
设置状态(){
sitiosToggle=真;
});
对于(int i=0;i
如何在google maps Flatter中给出用户圈的位置。也就是说,它能给谷歌地图中的圆圈提供动态位置吗。还应该过滤圆半径内的标记

我得到了一个错误,如果我尝试给圆指定动态位置,只有静态变量可以在中心初始化。请帮我解决这个问题


提前感谢。

您正在从外部访问该方法。所以,它需要是静态的。如果你不想这样

initState
中移动圆初始化。像

@override
  initState() {
    circles = Set.from([
      Circle(
          circleId: CircleId("myCircle"),
          radius: 500,
          center: _createCenter,
          fillColor: Color.fromRGBO(171, 39, 133, 0.1),
          strokeColor: Color.fromRGBO(171, 39, 133, 0.5),
          onTap: () {
            print('circle pressed');
          })
    ]);

    loading = true;
    _getLocation();
    super.initState();
  }

显示您尝试过的代码。@AbhayKoradiya您好,我已经更新了我尝试过的代码,所以这一行出现了问题
circles:circles,
?是的。在该行中,不支持圆。显示错误::在初始值设定项中只能访问静态成员。dart(在初始值设定项中隐式\u this\u reference\u)我没有任何问题,您使用的是哪个版本?
@override
  initState() {
    circles = Set.from([
      Circle(
          circleId: CircleId("myCircle"),
          radius: 500,
          center: _createCenter,
          fillColor: Color.fromRGBO(171, 39, 133, 0.1),
          strokeColor: Color.fromRGBO(171, 39, 133, 0.5),
          onTap: () {
            print('circle pressed');
          })
    ]);

    loading = true;
    _getLocation();
    super.initState();
  }