是否可以改变颤振的膨胀瓦?具体来说,我想删除它扩展时创建的分隔符。我也想调整它的填充。那可能吗?谢谢!
来自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;
您可以通过修改Theme
将元素包装在dividerColor
中来推导出您可以影响的内容
_borderColor.end = theme.dividerColor;
final theme = Theme.of(context).copyWith(dividerColor: Colors.yellow);
return Theme(data: theme, child: ExpansionTile(...));
与_headerColor
,_iconColor
,_backgroundColor
相似。如果您需要更多自定义,您可以随时复制源并根据自己的喜好对其进行自定义。
只需从https://github.com/flutter/flutter/blob/d927c9331005f81157fa39dff7b5dab415ad330b/packages/flutter/lib/src/material/expansion_tile.dart#L176-L184复制ExpansionTile源代码并根据需要进行编辑,然后制作自定义ExpansionTile !!