我想將 ListTile 中的所有內容(標題、副標題、前導、尾隨等)垂直居中對齊。最好的方法是什麼?
const Padding(
padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
child: Card(
child: ListTile(
leading: FlutterLogo(size: 55),
title: Text('Overview'),
subtitle: Text(
'250.956.261',
),
trailing: Icon(
Icons.arrow_right_outlined,
size: 30,
),
isThreeLine: true,
),
),
),
我最初誤解了你的問題是關於水平居中ListTile
. 要將項目垂直居中放置在卡片內部,您可能只需要禁用該isThreeLine
參數。禁用它會導致內容垂直居中。
構建方法的代碼:
@override
Widget build(BuildContext context) {
return const Center(
child: Card(
child: ListTile(
leading: FlutterLogo(size: 55),
title: Text('Overview'),
subtitle: Text(
'250.956.261',
),
trailing: Icon(
Icons.arrow_right_outlined,
size: 30,
),
// isThreeLine: true,
),
),
);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句