DialogButton constructor

DialogButton({
  1. required BuildContext context,
  2. Key? positiveButtonKey,
  3. Key? negativeButtonKey,
  4. String? positiveButtonName,
  5. Color? positiveButtonBackgroundColor,
  6. TextStyle? positiveButtonStyle,
  7. Widget? positiveButtonWidget,
  8. String? negativeButtonName,
  9. Color? negativeButtonBackgroundColor,
  10. TextStyle? negativeButtonStyle,
  11. Widget? negativeButtonWidget,
  12. dynamic onPositiveButtonPressed()?,
  13. 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",
      );