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: 3.29
References
#API documentation:
Relevant issues:
Relevant PRs:
除非另有说明,本文档之所提及适用于 Flutter 3.38.1 版本。本页面最后更新时间:2025-10-28。查看文档源码 或者 为本页面内容提出建议。