【发布时间】:2020-10-19 17:07:30
【问题描述】:
我有以下列表图块
Container buildContactTile(BuildContext context, Color backgroundColor, Color foregroundColor, UserModel contact,
ContactListController controller) {
final ThemeData theme = Theme.of(context);
return Container(
decoration: BoxDecoration(color: backgroundColor, borderRadius: const BorderRadius.all(Radius.circular(5.0))),
child: ListTile(
leading: ProfileAvatar(
backgroundColor: foregroundColor,
photoURL: contact.photoURL,
radius: 15.0,
fallback: ProfileAvatar.nameAvatar(displayName: contact.displayName),
),
title: Text(contact.displayName, style: theme.textTheme.bodyText1.apply(color: foregroundColor)),
trailing: _interactive ? Icon(Icons.add, color: foregroundColor) : null,
onTap: () => _interactive ? controller.updateSelectedContacts(contact) : null,
),
);
}
我用一个容器包装它,根据小部件的状态为其赋予不同的背景颜色。但是发生的情况是,我的飞溅没有考虑圆形边框半径,因此飞溅颜色最终出现在列表图块的角落。如何使初始颜色透明,或使其考虑圆角?
当您按住 ListTile 并按住时,您会在角落看到以下内容
【问题讨论】:
-
你能添加屏幕外观的图片吗?
-
添加了一张按下列表磁贴时的样子
-
我正在阅读InkWell 文档,我认为通过将
ListTile包装在InkWell中,我们可以通过在@ 中设置containedInkWell:true来配置触摸波纹以解决圆角问题987654328@ -
刚试了,不行
-
抱歉我的笔记本电脑崩溃了,我希望明天测试一下