DialogButton constructor
DialogButton({
- required BuildContext context,
- Key? positiveButtonKey,
- Key? negativeButtonKey,
- String? positiveButtonName,
- Color? positiveButtonBackgroundColor,
- TextStyle? positiveButtonStyle,
- Widget? positiveButtonWidget,
- String? negativeButtonName,
- Color? negativeButtonBackgroundColor,
- TextStyle? negativeButtonStyle,
- Widget? negativeButtonWidget,
- dynamic onPositiveButtonPressed()?,
- dynamic onNegativeButtonPressed()?,
Creates a DialogButton instance with the specified parameters.
This constructor allows you to create a new DialogButton instance with
the required and optional parameters. Either positiveButtonName or
positiveButtonWidget can be provided, but not both. Similarly,
either negativeButtonName or negativeButtonWidget can be provided,
but not both.
Example:
var dialogButton = DialogButton(
context: context,
positiveButtonName: 'OK',
// ... other parameters ...
);
Implementation
DialogButton({
required this.context,
this.positiveButtonKey,
this.negativeButtonKey,
this.positiveButtonName,
this.positiveButtonBackgroundColor,
this.positiveButtonStyle,
this.positiveButtonWidget,
this.negativeButtonName,
this.negativeButtonBackgroundColor,
this.negativeButtonStyle,
this.negativeButtonWidget,
this.onPositiveButtonPressed,
this.onNegativeButtonPressed,
}) : assert(
(positiveButtonName == null || positiveButtonWidget == null),
"Cannot provide both positiveButtonName and positiveButtonWidget",
),
assert(
(negativeButtonName == null || negativeButtonWidget == null),
"Cannot provide both negativeButtonName and negativeButtonWidget",
);