[英]Flutter: leading letter instead of icon for ListTile
我认为这张图片对我想要存档的内容是不言自明的:
ListTile(
// leading: Icon(Icons.attach_money), <-- this works but I need the currency icon dynamic
leading: Text(
"€",
style: TextStyle(
fontSize: 20,
),
),
title: Text(translate('options.currency')),
subtitle: Text(translate('options.currency_help')),
onTap: () {
showCurrencyPicker(
context: context,
searchHint: translate('options.search_currency'),
showFlag: true,
showCurrencyName: true,
showCurrencyCode: true,
onSelect: (Currency currency) {
print('Select currency: ${currency.name}');
},
favorite: [_options['currency']],
);
},
),
我可以展示它,但我不确定如何正确居中
你可以使用 PreferredSize,我正在测试它并工作
PreferredSize(
preferredSize: Size.fromHeight(100.0),
// here the desired height
child: Text("€", style: TextStyle(fontSize:30,height: 1.5),),
)
您可以添加一个 SizedBox,并像这样放置文本
ListTile(
leading: SizedBox(
height: 100.0, //desired height
width: 100.0, //desired width
child: Text("£", //any currency you want
style: TextStyle(
fontSize: 20,
),
),
),
title: ...,
subtitle: ...
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.