calculateNodeLayout function

Pointer<Int64> calculateNodeLayout(
  1. int engineId,
  2. int rootId,
  3. int nodeId,
  4. double width,
  5. int widthMode,
  6. double height,
  7. int heightMode,
)

Implementation

Pointer<Int64> calculateNodeLayout(
  int engineId,
  int rootId,
  int nodeId,
  double width,
  int widthMode,
  double height,
  int heightMode,
) {
  try {
    final bridge = VoltronRenderBridgeManager.bridgeMap[engineId];
    var layoutParams = FlexLayoutParams(width, height, widthMode, heightMode);
    var result = layoutParams.defaultOutput();
    if (bridge != null) {
      result = bridge.calculateNodeLayout(rootId, nodeId, layoutParams);
    }

    final resultPtr = malloc<Int64>(1);
    resultPtr.asTypedList(1)[0] = result;
    return resultPtr;
  } catch (err) {
    LogUtils.d('calculateNodeLayout', err.toString());
  }
  return Pointer.fromAddress(0);
}