gpt4 book ai didi

google-maps - 如何在Google Map Flutter上显示小部件图标?

转载 作者:行者123 更新时间:2023-12-03 02:50:42 32 4
gpt4 key购买 nike

在我的应用程序中有一张Google map 。我用google_maps_flutter。我想在右上角添加通知图标。我尝试使用Stack,但Google Map覆盖了该图标。

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 map 下方移动响铃图标,尝试替换以下代码,即可正常工作

enter image description here

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-maps - 如何在Google Map Flutter上显示小部件图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57968134/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com