开屏广告
<h1>开屏广告<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A"></a></h1>
<h2>1. 接口API说明<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_1-%E6%8E%A5%E5%8F%A3api%E8%AF%B4%E6%98%8E"></a></h2>
<h3>1.1 开屏请求类<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_1-1-%E5%BC%80%E5%B1%8F%E8%AF%B7%E6%B1%82%E7%B1%BB"></a></h3>
<p><strong>AdRequest</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>placementId</td>
<td>广告位</td>
</tr>
<tr>
<td>userId</td>
<td>媒体用户体系ID ,可选 ,默认null</td>
</tr>
<tr>
<td>options</td>
<td>扩展参数,默认null</td>
</tr>
</tbody>
</table>
<h3>1.2 开屏对象类<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_1-2-%E5%BC%80%E5%B1%8F%E5%AF%B9%E8%B1%A1%E7%B1%BB"></a></h3>
<p><strong>WindmillRewardAd</strong></p>
<table>
<thead>
<tr>
<th>方法</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>WindmillSplashAd(required AdRequest this.request, required this.width, required this.height, this.title, this.desc, required WindmillSplashListener<WindmillSplashAd> this.listener )</td>
<td>初始化开屏广告对象, request 为广告请求对象,必传, width广告宽 必传, height 广告位高 必传, title 可选, desc 品牌区应用描述 可选, listener 开屏视频接口 必传</td>
</tr>
<tr>
<td>loadAd()</td>
<td>发起广告加载</td>
</tr>
<tr>
<td>isReady()</td>
<td>判断当前广告是否存在可展示的广告</td>
</tr>
<tr>
<td>showAd()</td>
<td>展示广告</td>
</tr>
<tr>
<td>getAdInfo()</td>
<td>获取广告信息</td>
</tr>
<tr>
<td>getCacheAdInfoList()</td>
<td>查询当前广告位的所有缓存信息的AdInfo对象、在广告加载成功后调用</td>
</tr>
<tr>
<td>destroy()</td>
<td>销毁广告</td>
</tr>
</tbody>
</table>
<h3>1.4 开屏回调说明<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_1-4-%E5%BC%80%E5%B1%8F%E5%9B%9E%E8%B0%83%E8%AF%B4%E6%98%8E"></a></h3>
<p><strong>WindmillSplashListener</strong> 开屏回调说明</p>
<table>
<thead>
<tr>
<th>回调方法</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>onAdFailedToLoad (WindmillSplashAd ad, WMError error)</td>
<td>广告加载失败</td>
</tr>
<tr>
<td>onAdLoaded (WindmillSplashAd ad)</td>
<td>广告加载成功</td>
</tr>
<tr>
<td>onAdOpened (WindmillSplashAd ad)</td>
<td>广告开始展示</td>
</tr>
<tr>
<td>onAdShowError (WindmillSplashAd ad, WMError error)</td>
<td>广告开始展示失败</td>
</tr>
<tr>
<td>onAdClicked (WindmillSplashAd ad)</td>
<td>广告被用户点击</td>
</tr>
<tr>
<td>onAdSkiped (WindmillSplashAd ad)</td>
<td>用户跳过广告播放</td>
</tr>
<tr>
<td>onAdClosed (WindmillSplashAd ad)</td>
<td>广告关闭</td>
</tr>
<tr>
<td>onAdDidCloseOtherController(WindmillSplashAd ad, WindmillInteractionType interactionType)</td>
<td>此回调在广告跳转到其他控制器时,该控制器被关闭时调用interactionType:此参数可区分是打开的appstore/网页/视频广告详情页面</td>
</tr>
</tbody>
</table>
<h2>2. 示例代码<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_2-%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81"></a></h2>
<h3>2.1 创建开屏广告对象<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_2-1-%E5%88%9B%E5%BB%BA%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A%E5%AF%B9%E8%B1%A1"></a></h3>
<p>dart</p>
<pre><code>AdRequest request = AdRequest(placementId: placementId);
Size size = Size(window.physicalSize.width, window.physicalSize.height);
if(Platform.isIOS){
size = Size(window.physicalSize.width/window.devicePixelRatio, window.physicalSize.height/window.devicePixelRatio);
}
WindmillSplashAd splashAd = WindmillSplashAd( request:request, width:size.width, height:size:heigth listener: listener);</code></pre>
<h3>2.1 设置监听回调<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_2-1-%E8%AE%BE%E7%BD%AE%E7%9B%91%E5%90%AC%E5%9B%9E%E8%B0%83"></a></h3>
<p>dart</p>
<pre><code>class IWMSplashListener extends WindmillSplashListener&lt;WindmillSplashAd&gt; {
@override
void onAdClicked(WindmillSplashAd ad) {
print('flu-Splash --- onAdClicked');
}
@override
void onAdFailedToLoad(WindmillSplashAd ad, WMError error) {
print('flu-Splash --- onAdFailedToLoad -- ${error.toJson()}');
}
@override
void onAdLoaded(WindmillSplashAd ad) {
print('flu-Splash --- onAdLoaded');
}
@override
void onAdOpened(WindmillSplashAd ad) {
print('flu-Splash --- onAdOpened');
}
@override
void onAdShowError(WindmillSplashAd ad,WMError error) {
print('flu-Splash --- onAdShowError -- ${error.toJson()}');
}
@override
void onAdClosed(WindmillSplashAd ad) {
// TODO: implement onAdClosed
print('flu-Splash --- onAdClosed');
}
@override
void onAdSkiped(WindmillSplashAd ad) {
// TODO: implement onAdSkiped
print('flu-Splash --- onAdSkiped');
}
@override
void onAdDidCloseOtherController(WindmillSplashAd ad, WindmillInteractionType interactionType) {
print('flu-Splash --- onAdDidCloseOtherController -- ${interactionType.toString()}');
}
}</code></pre>
<h3>2.2 开屏广告加载<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_2-2-%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A%E5%8A%A0%E8%BD%BD"></a></h3>
<p>dart</p>
<pre><code>splashAd.loadAd();</code></pre>
<h3>2.3 开屏广告播放<a href="https://doc.sigmob.com/ToBid%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/SDK%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E/Flutter/%E5%B9%BF%E5%91%8A%E7%B1%BB%E5%9E%8B/%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A/#_2-3-%E5%BC%80%E5%B1%8F%E5%B9%BF%E5%91%8A%E6%92%AD%E6%94%BE"></a></h3>
<p>dart</p>
<pre><code>bool isReady = await splashAd.isReady();
if(isReady){
splashAd.showAd();
}</code></pre>