dialogBackgroundSchemeColor property

SchemeColor? dialogBackgroundSchemeColor
final

Defines which Theme based ColorScheme based color dialogs use as as their background color.

This will affect both background in DialogTheme and TimePickerThemeData.

If undefined, defaults to SchemeColor.surface.

If set to null Dialog will use its Flutter SDK default, which is ThemeData.dialogBackgroundColor which again is ColorScheme.background. TimePickerDialog dialogs will use their own Flutter SDK default, which is ColorScheme.surface.

Since FlexColorScheme also sets ThemeData.dialogBackgroundColor to ColorScheme.surface, there is no difference when using FlexColorscheme and setting dialogBackgroundSchemeColor to null versus keeping it at its default value SchemeColor.surface. This is valid as long as ThemeData.dialogBackgroundColor exists, but it will be in deprecated, see issue https://github.com/flutter/flutter/issues/91772. After that there will be a difference.

Using surface color as default instead of background, ensures that dark mode dialogs will get elevation overlay in Material 2 color, also when surface and background color are not equal. See issue: https://github.com/flutter/flutter/issues/90353

Implementation

final SchemeColor? dialogBackgroundSchemeColor;