confirm static method

Future<Object?> confirm({
  1. required dynamic context,
  2. dynamic title,
  3. dynamic titleWidget,
  4. dynamic text,
  5. dynamic textWidget,
  6. dynamic cancelText,
  7. dynamic onValidate,
  8. dynamic onCancel,
})

Implementation

static Future<Object?> confirm(
    {required context,
    title,
    titleWidget,
    text,
    textWidget,
    cancelText,
    onValidate,
    onCancel}) {
  assert(text != null || textWidget != null,
      "You must specify either text or textWidget");
  assert(onValidate != null, "You must specify an handler for onValidate");
  return PopupHelper.showDialog(
    context,
    icon: Icons.contact_support,
    Padding(
      padding: const EdgeInsets.all(3.0),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          textWidget ??
              Text(text, style: Theme.of(context).textTheme.bodySmall)
        ],
      ),
    ),
    button1: okButton(
        context: context,
        onPress: () {
          onValidate?.call();
        }),
    button2: cancelButton(
        context: context,
        onPress: () {
          Navigator.of(context).pop();
          onCancel?.call();
        }),
    title: title,
    titleWidget: titleWidget,
  );
}