Skip to content

Commit 796557a

Browse files
authored
Merge pull request #796 from Tencent/release/0.2.6
chore: release 0.2.6
2 parents 1198e08 + 00e6aee commit 796557a

File tree

16 files changed

+317
-147
lines changed

16 files changed

+317
-147
lines changed

tdesign-component/CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
2+
## 🌈 0.2.6 `2025-11-14`
3+
### 🚀 Features
4+
- `TDNoticeBar`: Added `content` property, deprecated and compatible with the original context property @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
5+
- `TDButton`: Added gradient color background @jflin19990707 ([#773](https://github.com/Tencent/tdesign-flutter/pull/773))
6+
- `TDToast`: TDToast supports displaying multiple toasts @jflin19990707 ([#780](https://github.com/Tencent/tdesign-flutter/pull/780))
7+
- `TDUpload`: Added custom upload listener @leenc123 ([#775](https://github.com/Tencent/tdesign-flutter/pull/775))
8+
- `TDTable`: Added custom footer property @leenc123 ([#776](https://github.com/Tencent/tdesign-flutter/pull/776))
9+
10+
### 🐞 Bug Fixes
11+
- `TDMultiCascader`: Fixed initialIndexes parameter not taking effect @epoll-j ([#752](https://github.com/Tencent/tdesign-flutter/pull/752))
12+
- `TDDialog`: Fixed button text overflow issue @jflin19990707 ([#772](https://github.com/Tencent/tdesign-flutter/pull/772))
13+
- `TDDateTimePicker`: Changed English configuration for date, hour, minute, second to abbreviations @jflin19990707 ([#770](https://github.com/Tencent/tdesign-flutter/pull/770))
14+
- `TDCell`: Fixed overflow issue when note is too long @jflin19990707 ([#769](https://github.com/Tencent/tdesign-flutter/pull/769))
15+
- `TDCell`: Fixed alignment issue between icon and text in the cell @runoob-coder ([#789](https://github.com/Tencent/tdesign-flutter/pull/789))
16+
- `TDProgress`: Fixed style issue when progress bar changes @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
17+
18+
### 📝 Documentation
19+
- `docs`: Optimized document format and content @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
20+
21+
### 🚧 Others
22+
- Components fully adapted to dark mode, optimized and adjusted component styles (experimental version) @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
23+
- `demo`: Optimized and adjusted demo example project and code demonstrations, upgraded Android build configuration and dependencies to be compatible with Flutter from `3.16.9` to the latest version (`3.35.5`), adjusted web preview iframe style to remove top margin @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
24+
- `web`: Overridden web dependencies, resolved version conflict with flutter_localizations, compatible with previous Flutter versions @runoob-coder ([#744](https://github.com/Tencent/tdesign-flutter/pull/744))
25+
126
## 🌈 0.2.5 `2025-09-12`
227
### 🐞 Bug Fixes
328
- `TDPopover`: Added custom corner radius property @jflin19990707 ([#727](https://github.com/Tencent/tdesign-flutter/pull/727))

tdesign-component/demo_tool/bin/api_tool_macos_arm64

100644100755
File mode changed.

tdesign-component/example/lib/component_test/dark_test.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,15 @@ class App extends StatelessWidget {
5555
theme: themeData.systemThemeDataLight!.copyWith(
5656
/// 根据自己的需求用 TD 颜色覆盖 Material/Cupertino 的颜色
5757
cupertinoOverrideTheme: const CupertinoThemeData().copyWith(
58-
barBackgroundColor: themeData.bgColorContainer.withValues(
59-
alpha: 0.5,
60-
),
58+
barBackgroundColor: themeData.bgColorContainer.withOpacity(0.5),
6159
),
6260
/// ... 更多重载主题
6361
),
6462

6563
/// 深色模式
6664
darkTheme: themeData.systemThemeDataDark?.copyWith(
6765
cupertinoOverrideTheme: const CupertinoThemeData().copyWith(
68-
barBackgroundColor: themeData.dark?.grayColor13.withValues(
69-
alpha: 0.5,
70-
),
66+
barBackgroundColor: themeData.dark?.grayColor13.withOpacity(0.5),
7167
),
7268

7369
/// ... 更多重载主题

tdesign-component/example/lib/main.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/foundation.dart' show kIsWeb;
12
import 'package:flutter/material.dart';
23
import 'package:flutter/services.dart';
34
import 'package:provider/provider.dart';
@@ -11,6 +12,7 @@ import 'home.dart';
1112
import 'l10n/app_localizations.dart';
1213
import 'provider/locale_provider.dart';
1314
import 'provider/theme_mode_provider.dart';
15+
import 'util/web_theme_listener.dart';
1416

1517
Future<void> main() async {
1618
WidgetsFlutterBinding.ensureInitialized();
@@ -82,6 +84,17 @@ class _MyAppState extends State<MyApp> {
8284
],
8385
child: Consumer2<ThemeModeProvider, LocaleProvider>(
8486
builder: (context, themeModeProvider, localeProvider, child) {
87+
// 在 Web 平台设置 postMessage 监听
88+
if (PlatformUtil.isWeb) {
89+
WidgetsBinding.instance.addPostFrameCallback((_) {
90+
// 仅在 Web 平台执行
91+
if (!kIsWeb) {
92+
return;
93+
}
94+
setupThemeModeListener(themeModeProvider);
95+
});
96+
}
97+
8598
return MaterialApp(
8699
title: 'TDesign Flutter Example',
87100
theme: _themeData.systemThemeDataLight,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Web 平台主题模式监听器
2+
// 使用条件导入,避免在非 Web 平台编译时出错
3+
// 条件导入:Web 平台使用 dart:html,非 Web 平台使用 stub
4+
export 'web_theme_listener_stub.dart'
5+
if (dart.library.html) 'web_theme_listener_web.dart';
6+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// 非 Web 平台的 stub 实现
2+
3+
import 'package:flutter/material.dart';
4+
5+
import '../provider/theme_mode_provider.dart';
6+
7+
/// 非 Web 平台的 stub 实现(空操作)
8+
void setupThemeModeListener(ThemeModeProvider themeModeProvider) {
9+
// 非 Web 平台不需要实现,空操作即可
10+
}
11+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Web 平台实现:使用 dart:html 监听 postMessage
2+
3+
import 'dart:html' as html;
4+
5+
import 'package:flutter/material.dart';
6+
7+
import '../provider/theme_mode_provider.dart';
8+
9+
// 静态变量,用于确保只设置一次监听器
10+
bool _listenerSetup = false;
11+
12+
/// Web 平台的主题模式监听器实现
13+
void setupThemeModeListener(ThemeModeProvider themeModeProvider) {
14+
// 只设置一次监听器
15+
if (_listenerSetup) return;
16+
_listenerSetup = true;
17+
18+
// 监听来自父窗口的 postMessage
19+
html.window.onMessage.listen((event) {
20+
if (event.data is Map) {
21+
final data = event.data as Map;
22+
if (data['type'] == 'theme-mode-change') {
23+
final themeMode = data['themeMode'] as String?;
24+
if (themeMode == 'dark') {
25+
themeModeProvider.themeMode = ThemeMode.dark;
26+
} else if (themeMode == 'light') {
27+
themeModeProvider.themeMode = ThemeMode.light;
28+
}
29+
}
30+
}
31+
});
32+
}
33+

tdesign-component/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: tdesign_flutter
22
description: Tencent TDesign UI component library of Flutter, suitable for use in mobile projects.
3-
version: 0.2.5
3+
version: 0.2.6
44
homepage: https://github.com/Tencent/tdesign-flutter
55

66
environment:

tdesign-site/FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ TDesign Flutter 从 `0.2.0` 版本开始,正常情况下,每月初发一个
1717
- 在应用使用中切换主题颜色,示例代码请参考 example 的 `main.dart``home.dart`https://github.com/Tencent/tdesign-flutter/blob/main/tdesign-component/example/lib/main.dart
1818
- 转换完整代码:https://github.com/Tencent/tdesign-flutter/blob/main/tdesign-component/example/shell/theme/css2JsonTheme.dart
1919

20-
## 暗色模式
20+
## 深色模式
2121

22-
TDesign Flutter 目前未内置暗色模式,请使用“自定义主题”方式自己适配。
22+
可参考[深色模式](https://tdesign.tencent.com/flutter/dark-mode)
2323

2424
## 文字居中
2525

tdesign-site/package-lock.json

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)