如何在 Google Map Flutter 上显示小部件图标?
How to display Widget Icon over Google Map Flutter?
在我的应用程序中有一张 google 地图。我为此使用了 google_maps_flutter。我想在右上角添加通知图标。我尝试使用 Stack,但 Google 地图覆盖了图标。
This is what I want
This is I achived after comment google map code
This is my current screen with below code
代码
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;
});
})
],
),
);
只需移动 google 地图下方的铃铛图标,尝试替换下面的代码,我这边效果很好
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: () {},
)),
],
),
);
在我的应用程序中有一张 google 地图。我为此使用了 google_maps_flutter。我想在右上角添加通知图标。我尝试使用 Stack,但 Google 地图覆盖了图标。
This is what I want
This is I achived after comment google map code
This is my current screen with below code
代码
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;
});
})
],
),
);
只需移动 google 地图下方的铃铛图标,尝试替换下面的代码,我这边效果很好
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: () {},
)),
],
),
);