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,
);
/// 用户全局组件配置
AbnormalStateConfig abnormalStateConfig = BaseThemeConfig.instance
.getConfig(configId: configId)
.abnormalStateConfig;
_titleTextStyle = abnormalStateConfig.titleTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_titleTextStyle),
);
_contentTextStyle = abnormalStateConfig.contentTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextHint,
fontSize: commonConfig.fontSizeSubHead,
).merge(_contentTextStyle),
);
_operateTextStyle = abnormalStateConfig.operateTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeBase,
).merge(_operateTextStyle),
);
_singleTextStyle = abnormalStateConfig.singleTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBaseInverse,
fontSize: commonConfig.fontSizeSubHead,
).merge(_singleTextStyle),
);
_doubleTextStyle = abnormalStateConfig.doubleTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeSubHead,
).merge(_doubleTextStyle),
);
_btnRadius ??= abnormalStateConfig._btnRadius;
_singleMinWidth ??= abnormalStateConfig._singleMinWidth;
_doubleMinWidth ??= abnormalStateConfig._doubleMinWidth;
}