问题描述
该应用程序到目前为止可以做什么:到目前为止,我有一个应用程序可以在Google Map上显示从Firestore获取坐标的标记。
我想要的东西:我希望当用户按下一个标记时,他会转到另一个显示更多数据的屏幕(数据也位于Firestore中)。
问题:我不知道如何在要显示详细信息的屏幕上获取数据(例如名称)。
我有一个onTap函数,该函数调用goToDetailPage()
那是goToDetailPage()函数:
void goToDetailPage() {
Navigator.of(context).push(new MaterialPageRoute(
builder: (BuildContext context) => new detailPage()));
}
这是“绘制”标记的代码:
void initMarker(specify,specifyId) async {
var markerIdVal = specifyId;
final MarkerId markerId = MarkerId(markerIdVal);
final Marker marker = Marker(
markerId: markerId,position:
LatLng(specify['location'].latitude,specify['location'].longitude),infoWindow: InfoWindow(title: specify['name'],snippet: 'Shop'),onTap: () {
goToDetailPage();
});
print(specify['location'].latitude);
nameTest = specify['name'];
setState(() {
markers[markerId] = marker;
print(markerId.toString() + '__________________________');
});
}
这是详细页面中的代码:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Detail Page'),),body: Column(children: <Widget>[Text(specify['name'])]),);
问题在于详细信息页面中的describe ['name']中的指定带有红色下划线,我不知道这是什么原因。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)