execute method

  1. @override
Future<bool?> execute(
  1. String caller,
  2. String propertyOrFunction,
  3. List arguments
)
override

Implementation

@override
Future<bool?> execute(String caller, String propertyOrFunction, List<dynamic> arguments) async
{
  if (scope == null) return null;
  var function = propertyOrFunction.toLowerCase().trim();
  switch (function)
  {
    case "open" :

      // modal width
      String? width = arguments.length > 0 ? S.toStr(arguments[0]) : null;
      if (width == null) width = (widthPercentage != null) ? "${this.widthPercentage}%" : "${this.width}";

      // modal height
      String? height = arguments.length > 1 ? S.toStr(arguments[1]) : null;
      if (height == null) height = (heightPercentage != null) ? "${this.heightPercentage}%" : "${this.height}";

      // resizeable
      bool resizeable = this.resizeable;
      if (arguments.length > 2) resizeable = S.toBool(arguments[2]) ?? true;

      // closeable
      bool closeable = this.closeable;
      if (arguments.length > 3) closeable = S.toBool(arguments[3]) ?? true;

      // draggable
      bool draggable = this.draggable;
      if (arguments.length > 4) draggable = S.toBool(arguments[4]) ?? true;

      // modal
      bool modal = this.modal;
      if (arguments.length > 5) modal = S.toBool(arguments[5]) ?? true;

      overlay = NavigationManager().openModal(ModalView(this), context, modal: modal, resizeable: resizeable, closeable: closeable, draggable: draggable, width: width, height: height);
      return true;

    case "close" :
      NavigationManager().closeModal(overlay, context);
      return true;
  }
  return super.execute(caller, propertyOrFunction, arguments);
}