File tree Expand file tree Collapse file tree 4 files changed +15
-17
lines changed
Expand file tree Collapse file tree 4 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -264,10 +264,10 @@ class ArchiveLocalAdsBloc
264264
265265 try {
266266 final updatedAd = switch (adToRestore) {
267- LocalNativeAd ad => ad.copyWith (status: ContentStatus .active),
268- LocalBannerAd ad => ad.copyWith (status: ContentStatus .active),
269- LocalInterstitialAd ad => ad.copyWith (status: ContentStatus .active),
270- LocalVideoAd ad => ad.copyWith (status: ContentStatus .active),
267+ final LocalNativeAd ad => ad.copyWith (status: ContentStatus .active),
268+ final LocalBannerAd ad => ad.copyWith (status: ContentStatus .active),
269+ final LocalInterstitialAd ad => ad.copyWith (status: ContentStatus .active),
270+ final LocalVideoAd ad => ad.copyWith (status: ContentStatus .active),
271271 _ => throw StateError (
272272 'Unknown LocalAd type: ${adToRestore .runtimeType }' ,
273273 ),
Original file line number Diff line number Diff line change @@ -9,11 +9,10 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_manage
99import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart'
1010 hide
1111 DeleteLocalAdForeverRequested,
12- UndoDeleteLocalAdRequested,
13- RestoreLocalAdRequested;
14- import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/content_status_l10n.dart' ;
12+ RestoreLocalAdRequested,
13+ UndoDeleteLocalAdRequested;
1514import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/extensions.dart' ;
16- import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/string_truncate .dart' ;
15+ import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/local_ad_to_ad_type .dart' ;
1716import 'package:intl/intl.dart' ;
1817import 'package:ui_kit/ui_kit.dart' ;
1918
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localiz
88import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart' ;
99import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart' ;
1010import 'package:flutter_news_app_web_dashboard_full_source_code/router/routes.dart' ;
11- import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/content_status_l10n.dart' ; // Added import
11+ // Added import
1212import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/extensions.dart' ;
1313import 'package:go_router/go_router.dart' ;
1414import 'package:intl/intl.dart' ;
@@ -400,7 +400,7 @@ class _LocalAdsDataSource extends DataTableSource {
400400 ),
401401 IconButton (
402402 icon: const Icon (Icons .edit),
403- tooltip: l10n.edit ,
403+ tooltip: l10n.editLocalAds ,
404404 onPressed: () {
405405 // Navigate to edit page based on ad type
406406 switch (ad.adType) {
Original file line number Diff line number Diff line change 11import 'package:core/core.dart' ;
22
3- /// Defines extension methods for [LocalAd] to convert its `adType` string
4- /// to the corresponding [AdType] enum.
5- extension LocalAdToAdType on LocalAd {
6- /// Converts the `adType` string of this [LocalAd] instance to an [AdType] enum.
3+ /// Extension on [LocalAd] to provide a convenient way to get its [AdType] .
4+ extension LocalAdX on LocalAd {
5+ /// Converts the [LocalAd] 's `adType` string to an [AdType] enum value.
76 ///
8- /// Throws a [StateError ] if the `adType` string does not correspond to a
9- /// valid [AdType] enum value.
7+ /// Throws a [FormatException ] if the `adType` string does not correspond
8+ /// to a valid [AdType] enum value.
109 AdType toAdType () {
1110 switch (adType) {
1211 case 'native' :
@@ -18,7 +17,7 @@ extension LocalAdToAdType on LocalAd {
1817 case 'video' :
1918 return AdType .video;
2019 default :
21- throw StateError ('Unknown adType : $adType ' );
20+ throw FormatException ('Unknown AdType for LocalAd : $adType ' );
2221 }
2322 }
2423}
You can’t perform that action at this time.
0 commit comments