initThemeConfig method
部分代码示意如下:
cardTitleConfig.detailTextStyle.merge(
BrnTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(detailTextStyle),
);
- 以 `commonConfig` 字段为基础 merge `detailTextStyle`。
`detailTextStyle` 字段优先级高,当detailTextStyle中字段(如 color)为 null 时
会使用 `commonConfig.colorTextBase`。
- 以默认上一级配置为基础 merge 第一步的结果,当第一步中字段(如 color)为空时,
使用上一层级配置的 color (`cardTitleConfig.detailTextStyle.color`)。
Implementation
@override
void initThemeConfig(
String configId, {
BaseCommonConfig? currentLevelCommonConfig,
}) {
super.initThemeConfig(
configId,
currentLevelCommonConfig: currentLevelCommonConfig,
);
/// 用户全局组件配置
ActionSheetConfig actionSheetConfig = BaseThemeConfig.instance
.getConfig(configId: configId)
.actionSheetConfig;
_titlePadding ??= actionSheetConfig.titlePadding;
_contentPadding ??= actionSheetConfig.contentPadding;
_titleStyle = actionSheetConfig.titleStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextSecondary,
fontSize: commonConfig.fontSizeBase,
).merge(_titleStyle),
);
_itemTitleStyle = actionSheetConfig.itemTitleStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_itemTitleStyle),
);
_itemTitleStyleLink = actionSheetConfig.itemTitleStyleLink.merge(
BaseTextStyle(
color: commonConfig.colorLink,
fontSize: commonConfig.fontSizeSubHead,
).merge(_itemTitleStyleLink),
);
_itemTitleStyleAlert = actionSheetConfig.itemTitleStyleAlert.merge(
BaseTextStyle(
color: commonConfig.brandError,
fontSize: commonConfig.fontSizeBase,
).merge(_itemTitleStyleAlert),
);
_itemDescStyle = actionSheetConfig.itemDescStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeCaption,
).merge(_itemDescStyle),
);
_itemDescStyleLink = actionSheetConfig.itemDescStyleLink.merge(
BaseTextStyle(
color: commonConfig.colorLink,
fontSize: commonConfig.fontSizeCaption,
).merge(_itemDescStyleLink),
);
_itemDescStyleAlert = actionSheetConfig.itemDescStyleAlert.merge(
BaseTextStyle(
color: commonConfig.brandError,
fontSize: commonConfig.fontSizeCaption,
).merge(_itemDescStyleAlert),
);
_cancelStyle = actionSheetConfig.cancelStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_cancelStyle),
);
_topRadius ??= commonConfig.radiusLg;
}