AlertDialog constructor Null safety

const AlertDialog(
  1. {Key? key,
  2. Widget? title,
  3. EdgeInsetsGeometry? titlePadding,
  4. TextStyle? titleTextStyle,
  5. Widget? content,
  6. EdgeInsetsGeometry contentPadding = const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),
  7. TextStyle? contentTextStyle,
  8. List<Widget>? actions,
  9. EdgeInsetsGeometry actionsPadding = EdgeInsets.zero,
  10. MainAxisAlignment? actionsAlignment,
  11. OverflowBarAlignment? actionsOverflowAlignment,
  12. VerticalDirection? actionsOverflowDirection,
  13. double? actionsOverflowButtonSpacing,
  14. EdgeInsetsGeometry? buttonPadding,
  15. Color? backgroundColor,
  16. double? elevation,
  17. String? semanticLabel,
  18. EdgeInsets insetPadding = _defaultInsetPadding,
  19. Clip clipBehavior = Clip.none,
  20. ShapeBorder? shape,
  21. AlignmentGeometry? alignment,
  22. bool scrollable = false}
)

Creates an alert dialog.

Typically used in conjunction with showDialog.

The contentPadding must not be null. The titlePadding defaults to null, which implies a default that depends on the values of the other properties. See the documentation of titlePadding for details.

Implementation

const AlertDialog({
  Key? key,
  this.title,
  this.titlePadding,
  this.titleTextStyle,
  this.content,
  this.contentPadding = const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),
  this.contentTextStyle,
  this.actions,
  this.actionsPadding = EdgeInsets.zero,
  this.actionsAlignment,
  this.actionsOverflowAlignment,
  this.actionsOverflowDirection,
  this.actionsOverflowButtonSpacing,
  this.buttonPadding,
  this.backgroundColor,
  this.elevation,
  this.semanticLabel,
  this.insetPadding = _defaultInsetPadding,
  this.clipBehavior = Clip.none,
  this.shape,
  this.alignment,
  this.scrollable = false,
}) : assert(contentPadding != null),
     assert(clipBehavior != null),
     super(key: key);