Skip to content

Commit e6fc27c

Browse files
committed
修复暗色模式切换时,示例desc不跟随的问题
1 parent 7b863b1 commit e6fc27c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tdesign-component/example/lib/base/example_widget.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ class _ExamplePageState extends State<ExamplePage> {
125125
padding:
126126
const EdgeInsets.only(top: 24, bottom: 24),
127127
itemCount: widget.children.length + 3,
128-
itemBuilder: (context, index) {
128+
itemBuilder: (_, index) {
129129
if (index == 0) {
130-
return _buildHeader(context);
130+
// 这里不能传ListView的context,否则暗色模式切换会延迟
131+
return _buildHeader();
131132
}
132133
if (index == widget.children.length + 2) {
133134
return WebMdTool.needGenerateWebMd
@@ -286,7 +287,7 @@ class _ExamplePageState extends State<ExamplePage> {
286287
);
287288
}
288289

289-
Widget _buildHeader(BuildContext context) {
290+
Widget _buildHeader() {
290291
if (widget.showSingleChild) {
291292
return Container();
292293
}
@@ -303,8 +304,7 @@ class _ExamplePageState extends State<ExamplePage> {
303304
TDText(
304305
widget.title,
305306
font: TDTheme.of(context).fontHeadlineSmall,
306-
// todo BuildContext
307-
// textColor: TDTheme.of(context).textColorPrimary,
307+
textColor: TDTheme.of(context).textColorPrimary,
308308
),
309309
Container(
310310
margin: const EdgeInsets.only(
@@ -313,7 +313,6 @@ class _ExamplePageState extends State<ExamplePage> {
313313
child: TDText(
314314
widget.desc,
315315
font: TDTheme.of(context).fontBodyMedium,
316-
// todo BuildContext
317316
textColor: TDTheme.of(context).textColorSecondary,
318317
),
319318
),

0 commit comments

Comments
 (0)