Deprecate `ThemeData.dialogBackgroundColor` in favor of `DialogThemeData.backgroundColor`
Summary
#The ThemeData.dialogBackgroundColor
parameter was deprecated in favor of the DialogThemeData.backgroundColor
parameter.
Context
#The defaults for the Dialog
and AlertDialog
widgets can be overridden with a component-specific theme like DialogThemeData
. Previously, the ThemeData.dialogBackgroundColor
parameter was used to override the default dialog background color, which was made redundant by DialogThemeData
.
Description of change
#The ThemeData.dialogBackgroundColor
is deprecated in favor of a component-specific theme. Use DialogThemeData
to override the default background color.
Migration guide
#Replace ThemeData.dialogBackgroundColor
with DialogThemeData.backgroundColor
to override the default dialog background color.
Code before migration:
theme: ThemeData(
dialogBackgroundColor: Colors.orange,
),
Code after migration:
theme: ThemeData(
dialogTheme: const DialogThemeData(backgroundColor: Colors.orange),
),
Timeline
#Landed in version: 3.28.0-0.1.pre
In stable release: Not yet
References
#API documentation:
Relevant issues:
Relevant PRs:
除非另有说明,否则本网站上的文档反映的是 Flutter 的最新稳定版本。页面最后更新于 2025-01-30。 查看源代码 或 报告问题。