easy_video_ad 1.0.1 copy "easy_video_ad: ^1.0.1" to clipboard
easy_video_ad: ^1.0.1 copied to clipboard

discontinuedreplaced by: easy_ads

Only works on Android. A Plugin which allows you to use the RewardedVideoAd in a very simple way.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:easy_video_ad/easy_video_ad.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  EasyVideoAd.putInMain();

  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String adEvent;
  bool immerSive;

  @override
  initState() {
    super.initState();
    adEvent = "nothing";
    immerSive = false;

    EasyVideoAd.onAdEventTriggered = (String event) {
      setState(() {
        adEvent = event;
      });
    };

    EasyVideoAd.onAdRewarded =
        (int rewardedAmount, String rewardedType, String rewardedItem) {
      print(
          "\n----------------------------onAdRewarded----------------------------------\n");
      print(
          "rewardedAmount: $rewardedAmount\rewardedType: $rewardedType\rewardedItem: $rewardedItem\n");
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SafeArea(
          child: Container(
            width: double.infinity,
            child: Column(
              children: <Widget>[
                Text(adEvent),
                RaisedButton(
                  onPressed: EasyVideoAd.loadTestAd,
                  child: Text("LoadTestAd"),
                ),
                RaisedButton(
                  onPressed: EasyVideoAd.forceLoadTestAd,
                  child: Text("forceLoadTestAd"),
                ),
                RaisedButton(
                  onPressed: EasyVideoAd.showAdIfLoaded,
                  child: Text("showAdIfLoaded"),
                ),
                RaisedButton(
                  onPressed: EasyVideoAd.showAd,
                  child: Text("showAd"),
                ),
                RaisedButton(
                  onPressed: () {
                    immerSive = !immerSive;
                    EasyVideoAd.setImmersiveMode(immerSive);
                  },
                  child: Text("showAd"),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Only works on Android. A Plugin which allows you to use the RewardedVideoAd in a very simple way.

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on easy_video_ad