Gur*_*ngh 1 google-maps dart flutter google-maps-flutter
在我的应用程序中有一个谷歌地图。我为此使用了google_maps_flutter。我想在右上角添加通知图标。我尝试使用 Stack 但 Google Map 覆盖了图标。
代码
Scaffold(
resizeToAvoidBottomInset: true,
body: Stack(
children: <Widget>[
Positioned(
top: 60,
right: 40,
child: IconButton(
icon: new Image.asset(UIData.notificationIcon),
onPressed: () {},
)),
GoogleMap(
myLocationEnabled: true,
myLocationButtonEnabled: true,
mapType: MapType.normal,
initialCameraPosition: _kGooglePlex,
markers: Set<Marker>.of(markers.values),
onMapCreated: (controller) {
if (this.mounted)
setState(() {
myController = controller;
});
})
],
),
);
Run Code Online (Sandbox Code Playgroud)
只需将钟形图标移到谷歌地图下方,尝试替换下面的代码,它完美地工作在我身边
Scaffold(
resizeToAvoidBottomInset: true,
body: Stack(
children: <Widget>[
GoogleMap(
myLocationEnabled: true,
myLocationButtonEnabled: true,
mapType: MapType.normal,
initialCameraPosition: _kGooglePlex,
markers: Set<Marker>.of(markers.values),
onMapCreated: (controller) {
if (this.mounted)
setState(() {
myController = controller;
});
}),
Positioned(
top: 60,
right: 40,
child: IconButton(
icon: new Image.asset(UIData.notificationIcon),
onPressed: () {},
)),
],
),
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2087 次 |
| 最近记录: |