我想在单击谷歌地图标记时带一个模式底部,并使用Flutter显示一些动态数据
答案 0 :(得分:2)
您可以对标记的onTap事件进行编程以显示模式底部页面:
final Marker marker = Marker(
markerId: markerId,
position: LatLng(lat, lon),
onTap: () {
controller.animateCamera(CameraUpdate.newCameraPosition(
new CameraPosition(
target: LatLng(lat, lon), zoom: 18)));
showModalBottomSheet(
context: context,
builder: (builder) {
return Container(
child: _buildBottonNavigationMethod(your_data),
);
});
},
);
然后在这里根据需要构建窗口小部件:
Column _buildBottonNavigationMethod(your_data) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
leading: Icon(Icons.ac_unit),
title: Text('Add as favourite'),
)
],
);
}