【问题标题】:How to collect all user input in one list?如何在一个列表中收集所有用户输入?
【发布时间】:2021-08-23 15:09:04
【问题描述】:

此代码用于生成多个ListTile,每个TextField, 现在我想在一个 List 中收集所有用户输入。我怎样才能做到这一点?我应该如何使用输入控制器?

ListTile(
  title: Row(
    children: <Widget>[
      Text(
        "Room : ${index + 1}",
        style: TextStyle(
          fontSize: 22,
          color: Colors.blue,
          fontWeight: FontWeight.bold,
        ),
      ),
      Expanded(
        child: Container(
          padding: EdgeInsets.fromLTRB(30, 0, 5, 0),
          child: TextField(
            // controller: RoomNameController,
            style: TextStyle(
              color: Colors.blue,
              fontSize: 19,
              fontWeight: FontWeight.w500,
            ),
            textAlign: TextAlign.left,
            decoration: InputDecoration(
              contentPadding:
                  const EdgeInsets.symmetric(horizontal: 30, vertical: 5),
              hintText: 'Room ${index + 1} Name',
              border: OutlineInputBorder(),
            ),
            keyboardType: TextInputType.text,
            textInputAction: TextInputAction.done,
            autofocus: true,
          ),
        ),
      ),
    ],
  ),
);

【问题讨论】:

    标签: android flutter dart listview


    【解决方案1】:

    我认为您需要在这里做的第一件事是按照Stack Overflow rules 重写您的问题

    您需要做的是修改标题、包装代码并添加更多具体细节。

    【讨论】:

      猜你喜欢
      • 2013-11-25
      • 2016-11-08
      • 2017-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-18
      • 1970-01-01
      • 2022-07-29
      相关资源
      最近更新 更多