@@ -11,11 +11,9 @@ import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/inlin
1111import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/native_ad.dart' ;
1212import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/admob_inline_ad_widget.dart' ;
1313import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/demo_banner_ad_widget.dart' ;
14- import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/demo_native_ad_widget.dart' ;
1514import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/local_banner_ad_widget.dart' ;
1615import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/local_native_ad_widget.dart' ;
1716import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart' ;
18- import 'package:flutter_news_app_mobile_client_full_source_code/app/config/app_environment.dart' ;
1917import 'package:logging/logging.dart' ;
2018import 'package:ui_kit/ui_kit.dart' ;
2119
@@ -159,7 +157,7 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
159157 final loadedAd = await widget.adService.getInArticleAd (
160158 adConfig: widget.adConfig,
161159 adThemeStyle: widget.adThemeStyle,
162- headlineImageStyle: headlineImageStyle, // Pass the headlineImageStyle
160+ headlineImageStyle: headlineImageStyle,
163161 );
164162
165163 if (loadedAd != null ) {
@@ -210,33 +208,13 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
210208
211209 @override
212210 Widget build (BuildContext context) {
213- final appEnvironment = context.read <AppBloc >().state.environment;
214211 final headlineImageStyle = context
215212 .read <AppBloc >()
216213 .state
217214 .settings
218215 .feedPreferences
219216 .headlineImageStyle;
220217
221- // In demo environment, display placeholder ads directly.
222- if (appEnvironment == AppEnvironment .demo) {
223- // Determine the ad type from the adConfig's articleAdConfiguration
224- final adType =
225- widget.adConfig.articleAdConfiguration.defaultInArticleAdType;
226- switch (adType) {
227- case AdType .native :
228- return DemoNativeAdWidget (headlineImageStyle: headlineImageStyle);
229- case AdType .banner:
230- return DemoBannerAdWidget (headlineImageStyle: headlineImageStyle);
231- case AdType .interstitial:
232- case AdType .video:
233- // Interstitial and video ads are not inline, so they won't be
234- // handled by InArticleAdLoaderWidget. Fallback to a generic placeholder.
235- return const SizedBox .shrink ();
236- }
237- }
238-
239- // For other environments (development, production), proceed with real ad loading.
240218 if (_isLoading) {
241219 return const Padding (
242220 padding: EdgeInsets .symmetric (
@@ -276,6 +254,10 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
276254 }
277255 // Fallback for unsupported local ad types or errors
278256 return const SizedBox .shrink ();
257+ case AdPlatformType .demo:
258+ // In demo environment, display placeholder ads directly.
259+ // In-article ads are now always banners, so we use DemoBannerAdWidget.
260+ return DemoBannerAdWidget (headlineImageStyle: headlineImageStyle);
279261 }
280262 }
281263 }
0 commit comments