gpt4 book ai didi

dart - Flutter:自定义 ExpansionTile

转载 作者:IT老高 更新时间:2023-10-28 12:42:31 24 4
gpt4 key购买 nike

是否可以在 flutter 中更改扩展图 block ?具体来说,我想删除它在扩展时创建的分隔符。我也想调整它的填充。那可能吗?谢谢!

最佳答案

来自ExpansionTile

的来源

https://github.com/flutter/flutter/blob/d927c9331005f81157fa39dff7b5dab415ad330b/packages/flutter/lib/src/material/expansion_tile.dart#L176-L184

  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 类似。如果您需要更多自定义,您可以随时复制源代码并根据自己的喜好对其进行自定义。

关于dart - Flutter:自定义 ExpansionTile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52305920/

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