From 14dfe235ec6760a36d2af172efa8f13fe7da17ac Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:04:31 +0100 Subject: [PATCH 1/8] chore(deps): update core.git dependency - Update resolved-ref from 36be72f to 8995bd3 --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index bce32611..8a338a9c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -90,7 +90,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: "36be72f1b7bd22236eb0cdf97e5f2545c7a47d34" + resolved-ref: "8995bd33bcd3888675a6b18e11f3e8dc873261be" url: "https://github.com/flutter-news-app-full-source-code/core.git" source: git version: "0.0.0" From 2c84b51d90603caa286f23792032305898c1ce0f Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:47:29 +0100 Subject: [PATCH 2/8] feat(localization): add translations for banner ad shape selection - Added new translations for banner ad shape selection in app_ar.arb and app_en.arb - Removed unused translations for inArticleAdSlotTypeBelowMainArticleImage - Updated translations for inArticleAdSlotTypeAboveArticleContinueReadingButton --- lib/l10n/app_localizations.dart | 30 ++++++++++++++++++++++++------ lib/l10n/app_localizations_ar.dart | 17 +++++++++++++---- lib/l10n/app_localizations_en.dart | 17 +++++++++++++---- lib/l10n/arb/app_ar.arb | 20 ++++++++++++++++---- lib/l10n/arb/app_en.arb | 20 ++++++++++++++++---- 5 files changed, 82 insertions(+), 22 deletions(-) diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index af0210f1..2f0c891e 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -2084,12 +2084,6 @@ abstract class AppLocalizations { /// **'The unit ID for banner ads within articles.'** String get inArticleBannerAdIdDescription; - /// Localized name for InArticleAdSlotType.belowMainArticleImage - /// - /// In en, this message translates to: - /// **'Below the main image of the article'** - String get inArticleAdSlotTypeBelowMainArticleImage; - /// Localized name for InArticleAdSlotType.aboveArticleContinueReadingButton /// /// In en, this message translates to: @@ -2407,6 +2401,30 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Video'** String get videoAdType; + + /// Title for the Banner Ad Shape Selection section + /// + /// In en, this message translates to: + /// **'Banner Ad Shape'** + String get bannerAdShapeSelectionTitle; + + /// Description for the Banner Ad Shape Selection section + /// + /// In en, this message translates to: + /// **'Select the preferred visual shape for banner ads displayed in articles.'** + String get bannerAdShapeSelectionDescription; + + /// Label for the Square banner ad shape option + /// + /// In en, this message translates to: + /// **'Square'** + String get bannerAdShapeSquare; + + /// Label for the Rectangle banner ad shape option + /// + /// In en, this message translates to: + /// **'Rectangle'** + String get bannerAdShapeRectangle; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart index 78a5e35f..259333a3 100644 --- a/lib/l10n/app_localizations_ar.dart +++ b/lib/l10n/app_localizations_ar.dart @@ -1108,10 +1108,6 @@ class AppLocalizationsAr extends AppLocalizations { String get inArticleBannerAdIdDescription => 'معرف وحدة إعلانات البانر داخل المقالات.'; - @override - String get inArticleAdSlotTypeBelowMainArticleImage => - 'أسفل الصورة الرئيسية للمقال'; - @override String get inArticleAdSlotTypeAboveArticleContinueReadingButton => 'فوق زر \'متابعة القراءة\''; @@ -1287,4 +1283,17 @@ class AppLocalizationsAr extends AppLocalizations { @override String get videoAdType => 'فيديو'; + + @override + String get bannerAdShapeSelectionTitle => 'شكل إعلان البانر'; + + @override + String get bannerAdShapeSelectionDescription => + 'اختر الشكل المرئي المفضل لإعلانات البانر المعروضة في المقالات.'; + + @override + String get bannerAdShapeSquare => 'مربع'; + + @override + String get bannerAdShapeRectangle => 'مستطيل'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 630517ef..23b7fd98 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1107,10 +1107,6 @@ class AppLocalizationsEn extends AppLocalizations { String get inArticleBannerAdIdDescription => 'The unit ID for banner ads within articles.'; - @override - String get inArticleAdSlotTypeBelowMainArticleImage => - 'Below the main image of the article'; - @override String get inArticleAdSlotTypeAboveArticleContinueReadingButton => 'Above the \'Continue Reading\' button'; @@ -1289,4 +1285,17 @@ class AppLocalizationsEn extends AppLocalizations { @override String get videoAdType => 'Video'; + + @override + String get bannerAdShapeSelectionTitle => 'Banner Ad Shape'; + + @override + String get bannerAdShapeSelectionDescription => + 'Select the preferred visual shape for banner ads displayed in articles.'; + + @override + String get bannerAdShapeSquare => 'Square'; + + @override + String get bannerAdShapeRectangle => 'Rectangle'; } diff --git a/lib/l10n/arb/app_ar.arb b/lib/l10n/arb/app_ar.arb index a3d015c6..31e4beca 100644 --- a/lib/l10n/arb/app_ar.arb +++ b/lib/l10n/arb/app_ar.arb @@ -1386,10 +1386,6 @@ "@inArticleBannerAdIdDescription": { "description": "وصف حقل إدخال معرف إعلان البانر داخل المقال" }, - "inArticleAdSlotTypeBelowMainArticleImage": "أسفل الصورة الرئيسية للمقال", - "@inArticleAdSlotTypeBelowMainArticleImage": { - "description": "الاسم المترجم لـ InArticleAdSlotType.belowMainArticleImage" - }, "inArticleAdSlotTypeAboveArticleContinueReadingButton": "فوق زر 'متابعة القراءة'", "@inArticleAdSlotTypeAboveArticleContinueReadingButton": { "description": "الاسم المترجم لـ InArticleAdSlotType.aboveArticleContinueReadingButton" @@ -1613,5 +1609,21 @@ "videoAdType": "فيديو", "@videoAdType": { "description": "تسمية نوع إعلان الفيديو." + }, + "bannerAdShapeSelectionTitle": "شكل إعلان البانر", + "@bannerAdShapeSelectionTitle": { + "description": "Title for the Banner Ad Shape Selection section" + }, + "bannerAdShapeSelectionDescription": "اختر الشكل المرئي المفضل لإعلانات البانر المعروضة في المقالات.", + "@bannerAdShapeSelectionDescription": { + "description": "Description for the Banner Ad Shape Selection section" + }, + "bannerAdShapeSquare": "مربع", + "@bannerAdShapeSquare": { + "description": "Label for the Square banner ad shape option" + }, + "bannerAdShapeRectangle": "مستطيل", + "@bannerAdShapeRectangle": { + "description": "Label for the Rectangle banner ad shape option" } } \ No newline at end of file diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 4fed025a..b90825fe 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -1382,10 +1382,6 @@ "@inArticleBannerAdIdDescription": { "description": "Description for the In-Article Banner Ad ID input field" }, - "inArticleAdSlotTypeBelowMainArticleImage": "Below the main image of the article", - "@inArticleAdSlotTypeBelowMainArticleImage": { - "description": "Localized name for InArticleAdSlotType.belowMainArticleImage" - }, "inArticleAdSlotTypeAboveArticleContinueReadingButton": "Above the 'Continue Reading' button", "@inArticleAdSlotTypeAboveArticleContinueReadingButton": { "description": "Localized name for InArticleAdSlotType.aboveArticleContinueReadingButton" @@ -1609,5 +1605,21 @@ "videoAdType": "Video", "@videoAdType": { "description": "Label for Video Ad Type." + }, + "bannerAdShapeSelectionTitle": "Banner Ad Shape", + "@bannerAdShapeSelectionTitle": { + "description": "Title for the Banner Ad Shape Selection section" + }, + "bannerAdShapeSelectionDescription": "Select the preferred visual shape for banner ads displayed in articles.", + "@bannerAdShapeSelectionDescription": { + "description": "Description for the Banner Ad Shape Selection section" + }, + "bannerAdShapeSquare": "Square", + "@bannerAdShapeSquare": { + "description": "Label for the Square banner ad shape option" + }, + "bannerAdShapeRectangle": "Rectangle", + "@bannerAdShapeRectangle": { + "description": "Label for the Rectangle banner ad shape option" } } \ No newline at end of file From 1c53eb198d660b3eabfcc394047df6bdbf442380 Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:49:18 +0100 Subject: [PATCH 3/8] refactor: Remove belowMainArticleImage case from InArticleAdSlotType extension - Remove unused InArticleAdSlotType.belowMainArticleImage case - Update l10n function to reflect the removal of the case --- lib/shared/extensions/in_article_ad_slot_type_l10n.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/shared/extensions/in_article_ad_slot_type_l10n.dart b/lib/shared/extensions/in_article_ad_slot_type_l10n.dart index 424892be..9729a26b 100644 --- a/lib/shared/extensions/in_article_ad_slot_type_l10n.dart +++ b/lib/shared/extensions/in_article_ad_slot_type_l10n.dart @@ -10,8 +10,6 @@ extension InArticleAdSlotTypeL10n on InArticleAdSlotType { String l10n(BuildContext context) { final l10n = context.l10n; switch (this) { - case InArticleAdSlotType.belowMainArticleImage: - return l10n.inArticleAdSlotTypeBelowMainArticleImage; case InArticleAdSlotType.aboveArticleContinueReadingButton: return l10n.inArticleAdSlotTypeAboveArticleContinueReadingButton; case InArticleAdSlotType.belowArticleContinueReadingButton: From 53f023167a7e2ad6d772846be95fbd523334c86a Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:49:47 +0100 Subject: [PATCH 4/8] feat(app_configuration): exclude demo ad platform from dashboard selection - Modified the ad platform configuration form to filter out the demo ad platform - Ensures that only non-demo ad platforms are displayed in the dashboard selection --- .../widgets/ad_platform_config_form.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/app_configuration/widgets/ad_platform_config_form.dart b/lib/app_configuration/widgets/ad_platform_config_form.dart index 2f60ff20..c2d65aa9 100644 --- a/lib/app_configuration/widgets/ad_platform_config_form.dart +++ b/lib/app_configuration/widgets/ad_platform_config_form.dart @@ -245,10 +245,16 @@ class _AdPlatformConfigFormState extends State { ), ), segments: AdPlatformType.values + .where( + (type) => + type != + AdPlatformType + .demo, // Ignore demo ad platform for dashboard + ) .map( - (platform) => ButtonSegment( - value: platform, - label: Text(platform.l10n(context)), + (type) => ButtonSegment( + value: type, + label: Text(type.l10n(context)), ), ) .toList(), From baaac16b366b2731f127cb642cfa51209073a99b Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:50:38 +0100 Subject: [PATCH 5/8] refactor(app_configuration): update article ad settings form - Replace AdType with BannerAdShape for in-article ad type selection - Update localization keys to reflect new banner ad shape selection - Remove unnecessary comments and adjust padding for better readability - Simplify segmented button configuration for banner ad shape --- .../widgets/article_ad_settings_form.dart | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/app_configuration/widgets/article_ad_settings_form.dart b/lib/app_configuration/widgets/article_ad_settings_form.dart index cb7816f3..828f6be9 100644 --- a/lib/app_configuration/widgets/article_ad_settings_form.dart +++ b/lib/app_configuration/widgets/article_ad_settings_form.dart @@ -1,7 +1,7 @@ import 'package:core/core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; -import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/ad_type_l10n.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/banner_ad_shape_l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/in_article_ad_slot_type_l10n.dart'; import 'package:ui_kit/ui_kit.dart'; @@ -64,51 +64,47 @@ class _ArticleAdSettingsFormState extends State ), const SizedBox(height: AppSpacing.lg), ExpansionTile( - title: Text(l10n.defaultInArticleAdTypeSelectionTitle), + title: Text(l10n.bannerAdShapeSelectionTitle), childrenPadding: const EdgeInsetsDirectional.only( - start: AppSpacing.lg, // Adjusted padding for hierarchy + start: AppSpacing.lg, top: AppSpacing.md, bottom: AppSpacing.md, ), - expandedCrossAxisAlignment: - CrossAxisAlignment.start, // Align content to start + expandedCrossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - l10n.defaultInArticleAdTypeSelectionDescription, + l10n.bannerAdShapeSelectionDescription, style: Theme.of(context).textTheme.bodySmall?.copyWith( color: Theme.of( context, ).colorScheme.onSurface.withOpacity(0.7), ), - textAlign: TextAlign.start, // Ensure text aligns to start + textAlign: TextAlign.start, ), const SizedBox(height: AppSpacing.lg), Align( alignment: AlignmentDirectional.centerStart, - child: SegmentedButton( + child: SegmentedButton( style: SegmentedButton.styleFrom( shape: const RoundedRectangleBorder( borderRadius: BorderRadius.zero, ), ), - segments: AdType.values - .where( - (type) => type == AdType.native || type == AdType.banner, - ) + segments: BannerAdShape.values .map( - (type) => ButtonSegment( + (type) => ButtonSegment( value: type, label: Text(type.l10n(context)), ), ) .toList(), - selected: {articleAdConfig.defaultInArticleAdType}, + selected: {articleAdConfig.bannerAdShape}, onSelectionChanged: (newSelection) { widget.onConfigChanged( widget.remoteConfig.copyWith( adConfig: adConfig.copyWith( articleAdConfiguration: articleAdConfig.copyWith( - defaultInArticleAdType: newSelection.first, + bannerAdShape: newSelection.first, ), ), ), @@ -122,12 +118,11 @@ class _ArticleAdSettingsFormState extends State ExpansionTile( title: Text(l10n.inArticleAdSlotPlacementsTitle), childrenPadding: const EdgeInsetsDirectional.only( - start: AppSpacing.lg, // Adjusted padding for hierarchy + start: AppSpacing.lg, top: AppSpacing.md, bottom: AppSpacing.md, ), - expandedCrossAxisAlignment: - CrossAxisAlignment.start, // Align content to start + expandedCrossAxisAlignment: CrossAxisAlignment.start, children: [ Text( l10n.inArticleAdSlotPlacementsDescription, @@ -136,7 +131,7 @@ class _ArticleAdSettingsFormState extends State context, ).colorScheme.onSurface.withOpacity(0.7), ), - textAlign: TextAlign.start, // Ensure text aligns to start + textAlign: TextAlign.start, ), const SizedBox(height: AppSpacing.lg), ...articleAdConfig.inArticleAdSlotConfigurations.map( From c452aae6807b114aa58ae896cd8c1f1c2df38d21 Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:50:57 +0100 Subject: [PATCH 6/8] refactor(ad_platform_type_l10n): add unimplemented error for demo platform type - Throw UnimplementedError when AdPlatformType.demo is used - This change clarifies that demo platform type is not intended for dashboard usage - Emphasizes that demo platform type is for mobile client and demo environment specific use cases --- lib/shared/extensions/ad_platform_type_l10n.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/shared/extensions/ad_platform_type_l10n.dart b/lib/shared/extensions/ad_platform_type_l10n.dart index 88744066..b7971179 100644 --- a/lib/shared/extensions/ad_platform_type_l10n.dart +++ b/lib/shared/extensions/ad_platform_type_l10n.dart @@ -12,6 +12,10 @@ extension AdPlatformTypeL10n on AdPlatformType { return l10n.adPlatformTypeAdmob; case AdPlatformType.local: return l10n.adPlatformTypeLocal; + case AdPlatformType.demo: + throw UnimplementedError( + 'Demo ad platform type is not intended for dashboard usage, rather for mobile client, demo env specific usecase.', + ); } } } From bbf3765edcb89c405b7c0723c6da6d1628e31533 Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 11:51:11 +0100 Subject: [PATCH 7/8] feat(l10n): add extension for localized banner ad shape names - Create new extension on BannerAdShape to provide localized string representations - Add l10n method to return localized name based on context and shape type - Implement switch case for different banner ad shapes (square and rectangle) --- .../extensions/banner_ad_shape_l10n.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/shared/extensions/banner_ad_shape_l10n.dart diff --git a/lib/shared/extensions/banner_ad_shape_l10n.dart b/lib/shared/extensions/banner_ad_shape_l10n.dart new file mode 100644 index 00000000..12b2446c --- /dev/null +++ b/lib/shared/extensions/banner_ad_shape_l10n.dart @@ -0,0 +1,19 @@ +import 'package:core/core.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; + +/// {@template banner_ad_shape_l10n} +/// Extension on [BannerAdShape] to provide localized string representations. +/// {@endtemplate} +extension BannerAdShapeL10n on BannerAdShape { + /// Returns the localized name for a [BannerAdShape]. + String l10n(BuildContext context) { + final l10n = context.l10n; + switch (this) { + case BannerAdShape.square: + return l10n.bannerAdShapeSquare; + case BannerAdShape.rectangle: + return l10n.bannerAdShapeRectangle; + } + } +} From 75a77b1e358db3553bd4362bf57a6dd63ff47ace Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 8 Sep 2025 12:18:18 +0100 Subject: [PATCH 8/8] chore(deps): update core.git dependency - Update resolved-ref from 8995bd3 to dd37d11 --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index 8a338a9c..1eb68cd4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -90,7 +90,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: "8995bd33bcd3888675a6b18e11f3e8dc873261be" + resolved-ref: dd37d11352124113978ebeda3b509d932db61cf5 url: "https://github.com/flutter-news-app-full-source-code/core.git" source: git version: "0.0.0"