PrimaryDialog<T> constructor
PrimaryDialog<T> ({
- required String title,
- Key? key,
- TextStyle? titleStyle,
- Color? titleBackgroundColor,
- Widget? titleWidget,
- String? description,
- TextStyle? descriptionStyle,
- Widget? body,
- ScrollPhysics bodyScrollPhysics = const AlwaysScrollableScrollPhysics(),
- DialogButton? dialogButton,
- bool barrierDismissible = true,
- double elevation = 10.0,
- double? dialogWidth,
- double? dialogHeight,
- double? titleHeight = 60.0,
- 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",
);