【问题标题】:flutter Insert pictures from the previous pageflutter 插入上一页的图片
【发布时间】:2022-12-06 18:56:21
【问题描述】:

class AddResultPage extends StatelessWidget {
  const AddResultPage({
    Key? key, 
    required this.faceImage, 
    required this.faceName,
    }) : super(key: key);

  final File? faceImage;
  final String faceName;

  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          faceImage == null ? Container() : Image.file(faceImage!),
          // ignore: prefer_const_constructors
          CircleAvatar(
            radius: 50,
            foregroundImage: ,
          ),
          Text(faceName),

如何在 CircleAvatar 中插入图像? 我不知道为什么它是错误的......

foregroundImage: faceImage,

我不知道如何使用 CircleAvatar,文件路径....

请帮忙....

【问题讨论】:

    标签: ios flutter dart


    【解决方案1】:

    您不能将文件作为图像插入,但您可以做的是使用

    FileImageCircleAvatar(
        ..
        foregroundImage: FileImage(widget.faceImage),
    ),
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-12
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      相关资源
      最近更新 更多