Skip to content

Commit

Permalink
💄 更新信息流展示和广告位id
Browse files Browse the repository at this point in the history
  • Loading branch information
BytesZero committed Oct 22, 2023
1 parent 5a37420 commit fd8aae2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
18 changes: 1 addition & 17 deletions example/lib/ads_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,6 @@ class AdsConfig {
/// 获取 Banner 广告位id 02
static String get bannerId02 => '949641736';

/// 获取 Feed 信息流列表
static List<String> get feedIdList =>
[feedId01, feedId02, feedId03, feedId04, feedId05];

/// 获取 Feed 信息流广告位id(左右图文 2.4)
static String get feedId01 => '949641744';

/// 获取 Feed 信息流广告位id(上下文图0.9)
static String get feedId02 => '949641747';

/// 获取 Feed 信息流广告位id(三图2)
static String get feedId03 => '949641752';

/// 获取 Feed 信息流广告位id(文字悬浮1)
static String get feedId04 => '949641755';

/// 获取 Feed 信息流广告位id(竖版0.5)
static String get feedId05 => '949641756';
static String get feedId => '949641744';
}
9 changes: 3 additions & 6 deletions example/lib/pages/feed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ class _FeedPageState extends State<FeedPage> {
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
if (index % 10 == 4) {
int adIndex = index ~/ 10;
print('adIndex:$adIndex');
if (index % 5 == 4) {
int adIndex = index ~/ 5;
if (adIndex >= feedAdList.length) {
return Container(
height: 80,
Expand Down Expand Up @@ -92,10 +91,8 @@ class _FeedPageState extends State<FeedPage> {
// 加载信息流广告
Future<void> getFeedAdList() async {
try {
int feedIdIndex = feedAdList.length ~/ 3 % AdsConfig.feedIdList.length;
print('feedIdIndex:$feedIdIndex');
List<int> adResultList = await FlutterPangleAds.loadFeedAd(
AdsConfig.feedIdList[feedIdIndex],
AdsConfig.feedId,
count: 3,
);
feedAdList.addAll(adResultList);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/pages/fullscreen_video_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class _FullScreenVideoPageState extends State<FullScreenVideoPage> {
body: Column(
children: [
ListTile(
title: Text('新插屏-全屏'),
onTap: () => showFullScreenVideoAd(AdsConfig.newInterstitialId),
title: Text('新插屏-半屏'),
onTap: () => showFullScreenVideoAd(AdsConfig.newInterstitialId2),
),
kDivider,
ListTile(
title: Text('新插屏-半屏'),
onTap: () => showFullScreenVideoAd(AdsConfig.newInterstitialId2),
title: Text('新插屏-全屏'),
onTap: () => showFullScreenVideoAd(AdsConfig.newInterstitialId),
),
kDivider,
],
Expand Down

0 comments on commit fd8aae2

Please sign in to comment.