columns<T> static method

Future<T?> columns<T>(
  1. List<Widget> children, {
  2. required RFunc<DataResult<T>> validator,
  3. String? title,
  4. String? message,
  5. bool? ok = true,
  6. bool? cancel = true,
  7. DialogWidth? dialogWidth,
})

Implementation

static Future<T?> columns<T>(
  List<Widget> children, {
  required RFunc<DataResult<T>> validator,
  String? title,
  String? message,
  bool? ok = true,
  bool? cancel = true,
  DialogWidth? dialogWidth,
}) async {
  return await showDialogX((b) {
    b.okCallback = () {
      DataResult<T> r = validator.call();
      if (r.success) {
        b.setResult(r.data);
      } else if (r.message != null) {
        Toast.error(r.message);
      }
      return r.success;
    };
    return b.buildColumn(children, title: title, message: message, ok: ok, cancel: cancel, dialogWidth: dialogWidth);
  });
}