PrimaryDialog<T> constructor

PrimaryDialog<T>({
  1. required String title,
  2. Key? key,
  3. TextStyle? titleStyle,
  4. Color? titleBackgroundColor,
  5. Widget? titleWidget,
  6. String? description,
  7. TextStyle? descriptionStyle,
  8. Widget? body,
  9. ScrollPhysics bodyScrollPhysics = const AlwaysScrollableScrollPhysics(),
  10. DialogButton? dialogButton,
  11. bool barrierDismissible = true,
  12. double elevation = 10.0,
  13. double? dialogWidth,
  14. double? dialogHeight,
  15. double? titleHeight = 60.0,
  16. double dialogBorderRadius = 4.0,
})

Creates a PrimaryDialog instance with the specified parameters.

This constructor allows you to create a new PrimaryDialog instance with the required and optional parameters. The title parameter is required, and either description or body can be provided, but not both.

Example:

var dialog = PrimaryDialog<bool>(
  title: 'Confirmation',
  // ... other parameters ...
);

Implementation

PrimaryDialog({
  required this.title,
  this.key,
  this.titleStyle,
  this.titleBackgroundColor,
  this.titleWidget,
  this.description,
  this.descriptionStyle,
  this.body,
  this.bodyScrollPhysics = const AlwaysScrollableScrollPhysics(),
  this.dialogButton,
  this.barrierDismissible = true,
  this.elevation = 10.0,
  this.dialogWidth,
  this.dialogHeight,
  this.titleHeight = 60.0,
  this.dialogBorderRadius = 4.0,
})  : assert(
        (description == null || body == null),
        'Cannot add both description and body',
      ),
      assert(
        (description != null || body != null),
        "Either description or body should be provided",
      );