cus*_*pps 8 google-maps dart flutter
我想将此自定义小部件添加到我的标记中。我已经设计了小部件,但我不知道如何将其放置在标记上。
如何自定义它以始终显示在信息窗口位置。它包裹在一个定位的小部件中,但我无法将其放置在信息窗口位置。
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,
),
)
],
),
Run Code Online (Sandbox Code Playgroud)
没有简单的 API 可以将您的小部件用作 google 地图插件中的标记。
但也有一些技巧。您应该将小部件导出到图像并将其传递给BitmapDescriptor.fromBytes.
有用的链接如何操作:
如果它看起来像样板代码,您可以使用 leaflet 的 flutter_map 插件
| 归档时间: |
|
| 查看次数: |
16488 次 |
| 最近记录: |