![](/img/trans.png)
[英]In Flutter, how to use FittedBox to resize Text inside of a Row?
[英]Flutter How to using text field inside ListTile?
我想實現一個 ListTile,它在尾部是一個文本字段,這類似於 iOS 靜態 tableview,以便用戶可以單擊它並直接編輯文本。 無論如何如何在 Flutter 中做到這一點?
好吧,stackoverflow 的人總是不想回答問題。 對於以后的人可能也有這個煩惱,下面是解決辦法:
new ListTile(
title: Text('簽名'),
trailing: new Container(
width: 150.0,
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Expanded(
flex: 3,
child: new TextField(
textAlign: TextAlign.end,
decoration:
new InputDecoration.collapsed(hintText: '$userAddr'),
),
),
new Expanded(
child: new IconButton(
icon: new Icon(Icons.chevron_right),
color: Colors.black26,
onPressed: () {},
),
)
],
),
),
),
始終對文本文件使用擴展。
現在,在flutter V1.12,你可以在標題中放置一行並填充它
ListTile(
title: Row(
children: <Widget>[
Expanded(
child: Text('簽名')
),
Expanded(
child: TextField(
// your TextField's Content
),
),
],
),
trailing: IconButton(
icon: new Icon(Icons.chevron_right),
color: Colors.black26,
onPressed: () {},
)
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.