圆形图像文件

编程入门 行业动态 更新时间:2024-10-07 02:29:45
本文介绍了圆形图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我执行了这段代码以从Firestore获取图像并将其用作地图标记的图标.

I did this code to get an image from firestore and use it as an icon for a Map Marker.

final StorageReference storageReference = FirebaseStorage().ref().child("ProfilePictures/" + widget.userId); String avatarDownloadPath = await storageReference.getDownloadURL(); final File _avatar = await DefaultCacheManager().getSingleFile(avatarDownloadPath); Uint8List __avatar = await _avatar.readAsBytes(); BitmapDescriptor avatar = BitmapDescriptor.fromBytes(__avatar); setState(() { _markers.add(Marker(markerId: MarkerId("UserPosition"), position: userLocation, icon: avatar )); });

此代码有效,但我想将图像设置为圆形,但我不知道该怎么做...

This code works but I want to set the image a round shape and I don't know how to do this...

如果您还知道如何像这样添加一个圆并为其设置动画,我将非常满意:

If you also know how to add a circle around and animate it like this I will be really satisfied:

(我没有找到更具代表性的东西,但我只想一个圆圈)

(I didn't find something more representative but I just want one circle)

推荐答案

您可以使用Canvas绘制圆形图像,并使用PictureRecorder保存为最终图像并将其放置在标记位图描述符fyi中:自定义标记

You can use use Canvas to draw a round image and use PictureRecorder to save as a final image and put it in the marker bitmapdescriptor, fyi: custom marker

在文章中用ImagePainter替换TextPainter

Replace TextPainter with ImagePainter in the article

OR

使用小部件自定义标记

更多推荐

圆形图像文件

本文发布于:2023-10-10 18:11:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479349.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:圆形   图像文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!