【问题标题】:how to do upload image within steps method in flutter如何在颤动的步骤方法中上传图像
【发布时间】:2020-03-25 11:11:07
【问题描述】:
     List<Step> steps = [    
      Step(
      isActive: false,
      state: StepState.editing,
      title: const Text('Id Proof'),
      content: Column(
        children: <Widget>[
         OutlineButton(
         onPressed: chooseImage,
         child: Text('Choose Image'),),
         showImage(),            
         OutlineButton(
         onPressed: startUpload,
         child:Text(Upload Image),
         ),
      Text(status,textAlign:TextAlign.center,style:TextStyle(color:Colors.green))
        ],
      ),
    ),  
  ];

无法初始化chooseImage、showImage、startUpload。我已尝试启动上述步骤。显示错误

在初始化器中只能访问静态成员

【问题讨论】:

    标签: flutter flutter-image


    【解决方案1】:

    chooseImage 和 startUpload 不是函数,如果你创建了一个函数

    void chooseImage() {
     // add image picking code here
    }
    

    那么你需要改变

    onPressed: chooseImage,
    

    onPressed: chooseImage(),
    

    如果你不做这些功能你也可以做

    onPressed: () {
    // add image picking code here
    }
    

    【讨论】:

      猜你喜欢
      • 2022-11-06
      • 2021-08-12
      • 2022-11-06
      • 2020-02-17
      • 2023-01-20
      • 2020-08-24
      • 2023-03-11
      • 2020-12-22
      • 2022-11-06
      相关资源
      最近更新 更多