onPlatformViewCreated method

dynamic onPlatformViewCreated(
  1. int viewId
)

Implementation

onPlatformViewCreated(int viewId) async {
  _platform = MethodChannel('$viewType/$viewId');
  _platform.setMethodCallHandler((call) async {
    if (call.method == "drawComplete") {
      var data = imageInvokeListModelFromJson(call.arguments);
      _updateDrawImageList(data);
      if (drawComplete != null) drawComplete!();
    } else if (call.method == "clearButton") {
      if (clearButton != null) clearButton!();
    } else if (call.method == "onLoadPlanComplete") {
      if (loadPlanComplete != null) loadPlanComplete!();
    } else if (call.method == "undoComplete") {
      if (undoComplete != null) undoComplete!();
    }else if (call.method == "drawImageSuccess") {
      if (drawImageSuccess != null) drawImageSuccess!(call.arguments);
    } else if (call.method == "selectPin") {
      if (selectPin != null) selectPin!(imageInvokeModelFromJson(call.arguments));
    } else if (call.method == "deletePin") {
      if (deletePin != null) deletePin!(imageInvokeModelFromJson(call.arguments));
    }

    return;
  });
  _platform?.invokeMethod('initFun', {
    "path": imageUrl,
    "drawList": imageInvokeModelToJson(drawListView),
    "drawListStackBack": imageInvokeModelToJson(drawStackBackList),
    "isEditPin": isEditPin,
  });
}