【问题标题】:Can't load an image using file picker as asset image in flutter无法使用文件选择器加载图像作为颤动中的资产图像
【发布时间】:2022-01-13 11:22:14
【问题描述】:
  class RoundedImageFile extends StatelessWidget {
  final PlatformFile image;
  final double size;

  const RoundedImageFile({required this.image, required this.size, Key? key})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: size,
      width: size,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage(image.path!),
          fit: BoxFit.cover,
        ),
        borderRadius: BorderRadius.all(Radius.circular(size)),
        color: Colors.black,
      ),
    );
  }
}

【问题讨论】:

  • 请正确添加代码
  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: flutter


【解决方案1】:

https://youtu.be/LlO5jydXws0

这可能会有所帮助

如果您只想通过厨房打开图像,则无法在资产图像中打开文件使用 Image.file(filename) 保存图像后使用图像提取器

如果我让你正确,请告诉我问题没有足够的内容 形成解决

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    • 2021-03-30
    • 2022-08-10
    • 2020-02-10
    • 2013-08-04
    • 1970-01-01
    相关资源
    最近更新 更多