showScreenBasedBanner static method

Widget showScreenBasedBanner(
  1. BuildContext context
)

Implementation

static Widget showScreenBasedBanner(BuildContext context) {
  if (GlobalAdVariables.isPremiumUser) {
    return const SizedBox();
  }
  if (!GlobalAdVariables.globalAdFlag) {
    return const SizedBox();
  }
  final currentRoute = RouteMethods().getCurrentRoute(context);
  AdConfigDataModel adConfig =
      GlobalAdVariables.screenAdJson?[currentRoute] ??
          GlobalAdVariables.screenAdJson!["default"]!;
  if (adConfig.showAds) {
    switch (adConfig.banner) {
      case 1:
        return AdClass.showBannerBasedOnScreen(NetworkType.google);
      case 2:
        return AdClass.showBannerBasedOnScreen(NetworkType.unity);
      case 3:
        return AdClass.showBannerBasedOnScreen(NetworkType.yodoMas);
      default:
        return const SizedBox();
    }
  }

  return const SizedBox();
}