【发布时间】:2021-04-29 10:34:33
【问题描述】:
如果用户点击特定文本,它应该被转换为文本字段,我需要从用户那里获取输入值,到目前为止,我已经使用 split 将字符串添加到列表中,并使用 listview 显示列表项。
我有两个疑问。 1.如何在特定文本点击时将文本转换为文本字段。 2.如果我在listview中重新运行文本字段它需要全宽,我不能通过给定宽度将文本字段包装在容器内,因为文本宽度可能会根据API响应而改变
任何建议都将不胜感激。
this is what i need to achieve
String demoString = 'You might want to try eating more healthy food.';
new Row(children: <Widget>[
Expanded(
child: SizedBox(
height: 150.0,
child: ListView(
padding: EdgeInsets.all(20),
scrollDirection: Axis.horizontal,
children: demoString
.split(' ')
.map((String text) => Padding(
padding: const EdgeInsets.all(18.0),
child: Text(text)))
.toList(),
)))
])
【问题讨论】:
标签: flutter dart text textfield