easy_video_ad 0.0.1 easy_video_ad: ^0.0.1 copied to clipboard
A new flutter plugin project.
import 'package:flutter/material.dart';
import 'package:easy_video_ad/easy_video_ad.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
EasyVideoAd.putInMain();
//EasyVideoAd.setImmersiveMode(true);
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String adEvent;
@override
initState() {
super.initState();
adEvent = "nothing";
EasyVideoAd.onAdEventTriggered = (String event) {
setState(() {
adEvent = event;
});
};
}
@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"),
),
],
),
),
),
),
);
}
}