registerProperties method

  1. @override
void registerProperties()
override

Abstract method to register an IProperties' properties schema and resolver.

Implementation

@override
void registerProperties() {
  registerAbstractType("KModel", {});
  registerAbstractType("KRequest", {
    "url": Types.string,
    "path": Types.string,
    "method": const EditorPropertyListType(
        ["get", "post", "put", "delete", "patch"]),
    "pathParameters": const EditorPropertyType("KModel"),
    "queryArgs": const EditorPropertyType("KModel"),
    "body": const EditorPropertyType("KModel"),
  });
  registerSpecType("KConfirmMessage", (_) => null, {
    "title": Types.string,
    "message": Types.string,
    "attributes": Types.json,
  });
  registerSpecType("Decorator", (_) => null, {
    "width": Types.int,
    "height": Types.int,
    "padding": Types.intArray,
    "alignment": Types.alignment,
    "constraints": Types.boxConstraints,
    "decoration": Types.boxDecoration,
  });

  registerSpecType(Types.safeArea.type, (_) => null, {
    "left": Types.bool,
    "top": Types.bool,
    "right": Types.bool,
    "bottom": Types.bool,
    "minimum": Types.intArray,
  });

  registerListType(Types.kOperator.type, (v) => v,
      ["==", "!=", ">", ">=", "<", "<=", "contain", "not contain"]);
  registerListType(Types.materialType.type, getMaterialType,
      ["canvas", "card", "circle", "button", "transparency"]);
  registerListType(Types.appBarLeadingIcon.type, getAppBarLeadingWidget,
      ["back", "close"]);
  registerListType(Types.alignment.type, getAlignment, [
    "topLeft",
    "topCenter",
    "topRight",
    "bottomLeft",
    "bottomCenter",
    "bottomRight",
    "centerLeft",
    "center",
    "centerRight"
  ]);
  registerListType(
      Types.tableVerticalAlignment.type,
      getTableCellVerticalAlignment,
      ["top", "middle", "bottom", "baseline", "fill"]);
  registerListType(
      Types.verticalDirection.type, getVerticalDirection, ["up", "down"]);
  registerListType(Types.crossAxisAlignment.type, getCrossAxisAlignment,
      ["center", "start", "end", "stretch", "baseline"]);
  registerListType(Types.mainAxisAlignment.type, getMainAxisAlignment, [
    "center",
    "start",
    "end",
    "spaceEvenly",
    "spaceAround",
    "spaceBetween"
  ]);
  registerListType(Types.mainAxisSize.type, getMainAxisSize, ["min", "max"]);
  registerListType(Types.fontWeight.type, getFontWeight, [
    "normal",
    "bold",
    "100",
    "200",
    "300",
    "400",
    "500",
    "600",
    "700",
    "800",
    "900"
  ]);
  registerListType(Types.fontStyle.type, getFontStyle, ["normal", "italic"]);
  registerListType(Types.textAlign.type, getTextAlign,
      ["left", "right", "center", "justify"]);
  registerListType(Types.textAlignVertical.type, getTextAlignVertical,
      ["top", "center", "bottom"]);
  registerListType(Types.textOverflow.type, getTextOverflow,
      ["clip", "ellipsis", "fade", "visible"]);
  registerListType(Types.textInputType.type, getTextInputType, [
    "datetime",
    "email",
    "multiline",
    "name",
    "number",
    "int",
    "decimal",
    "phone",
    "url",
    "password"
  ]);
  registerListType(Types.textCapitalization.type, getTextCapitalization,
      ["words", "sentences", "characters", "none"]);
  registerListType(Types.textDecoration.type, getTextDecoration,
      ["overline", "underline", "lineThrough"]);
  registerListType(Types.floatingLabelBehavior.type, getFloatingLabelBehavior,
      ["auto", "always", "never"]);
  registerListType(Types.floatingActionButtonLocation.type,
      getFloatingActionButtonLocation, [
    "centerTop",
    "centerFloat",
    "centerDocked",
    "startTop",
    "startFloat",
    "startDocked",
    "endTop",
    "endFloat",
    "endDocked"
  ]);
  registerListType(Types.boxShape.type, getBoxShape, ["rectangle", "circle"]);
  registerListType(Types.borderType.type, (v) => v,
      ["all", "vertical", "horizontal", "left", "top", "right", "bottom"]);
  registerListType(Types.axis.type, getAxis, ["vertical", "horizontal"]);
  registerListType(Types.boxFit.type, getBoxFit, [
    "none",
    "fill",
    "contain",
    "cover",
    "fitWidth",
    "fitHeight",
    "scaleDown"
  ]);
  registerListType(Types.tabBarIndicatorSize.type, getTabBarIndicatorSize,
      ["tab", "label"]);
  registerListType(
      Types.collapseMode.type, getCollapseMode, ["pin", "parallax", "none"]);
  registerListType(Types.stretchMode.type, getStretchMode,
      ["fadeTitle", "blurBackground", "zoomBackground"]);
  registerListType(Types.navigationRailLabelType.type,
      getNavigationRailLabelType, ["none", "selected", "all"]);
  registerListType(
      Types.routeTransitionBuilder.type, getRouteTransitionsBuilder, [
    "slideLeft",
    "slideRight",
    "slideUp",
    "size",
    "scale",
    "fade",
    "none"
  ]);

  registerSpecType(
      Types.kCondition.type,
      (spec) =>
          spec != null ? Lowder.properties.evaluateCondition(spec) : false,
      {
        "and": Types.kCondition,
        "or": Types.kCondition,
      },
      subTypes: {
        "OperatorCondition": {
          "left": Types.string,
          "operator": Types.kOperator,
          "right": Types.string,
        },
        "NullOrEmpty": {"value": Types.string, "not": Types.bool},
      });

  registerValueSpecType(Types.kFormatter.type, formatValue, {}, subTypes: {
    "KFormatterTranslate": {
      "transform": const EditorPropertyListType(
          ["upper", "lower", "capitalize", "title", "none"]),
      "attributes": Types.json,
    },
    "KFormatterDateTime": {
      "format": Types.string,
      "diffToNow": Types.bool,
    },
    "KFormatterDate": {
      "format": Types.string,
      "diffToNow": Types.bool,
    },
    "KFormatterTime": {
      "format": Types.string,
      "diffToNow": Types.bool,
    },
    "KFormatterNumber": {
      "format": Types.string,
    },
    "KFormatterCurrency": {
      "symbol": Types.string,
      "decimalDigits": Types.int,
    },
    "KFormatterNone": {},
  });

  registerValueSpecType(Types.tabController.type, getTabController, {
    "length": Types.int,
    "initialIndex": Types.int,
  });

  registerSpecType(Types.edgeInsets.type, getInsets, {});

  registerSpecType(Types.boxConstraints.type, getBoxConstraints, {
    "minWidth": Types.int,
    "maxWidth": Types.int,
    "minHeight": Types.int,
    "maxHeight": Types.int,
  });

  registerSpecType(Types.size.type, getSize,
      {"width": Types.double, "height": Types.double});

  registerSpecType(Types.tableBorder.type, getTableBorder, {
    "left": Types.borderSide,
    "top": Types.borderSide,
    "right": Types.borderSide,
    "bottom": Types.borderSide,
    "horizontalInside": Types.borderSide,
    "verticalInside": Types.borderSide,
  });
  registerSpecType(Types.border.type, getBorder, {
    "type": Types.borderType,
    "color": Types.color,
    "width": Types.int,
  });
  registerSpecType(Types.borderSide.type, getBorderSide, {
    "color": Types.color,
    "width": Types.int,
  });
  registerSpecType(Types.shapeBorder.type, getShapeBorder, {
    "type": const EditorPropertyListType([
      "circle",
      "roundedRectangle",
      "beveledRectangle",
      "continuousRectangle"
    ]),
    "borderRadius": Types.intArray,
    "color": Types.color,
    "width": Types.double,
  });

  registerSpecType(Types.shadow.type, getShadow, {
    "color": Types.color,
    "blurRadius": Types.double,
    "offset": Types.double,
  });
  registerSpecType(Types.boxShadow.type, getBoxShadow, {
    "color": Types.color,
    "blurRadius": Types.double,
    "spreadRadius": Types.double,
    "offset": Types.double,
  });
  registerSpecType(Types.boxDecoration.type, getBoxDecoration, {
    "color": Types.color,
    "border": Types.border,
    "borderRadius": Types.intArray,
    "boxShape": Types.boxShape,
    "boxShadow": Types.boxShadow,
    "gradient": Types.gradient,
  });

  registerSpecType(Types.notchedShape.type, getNotchedShape, {}, subTypes: {
    "CircularNotchedRectangle": {},
    "AutomaticNotchedShape": {
      "host": Types.shapeBorder,
      "guest": Types.shapeBorder,
    },
  });

  registerSpecType(Types.textStyle.type, getTextStyle, {
    "fontFamily": Types.string,
    "fontSize": Types.int,
    "fontWeight": Types.fontWeight,
    "fontStyle": Types.fontStyle,
    "height": Types.double,
    "wordSpacing": Types.double,
    "letterSpacing": Types.double,
    "overflow": Types.textOverflow,
    "decoration": Types.textDecoration,
    "color": Types.color,
    "backgroundColor": Types.color,
  });
  registerSpecType(Types.toolbarOptions.type, getContextMenuBuilder, {
    "copy": Types.bool,
    "cut": Types.bool,
    "paste": Types.bool,
    "delete": Types.bool,
    "selectAll": Types.bool,
    "liveTextInput": Types.bool,
  });
  registerSpecType(Types.inputBorder.type, getInputBorder, {
    "color": Types.color,
    "width": Types.int,
    "borderRadius": Types.intArray,
  }, subTypes: {
    "OutlineInputBorder": {"gapPadding": Types.double},
    "UnderlineInputBorder": {"gapPadding": Types.double},
  });
  registerValueSpecType(Types.inputDecoration.type, getInputDecoration, {
    "alignLabelWithHint": Types.bool,
    "isCollapsed": Types.bool,
    "isDense": Types.bool,
    "constraints": Types.boxConstraints,
    "border": Types.inputBorder,
    "disabledBorder": Types.inputBorder,
    "enabledBorder": Types.inputBorder,
    "errorBorder": Types.inputBorder,
    "focusedBorder": Types.inputBorder,
    "focusedErrorBorder": Types.inputBorder,
    "contentPadding": Types.intArray,
    "labelText": Types.string,
    "labelStyle": Types.textStyle,
    "errorText": Types.string,
    "errorStyle": Types.textStyle,
    "focusColor": Types.color,
    "fillColor": Types.color,
    "hoverColor": Types.color,
    "hintText": Types.string,
    "hintStyle": Types.textStyle,
    "prefixText": Types.string,
    "prefixStyle": Types.textStyle,
    "suffixText": Types.string,
    "suffixStyle": Types.textStyle,
    "helperText": Types.string,
    "helperStyle": Types.textStyle,
    "floatingLabelStyle": Types.textStyle,
    "floatingLabelBehavior": Types.floatingLabelBehavior,
  });
  registerSpecType(Types.textInputFormatter.type, getTextInputFormatters, {
    "allow": Types.string,
    "deny": Types.string,
    "mask": Types.string,
    "maskFilter": Types.string,
  });
  registerListType(Types.textInputAction.type, getTextInputAction, [
    "none",
    "done",
    "continueAction",
    "go",
    "next",
    "previous",
    "newline",
    "unspecified",
    "send",
    "search",
    "join",
    "route",
    "emergencyCall"
  ]);

  registerSpecType(Types.gradient.type, getGradient, {
    "colors": Types.stringArray,
    "stops": Types.doubleArray,
  }, subTypes: {
    "LinearGradient": {
      "begin": Types.alignment,
      "end": Types.alignment,
    },
    "RadialGradient": {
      "center": Types.alignment,
      "focal": Types.alignment,
      "focalRadius": Types.double,
      "radius": Types.double,
    },
    "SweepGradient": {
      "startAngle": Types.double,
      "endAngle": Types.double,
      "center": Types.alignment,
    }
  });

  registerValueSpecType(Types.imageProvider.type, getImageProvider, {},
      subTypes: {
        "AssetImage": {
          "package": Types.string,
        },
        "NetworkImage": {
          "scale": Types.double,
        },
        "MemoryImage": {
          "scale": Types.double,
        },
        "FileImage": {
          "scale": Types.double,
        },
      });

  registerSpecType(Types.iconThemeData.type, getIconThemeData, {
    "color": Types.color,
    "opacity": Types.double,
    "size": Types.double,
    "shadow": Types.shadow,
  });

  registerSpecType(Types.buttonStyle.type, getButtonStyle, {
    "alignment": Types.alignment,
    "padding": Types.intArray,
    "foregroundColor": Types.color,
    "backgroundColor": Types.color,
    "overlayColor": Types.color,
    "shape": Types.shapeBorder,
    "side": Types.borderSide,
    "textStyle": Types.textStyle,
    "fixedSize": Types.size,
    "minimumSize": Types.size,
    "maximumSize": Types.size,
    "visualDensity": const EditorPropertyListType(
        ["standard", "comfortable", "compact", "adaptivePlatformDensity"]),
  });

  registerSpecType(Types.loadingIndicator.type, getLoadingIndicator, {
    "color": Types.color,
    "backgroundColor": Types.color,
    "strokeWidth": Types.double,
  });

  registerListType(Types.curve.type, getCurve, [
    "linear",
    "decelerate",
    "fastLinearToSlowEaseIn",
    "fastEaseInToSlowEaseOut",
    "ease",
    "easeIn",
    "easeInToLinear",
    "easeInSine",
    "easeInQuad",
    "easeInCubic",
    "easeInQuart",
    "easeInQuint",
    "easeInExpo",
    "easeInCirc",
    "easeInBack",
    "easeOut",
    "linearToEaseOut",
    "easeOutSine",
    "easeOutQuad",
    "easeOutCubic",
    "easeOutQuart",
    "easeOutQuint",
    "easeOutExpo",
    "easeOutCirc",
    "easeOutBack",
    "easeInOut",
    "easeInOutSine",
    "easeInOutQuad",
    "easeInOutCubic",
    "easeInOutCubicEmphasized",
    "easeInOutQuart",
    "easeInOutQuint",
    "easeInOutExpo",
    "easeInOutCirc",
    "easeInOutBack",
    "fastOutSlowIn",
    "slowMiddle",
    "bounceIn",
    "bounceOut",
    "bounceInOut",
    "elasticIn",
    "elasticOut",
    "elasticInOut",
  ]);

  registerListType(Types.keyboardDismissBehavior.type,
      getKeyboardDismissBehavior, ["onDrag", "manual"]);
}