gpt4 book ai didi

flutter - 在 ListTile 中更改 CircleAvatar 大小

转载 作者:行者123 更新时间:2023-12-04 13:35:00 26 4
gpt4 key购买 nike

我想增加 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"])
);
}));
我试过的:
  • 将圆形头像嵌套到固定宽度和高度的容器中->圆形仍然是椭圆
  • 改变 ListView.builder 的 ItemExtent -> The Circle 仍然不能使用所有的空白空间并变成一个椭圆。

  • 谢谢

    最佳答案

    ListTitle 目前无法做到这一点,因为这是他们为小部件标准添加的应用限制

    To be accessible, tappable leading and trailing widgets have to be atleast 48x48 in size. However, to adhere to the Material spec, trailingand leading widgets in one-line ListTiles should visually be at most32 (dense: true) or 40 (dense: false) in height, which may conflictwith the accessibility requirement.


    您可以根据您的要求创建自定义小部件。

    关于flutter - 在 ListTile 中更改 CircleAvatar 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62730770/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com