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,
);
/// 用户全局组件配置
GalleryDetailConfig galleryDetailConfig = BaseThemeConfig.instance
.getConfig(configId: configId)
.galleryDetailConfig;
_appbarTitleStyle = galleryDetailConfig.appbarTitleStyle.merge(
BaseTextStyle(
color: commonConfig.colorTextBaseInverse,
fontSize: commonConfig.fontSizeSubHead,
).merge(_appbarTitleStyle),
);
_appbarActionStyle = galleryDetailConfig.appbarActionStyle.merge(
_appbarActionStyle,
);
_appbarConfig ??= galleryDetailConfig.appbarConfig;
_appbarBackgroundColor ??= galleryDetailConfig.appbarBackgroundColor;
_tabBarUnSelectedLabelStyle = galleryDetailConfig.tabBarUnSelectedLabelStyle
.merge(BaseTextStyle(fontSize: commonConfig.fontSizeSubHead))
.merge(_tabBarUnSelectedLabelStyle);
_tabBarLabelStyle = galleryDetailConfig.tabBarLabelStyle
.merge(
BaseTextStyle(
color: commonConfig.colorTextBaseInverse,
fontSize: commonConfig.fontSizeSubHead,
),
)
.merge(_tabBarLabelStyle);
_tabBarBackgroundColor ??= galleryDetailConfig._tabBarBackgroundColor;
_pageBackgroundColor ??= galleryDetailConfig._pageBackgroundColor;
_bottomBackgroundColor ??= galleryDetailConfig._bottomBackgroundColor;
_titleStyle = galleryDetailConfig.titleStyle
.merge(
BaseTextStyle(
color: commonConfig.colorTextBaseInverse,
fontSize: commonConfig.fontSizeHead,
),
)
.merge(_titleStyle);
_contentStyle = galleryDetailConfig.contentStyle
.merge(BaseTextStyle(fontSize: commonConfig.fontSizeBase))
.merge(_contentStyle);
_actionStyle = galleryDetailConfig.actionStyle
.merge(
BaseTextStyle(
color: commonConfig.colorTextBaseInverse,
fontSize: commonConfig.fontSizeBase,
),
)
.merge(_actionStyle);
_iconColor ??= galleryDetailConfig._iconColor;
}