initForEditPost method

void initForEditPost(
  1. AmityPost post
)

Implementation

void initForEditPost(AmityPost post) {
  textEditingController.clear();
  imageUrlList.clear();
  videoUrl = null;

  var textdata = post.data as TextData;
  textEditingController.text = textdata.text!;
  var children = post.children;
  if (children != null) {
    if (children[0].data is ImageData) {
      imageUrlList = [];
      for (var child in children) {
        var imageData = child.data as ImageData;
        imageUrlList.add(imageData.fileInfo.fileUrl);
      }

      log("ImageData: $imageUrlList");
    } else if (children[0].data is VideoData) {
      var videoData = children[0].data as VideoData;

      videoUrl =
          "https://api.${env!.region}.amity.co/api/v3/files/${videoData.fileId}/download?size=full";
      log("VideoPost: $videoUrl");
    }
  }
}