【问题标题】:How to edit the text prase by Json after assigning it to the TextFormFeild in Flutter?将Json分配给Flutter中的TextFormField后如何通过Json编辑文本短语?
【发布时间】:2022-01-06 10:14:03
【问题描述】:

我 prase 一个 json 并将文本分配给一个 TextFormField。我想再次编辑该文本。怎么做。我试过了,但是json显示的文本仍然显示。

    var disConroller = TextEditingController();
    disConroller.text = snapshot.data[0].note

我的 TextTextFormField

 TextFormField(
            maxLines: null,
            minLines: null,
            controller: disConroller, // enterd text
            decoration: InputDecoration(
            hintText: "type here..",
            focusedBorder: OutlineInputBorder(
            borderSide:
            BorderSide(width: 2.0)),
            enabledBorder: OutlineInputBorder(
            borderSide:
            BorderSide(width: 1.0),)

【问题讨论】:

    标签: json flutter dart flutter-textformfield texteditingcontroller


    【解决方案1】:

    通过查看您的代码很难回答,但如果已正确解析您的 json,将其解码并转换为字符串,然后将该字符串分配给控制器更改状态,这将起作用,我只能用代码说明这一点你已经分享了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 2021-10-05
      • 1970-01-01
      • 2013-02-09
      • 2016-08-25
      • 2014-10-08
      • 1970-01-01
      相关资源
      最近更新 更多