loadAndShowRewardInter static method

dynamic loadAndShowRewardInter(
  1. BuildContext context,
  2. RewardHolder rewardHolder, {
  3. required dynamic onEarned(),
  4. required dynamic onAdClosed(),
  5. required dynamic onAdFail(),
})

Implementation

static loadAndShowRewardInter(BuildContext context, RewardHolder rewardHolder,
    {required Function() onEarned,
    required Function() onAdClosed,
    required Function() onAdFail}) {
  if (isTestDevice) {
    onAdClosed();
    Fluttertoast.showToast(
        msg: "Is Test Device",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0);
    return;
  }

  AdmobUtils.loadAndShowRewardedInterstitial(rewardHolder, onEarned: () {
    onEarned();
    Fluttertoast.showToast(
        msg: "on Rewarded",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0);
  }, onAdClosed: () {
    onAdClosed();
    Fluttertoast.showToast(
        msg: "on Ad close",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0);
  }, onAdFail: () {
    onAdFail();
    Fluttertoast.showToast(
        msg: "ad fail",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0);
  }, enableLoadingDialog: true);
}