【发布时间】: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