我想增加 CircleAvatar 的大小作为 Listtile 的引导。但是如果我增加半径,圆就不会保持其比例并变成椭圆。
这是我的代码:
ListView.builder(
itemCount: friendlist.length,
itemBuilder: (BuildContext context, int index) {
print(friendlist[index]);
return ListTile(
title: Text(friendlist[index]["nickname"],
style: TextStyle(fontSize: 20)),
leading: CircleAvatar(
radius: 50,
backgroundColor: Colors.transparent,
backgroundImage: CachedNetworkImageProvider(core.url + "profiles/" + friendlist[index]["avatar_id"]),
),
subtitle:
Text(friendlist[index]["lost_last"])
);
}));
我试过的:谢谢
最佳答案
ListTitle 目前无法做到这一点,因为这是他们为小部件标准添加的应用限制
To be accessible, tappable leading and trailing widgets have to be at least 48x48 in size. However, to adhere to the Material spec, trailing and leading widgets in one-line ListTiles should visually be at most 32 (dense: true) or 40 (dense: false) in height, which may conflict with the accessibility requirement.
您可以根据您的要求创建自定义小部件。
关于flutter - 在 ListTile 中更改 CircleAvatar 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62730770/