【发布时间】:2020-11-29 21:59:38
【问题描述】:
我正在使用这个https://github.com/brendan-duncan/image/wiki 尝试在我的图像上绘制文本我的问题是当我尝试传递的图像是图像时如何获取 Image.drawString() 中第一个参数所需的图像被相机插件捕捉到了吗?
final path = join(
// Store the picture in the temp directory.
// Find the temp directory using the `path_provider` plugin.
(await getTemporaryDirectory()).path,
'${DateTime.now()}.png',
);
// Attempt to take a picture and log where it's been saved.
await _controller.takePicture(path);
//this doesnt work
img.Image image = Image.file(File(path))
img.drawString(image, img.arial_24, 50, 50, "Hello World");
我收到此错误:
'Image(其中Image定义在 myflutterpath/packages/flutter/lib/src/widgets/image.dart)' 不能 分配给'Image类型的变量(其中Image定义在 /myflutterpath/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.4/lib/src/image.dart)'
【问题讨论】:
-
这能回答你的问题吗? How to draw String into Image?