Tar*_*rma 24
对于删除分隔线,只需使用Theme小部件扭曲并使分隔线颜色透明。
final theme = Theme.of(context).copyWith(dividerColor: Colors.transparent);
return Theme(data: theme, child: ExpansionTile(...));
Run Code Online (Sandbox Code Playgroud)
Gün*_*uer 15
来源 ExpansionTile
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
_borderColor.end = theme.dividerColor;
_headerColor
..begin = theme.textTheme.subhead.color
..end = theme.accentColor;
_iconColor
..begin = theme.unselectedWidgetColor
..end = theme.accentColor;
_backgroundColor.end = widget.backgroundColor;
Run Code Online (Sandbox Code Playgroud)
您可以Theme通过修改包装元素来推导出您可以影响的内容dividerColor
_borderColor.end = theme.dividerColor;
Run Code Online (Sandbox Code Playgroud)
final theme = Theme.of(context).copyWith(dividerColor: Colors.yellow);
return Theme(data: theme, child: ExpansionTile(...));
Run Code Online (Sandbox Code Playgroud)
类似的_headerColor,_iconColor,_backgroundColor.如果您需要更多自定义,您可以随时复制源并根据自己的喜好对其进行自定义.