如何解决在Google Map中单击按钮时出现抖动时重建标记
我需要使用flutter从firestore中获取位置的数据,我具有位置列表和这些位置的标记,但是当我单击按钮时,列表会使用新位置再次重建,但是标记没有,我需要重新启动我的应用程序以便重建并显示标记?
child: BlocBuilder<AddBloc,AddState>(
builder: (context,state) {
if (state is AddGetMarkerPositionState) {
return buildMap(state.marker);
} else if (state is AddErrorState) {
return Text(state.message);
} else if (state is AddCoordinatesCatchedState) {
return buildMap(state.marker);
} else if (state is AddErrorState) {
return Text(state.message);
} else {
return Container(
width: 0,height: 0,);
}
},),Search(),PlacesList()
],bottomNavigationBar: NavBarWidget(),);
}
Widget buildMap(Set<Marker> marker) {
return GoogleMap(
markers: marker,mapType: MapType.satellite,myLocationEnabled: true,initialCameraPosition: CameraPosition(
target: _center,zoom: 13.0,onMapCreated: _onMapCreated,);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。