# Deprecate `ThemeData.dialogBackgroundColor` in favor of `DialogThemeData.backgroundColor`

> The `ThemeData.dialogBackgroundColor` parameter has been replaced by `DialogThemeData.backgroundColor`.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## 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:

```dart
theme: ThemeData(
  dialogBackgroundColor: Colors.orange,
),
```

Code after migration:

```dart
theme: ThemeData(
  dialogTheme: const DialogThemeData(backgroundColor: Colors.orange),
),
```

## Timeline

Landed in version: 3.28.0-0.1.pre<br>
In stable release: 3.29

## References

API documentation:

- [`ThemeData.dialogBackgroundColor`][]
- [`DialogThemeData.backgroundColor`][]
- [`DialogThemeData`][]
- [`Dialog`][]
- [`AlertDialog`][]

Relevant issues:

- [Issue #91772][]

Relevant PRs:

- [Deprecate `ThemeData.dialogBackgroundColor` in favor of `DialogTheme.backgroundColor`][]

[`ThemeData.dialogBackgroundColor`]: https://api.flutter-io.cn/flutter/material/ThemeData/dialogBackgroundColor.html
[`DialogThemeData.backgroundColor`]: https://api.flutter-io.cn/flutter/material/DialogThemeData/backgroundColor.html
[`DialogThemeData`]: https://api.flutter-io.cn/flutter/material/DialogThemeData-class.html
[`Dialog`]: https://api.flutter-io.cn/flutter/material/Dialog-class.html
[`AlertDialog`]: https://api.flutter-io.cn/flutter/material/AlertDialog-class.html
[Issue #91772]: https://github.com/flutter/flutter/issues/91772
[Deprecate `ThemeData.dialogBackgroundColor` in favor of `DialogTheme.backgroundColor`]: https://github.com/flutter/flutter/pull/155072

