createPost method

Future<void> createPost(
  1. BuildContext context, {
  2. String? communityId,
})

Implementation

Future<void> createPost(BuildContext context, {String? communityId}) async {
  HapticFeedback.heavyImpact();
  bool isCommunity = (communityId != null) ? true : false;
  if (isCommunity) {
    if (isNotSelectVideoYet() && isNotSelectedImageYet()) {
      log("isNotSelectVideoYet() & isNotSelectVideoYet()");

      ///create text post
      await createTextpost(context, communityId: communityId);
    } else if (isNotSelectedImageYet()) {
      log("isNotSelectedImageYet");

      ///create video post
      await creatVideoPost(context, communityId: communityId);
    } else if (isNotSelectVideoYet()) {
      log("isNotSelectVideoYet");

      ///create image post
      await creatImagePost(context, communityId: communityId);
    }
  } else {
    if (isNotSelectVideoYet() && isNotSelectedImageYet()) {
      log("isNotSelectVideoYet() & isNotSelectVideoYet()");

      ///create text post
      await createTextpost(context);
    } else if (isNotSelectedImageYet()) {
      log("isNotSelectedImageYet");

      ///create video post
      await creatVideoPost(context);
    } else if (isNotSelectVideoYet()) {
      log("isNotSelectVideoYet");

      ///create image post
      await creatImagePost(context);
    }
  }
}