Skip to content

Commit 66f5968

Browse files
committed
refactor(ads): extend NativeAdView in AdMobNativeAdWidget
- Extend NativeAdView in AdMobNativeAdWidget for better code reuse - Update constructor to use super keyword for nativeAd parameter - Remove redundant comments and imports
1 parent 96c5574 commit 66f5968

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/ads/widgets/admob_native_ad_widget.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/native_ad.dart'
33
as app_native_ad;
4+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/native_ad_view.dart';
45
import 'package:google_mobile_ads/google_mobile_ads.dart' as admob;
56

67
/// {@template admob_native_ad_widget}
@@ -11,12 +12,9 @@ import 'package:google_mobile_ads/google_mobile_ads.dart' as admob;
1112
/// [admob.AdWidget] to display it. It also handles the lifecycle
1213
/// management of the native ad object.
1314
/// {@endtemplate}
14-
class AdMobNativeAdWidget extends StatefulWidget {
15+
class AdMobNativeAdWidget extends NativeAdView {
1516
/// {@macro admob_native_ad_widget}
16-
const AdMobNativeAdWidget({required this.nativeAd, super.key});
17-
18-
/// The generic native ad data containing the AdMob-specific ad object.
19-
final app_native_ad.NativeAd nativeAd;
17+
const AdMobNativeAdWidget({required super.nativeAd, super.key});
2018

2119
@override
2220
State<AdMobNativeAdWidget> createState() => _AdMobNativeAdWidgetState();

0 commit comments

Comments
 (0)