我想将此自定义小部件添加到我的标记中。我已经设计了小工具,但我不知道如何在标记上定位它。
如何将其自定义为始终显示在信息窗口位置。它被包装在一个定位的小部件中,但我无法将它放在信息窗口的位置。
Stack(
children: [
AnimatedPositioned(
bottom: 0.0,
duration: Duration(milliseconds: 200),
child: Container(
padding: EdgeInsets.only(top:
30,left: 15,
right: 15,bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topRight: Radius.circular(0),
topLeft: Radius.circular(0),
bottomRight: Radius.circular(5),
bottomLeft: Radius.circular(5))),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'500 USD',
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Roboto',
color: customBlue,
fontSize: _sizeConfig.textSize(
context,
Converters.configSize(14),
),
),
),
SizedBox(
height: 10,
),
RatingBar.builder(
initialRating: 3.5,
unratedColor: Colors.grey
.withOpacity(0.5),
minRating: 1,
allowHalfRating: true,
itemSize: 20,
direction: Axis.horizontal,
itemCount: 5,
itemPadding: EdgeInsets.symmetric(horizontal: 0.0),
itemBuilder: (context, _) => Icon(
Icons.star,
color: customRed,
),
),
],
),
width: 163,
),
)
],
),
发布于 2021-04-17 02:10:31
请尝试custom_info_window。这是一个软件包,允许基于窗口小部件的自定义信息窗口的google_maps_flutter。通过使用此功能,您将能够移动您的小部件,如地图标记顶部的信息窗口。
发布于 2021-04-04 18:04:47
在google地图插件中,没有简单的apis可以将您的小部件用作标记。
但也有一些技巧。您应该将小部件导出到图像,并通过BitmapDescriptor.fromBytes
传递它。
如何做的有用链接:
Pass widget converted to Image to Google map
如果它看起来像样板代码,您可以使用flutter_map插件by leaflet
https://stackoverflow.com/questions/66921735
复制相似问题