feat(ads): 네이티브 광고 적용 및 디버그 스위치 이동

This commit is contained in:
JiWoong Sul
2025-12-03 17:25:00 +09:00
parent 5cae033977
commit d733bf664b
19 changed files with 461 additions and 168 deletions

View File

@@ -145,18 +145,33 @@ class _RestaurantListScreenState extends ConsumerState<RestaurantListScreen> {
return _buildEmptyState(isDark);
}
const adInterval = 6; // 5리스트 후 1광고
const adOffset = 5; // 1~5 리스트 이후 6 광고 시작
final adCount = (items.length ~/ adOffset);
final totalCount = items.length + adCount;
return ListView.builder(
itemCount: items.length + 1,
itemCount: totalCount,
itemBuilder: (context, index) {
if (index == 0) {
final isAdIndex =
index >= adOffset &&
(index - adOffset) % adInterval == 0;
if (isAdIndex) {
return const NativeAdPlaceholder(
margin: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
height: 200, // 카드 높이와 비슷한 중간 사이즈
);
}
final item = items[index - 1];
final adsBefore = index < adOffset
? 0
: ((index - adOffset) ~/ adInterval) + 1;
final itemIndex = index - adsBefore;
final item = items[itemIndex];
return RestaurantCard(
restaurant: item.restaurant,
distanceKm: item.distanceKm,