Skip to main content

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:

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
In stable release: Not yet

References

#

API documentation:

Relevant issues:

Relevant PRs: