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,
);
/// 用户全局筛选配置
SelectionConfig selectionConfig =
BaseThemeConfig.instance.getConfig(configId: configId).selectionConfig;
_lightSelectBgColor ??= selectionConfig._lightSelectBgColor;
_lightNormalBgColor ??= selectionConfig._lightNormalBgColor;
_middleSelectBgColor ??= selectionConfig._middleSelectBgColor;
_middleNormalBgColor ??= selectionConfig._middleNormalBgColor;
_deepSelectBgColor ??= selectionConfig._deepSelectBgColor;
_deepNormalBgColor ??= selectionConfig._deepNormalBgColor;
_tagSelectedBackgroundColor ??= commonConfig.brandPrimary.withOpacity(0.12);
_tagNormalBackgroundColor ??= commonConfig.fillBody;
_tagRadius ??= commonConfig.radiusSm;
_flayerBoldTextStyle = selectionConfig.flayerBoldTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_flayerBoldTextStyle),
);
_flayerSelectedTextStyle = selectionConfig.flayerSelectedTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeSubHead,
).merge(_flayerSelectedTextStyle),
);
_flayerNormalTextStyle = selectionConfig.flayerNormalTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_flayerNormalTextStyle),
);
_moreTextStyle = selectionConfig.moreTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextSecondary,
fontSize: commonConfig.fontSizeCaption,
).merge(_moreTextStyle),
);
_optionTextStyle = selectionConfig.optionTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeBase,
).merge(_optionTextStyle),
);
_titleForMoreTextStyle = selectionConfig.titleForMoreTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(_titleForMoreTextStyle),
);
_resetTextStyle = selectionConfig.resetTextStyle.merge(BaseTextStyle(
color: commonConfig.colorTextImportant,
fontSize: commonConfig.fontSizeCaption,
).merge(_resetTextStyle));
_itemBoldTextStyle = selectionConfig.itemBoldTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(_itemBoldTextStyle),
);
_itemSelectedTextStyle = selectionConfig.itemSelectedTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeBase,
).merge(_itemSelectedTextStyle),
);
_itemNormalTextStyle = selectionConfig.itemNormalTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(_itemNormalTextStyle),
);
_inputTextStyle = selectionConfig.inputTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(_inputTextStyle),
);
_hintTextStyle = selectionConfig.hintTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextHint,
fontSize: commonConfig.fontSizeBase,
).merge(_hintTextStyle),
);
_rangeTitleTextStyle = selectionConfig.rangeTitleTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeSubHead,
).merge(_rangeTitleTextStyle),
);
_tagSelectedTextStyle = selectionConfig.tagSelectedTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeCaption,
).merge(_tagSelectedTextStyle),
);
_tagNormalTextStyle = selectionConfig.tagNormalTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeCaption,
).merge(_tagNormalTextStyle),
);
_menuNormalTextStyle = selectionConfig.menuNormalTextStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBase,
fontSize: commonConfig.fontSizeBase,
).merge(_menuNormalTextStyle),
);
_menuSelectedTextStyle = selectionConfig.menuSelectedTextStyle.merge(
BaseTextStyle(
color: commonConfig.brandPrimary,
fontSize: commonConfig.fontSizeBase,
).merge(_menuSelectedTextStyle),
);
}