dialogTheme static method
An opinionated DialogTheme with custom corner radius and elevation.
Corner radius
defaults to kDialogRadius
= 28 and elevation
to
kDialogElevation
= 10.
The default radius follows Material M3 guide: https://m3.material.io/components/dialogs/specs
Implementation
static DialogTheme dialogTheme({
/// Corner radius.
///
/// Defaults to [kDialogRadius] = 28.
final double? radius,
/// Dialog elevation defaults to 10 [kDialogElevation].
final double? elevation = kDialogElevation,
/// Dialog background color.
///
/// Defaults to null and gets default via Dialog's default null theme
/// behavior.
///
/// This property is here so we can provide a custom themed dialog
/// background color when the ThemeData property dialogBackgroundColor
/// is deprecated in Flutter SDK, which it will be in 2022.
final Color? backgroundColor,
}) =>
DialogTheme(
elevation: elevation,
backgroundColor: backgroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(radius ?? kDialogRadius),
),
),
);