Skip to content

Commit 1483cdd

Browse files
committed
暗色模式不存在的字段,使用对应的亮色模式值来映射
1 parent 99d9ce1 commit 1483cdd

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tdesign-component/lib/src/theme/td_theme.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,29 @@ class TDThemeData extends ThemeExtension<TDThemeData> {
299299
var theme = parseThemeData(name, themeConfig, extraThemeData);
300300
theme.light = theme;
301301
if (darkName?.isNotEmpty ?? false) {
302+
// 解析暗色模式
302303
var darkTheme = parseThemeData(darkName!, themeConfig, extraThemeData);
303304
darkTheme.light = theme;
304305
theme.dark = darkTheme;
306+
// 填充暗色模式缺失数据
307+
theme.refMap.forEach((key, value) {
308+
darkTheme.refMap.putIfAbsent(key, ()=> value);
309+
});
310+
// theme.fontMap.forEach((key, value) {
311+
// darkTheme.fontMap.putIfAbsent(key, ()=> value);
312+
// });
313+
// theme.radiusMap.forEach((key, value) {
314+
// darkTheme.radiusMap.putIfAbsent(key, ()=> value);
315+
// });
316+
// theme.fontFamilyMap.forEach((key, value) {
317+
// darkTheme.fontFamilyMap.putIfAbsent(key, ()=> value);
318+
// });
319+
// theme.shadowMap.forEach((key, value) {
320+
// darkTheme.shadowMap.putIfAbsent(key, ()=> value);
321+
// });
322+
// theme.spacerMap.forEach((key, value) {
323+
// darkTheme.spacerMap.putIfAbsent(key, ()=> value);
324+
// });
305325
}
306326
if (recoverDefault) {
307327
_defaultThemeData = theme;

0 commit comments

Comments
 (0)