Skip to content

Commit 9d582f7

Browse files
authored
Merge pull request #93 from flutter-news-app-full-source-code/refactor/local-ads-management-structure-enhancement-and-ui-overhaul
Refactor/local ads management structure enhancement and UI overhaul
2 parents 34138ab + bc4e7e2 commit 9d582f7

File tree

51 files changed

+2928
-1934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2928
-1934
lines changed

lib/app/view/app.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/content_manageme
1616
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/sources_filter/sources_filter_bloc.dart';
1717
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/topics_filter/topics_filter_bloc.dart';
1818
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart';
19+
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/filter_local_ads/filter_local_ads_bloc.dart';
20+
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart';
1921
import 'package:flutter_news_app_web_dashboard_full_source_code/overview/bloc/overview_bloc.dart';
2022
import 'package:flutter_news_app_web_dashboard_full_source_code/router/router.dart';
2123
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/services/pending_deletions_service.dart';
@@ -131,6 +133,9 @@ class App extends StatelessWidget {
131133
BlocProvider(
132134
create: (context) => SourcesFilterBloc(),
133135
),
136+
BlocProvider(
137+
create: (context) => FilterLocalAdsBloc(),
138+
),
134139
BlocProvider(
135140
create: (context) => ContentManagementBloc(
136141
headlinesRepository: context.read<DataRepository<Headline>>(),
@@ -142,6 +147,13 @@ class App extends StatelessWidget {
142147
pendingDeletionsService: context.read<PendingDeletionsService>(),
143148
),
144149
),
150+
BlocProvider(
151+
create: (context) => LocalAdsManagementBloc(
152+
localAdsRepository: context.read<DataRepository<LocalAd>>(),
153+
filterLocalAdsBloc: context.read<FilterLocalAdsBloc>(),
154+
pendingDeletionsService: context.read<PendingDeletionsService>(),
155+
),
156+
),
145157
BlocProvider(
146158
create: (context) => OverviewBloc(
147159
dashboardSummaryRepository: context

lib/app/view/app_shell.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,25 @@ class AppShell extends StatelessWidget {
5656
label: l10n.appConfiguration,
5757
),
5858
],
59-
leadingUnextendedNavRail: const Padding(
60-
padding: EdgeInsets.symmetric(vertical: AppSpacing.lg),
61-
child: Icon(Icons.newspaper_outlined),
59+
leadingUnextendedNavRail: Padding(
60+
padding: const EdgeInsets.symmetric(vertical: AppSpacing.lg),
61+
child: Icon(
62+
Icons.newspaper_outlined,
63+
color: theme.colorScheme.primary,
64+
),
6265
),
6366
leadingExtendedNavRail: Padding(
6467
padding: const EdgeInsets.all(AppSpacing.lg),
6568
child: Row(
6669
children: [
67-
const Icon(Icons.newspaper_outlined),
70+
Icon(
71+
Icons.newspaper_outlined,
72+
color: theme.colorScheme.primary,
73+
),
6874
const SizedBox(width: AppSpacing.md),
6975
Text(
7076
l10n.dashboardTitle,
71-
style: theme.textTheme.titleLarge?.copyWith(
72-
color: theme.colorScheme.primary,
73-
),
77+
style: theme.textTheme.titleLarge,
7478
),
7579
],
7680
),

lib/app_configuration/widgets/article_ad_settings_form.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class _ArticleAdSettingsFormState extends State<ArticleAdSettingsForm>
202202
return Column(
203203
children: [
204204
SwitchListTile(
205-
title: Text(l10n.enableInArticleAdsForRoleLabel(role.l10n(context))),
205+
title: Text(l10n.visibleToRoleLabel(role.l10n(context))),
206206
value: roleSlots != null,
207207
onChanged: (value) {
208208
final newVisibleTo =

lib/app_configuration/widgets/feed_decorator_form.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ class _FeedDecoratorFormState extends State<FeedDecoratorForm>
190190
controller: _itemsToDisplayController,
191191
),
192192
const SizedBox(height: AppSpacing.lg),
193-
// Replaced SegmentedButton with TabBar for role selection
194193
Align(
195194
alignment: AlignmentDirectional.centerStart,
196195
child: SizedBox(

lib/app_configuration/widgets/user_preference_limits_form.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ class _UserPreferenceLimitsFormState extends State<UserPreferenceLimitsForm>
149149
),
150150
),
151151
const SizedBox(height: AppSpacing.lg),
152-
// Replaced SegmentedButton with TabBar for role selection
153152
Align(
154153
alignment: AlignmentDirectional.centerStart,
155154
child: SizedBox(

lib/content_management/view/headlines_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class _HeadlinesPageState extends State<HeadlinesPage> {
176176
headingRowHeight: 56,
177177
dataRowHeight: 56,
178178
columnSpacing: AppSpacing.sm,
179-
horizontalMargin: AppSpacing.md,
179+
horizontalMargin: AppSpacing.sm,
180180
);
181181
},
182182
),

lib/content_management/view/sources_page.dart

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ class _SourcesPageState extends State<SourcesPage> {
126126
label: Text(l10n.sourceName),
127127
size: ColumnSize.L,
128128
),
129-
DataColumn2(
130-
label: Text(l10n.sourceType),
131-
size: ColumnSize.S,
132-
),
129+
if (!isMobile)
130+
DataColumn2(
131+
label: Text(l10n.sourceType),
132+
size: ColumnSize.S,
133+
),
133134
DataColumn2(
134135
label: Text(l10n.lastUpdated),
135136
size: ColumnSize.S,
@@ -173,8 +174,8 @@ class _SourcesPageState extends State<SourcesPage> {
173174
fit: FlexFit.tight,
174175
headingRowHeight: 56,
175176
dataRowHeight: 56,
176-
columnSpacing: AppSpacing.md,
177-
horizontalMargin: AppSpacing.md,
177+
columnSpacing: AppSpacing.sm,
178+
horizontalMargin: AppSpacing.sm,
178179
);
179180
},
180181
),
@@ -225,13 +226,14 @@ class _SourcesDataSource extends DataTableSource {
225226
overflow: TextOverflow.ellipsis,
226227
),
227228
),
228-
DataCell(
229-
Text(
230-
source.sourceType.localizedName(l10n),
231-
maxLines: 2,
232-
overflow: TextOverflow.ellipsis,
229+
if (!isMobile)
230+
DataCell(
231+
Text(
232+
source.sourceType.localizedName(l10n),
233+
maxLines: 2,
234+
overflow: TextOverflow.ellipsis,
235+
),
233236
),
234-
),
235237
DataCell(
236238
Text(
237239
DateFormat('dd-MM-yyyy').format(source.updatedAt.toLocal()),

lib/content_management/view/topics_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ class _TopicPageState extends State<TopicPage> {
165165
fit: FlexFit.tight,
166166
headingRowHeight: 56,
167167
dataRowHeight: 56,
168-
columnSpacing: AppSpacing.md,
169-
horizontalMargin: AppSpacing.md,
168+
columnSpacing: AppSpacing.sm,
169+
horizontalMargin: AppSpacing.sm,
170170
);
171171
},
172172
),

lib/l10n/app_localizations.dart

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,108 @@ abstract class AppLocalizations {
27252725
/// In en, this message translates to:
27262726
/// **'Close'**
27272727
String get closeButtonText;
2728+
2729+
/// Title for the filter dialog when filtering local ads.
2730+
///
2731+
/// In en, this message translates to:
2732+
/// **'Filter Local Ads'**
2733+
String get filterLocalAds;
2734+
2735+
/// Hint text for the ad title or URL search field.
2736+
///
2737+
/// In en, this message translates to:
2738+
/// **'Search by ad title or URL...'**
2739+
String get searchByAdTitleOrUrl;
2740+
2741+
/// Label for the ad type filter.
2742+
///
2743+
/// In en, this message translates to:
2744+
/// **'Ad Type'**
2745+
String get adType;
2746+
2747+
/// Headline for loading state of native ads.
2748+
///
2749+
/// In en, this message translates to:
2750+
/// **'Loading Native Ads'**
2751+
String get loadingNativeAds;
2752+
2753+
/// Message when no native ads are found.
2754+
///
2755+
/// In en, this message translates to:
2756+
/// **'No native ads found.'**
2757+
String get noNativeAdsFound;
2758+
2759+
/// Headline for loading state of banner ads.
2760+
///
2761+
/// In en, this message translates to:
2762+
/// **'Loading Banner Ads'**
2763+
String get loadingBannerAds;
2764+
2765+
/// Message when no banner ads are found.
2766+
///
2767+
/// In en, this message translates to:
2768+
/// **'No banner ads found.'**
2769+
String get noBannerAdsFound;
2770+
2771+
/// Column header for ad image URL.
2772+
///
2773+
/// In en, this message translates to:
2774+
/// **'Image URL'**
2775+
String get adImageUrl;
2776+
2777+
/// Headline for loading state of interstitial ads.
2778+
///
2779+
/// In en, this message translates to:
2780+
/// **'Loading Interstitial Ads'**
2781+
String get loadingInterstitialAds;
2782+
2783+
/// Message when no interstitial ads are found.
2784+
///
2785+
/// In en, this message translates to:
2786+
/// **'No interstitial ads found.'**
2787+
String get noInterstitialAdsFound;
2788+
2789+
/// Headline for loading state of video ads.
2790+
///
2791+
/// In en, this message translates to:
2792+
/// **'Loading Video Ads'**
2793+
String get loadingVideoAds;
2794+
2795+
/// Message when no video ads are found.
2796+
///
2797+
/// In en, this message translates to:
2798+
/// **'No video ads found.'**
2799+
String get noVideoAdsFound;
2800+
2801+
/// Column header for ad video URL.
2802+
///
2803+
/// In en, this message translates to:
2804+
/// **'Video URL'**
2805+
String get adVideoUrl;
2806+
2807+
/// Snackbar message displayed when an ad ID is successfully copied to the clipboard.
2808+
///
2809+
/// In en, this message translates to:
2810+
/// **'ID copied to clipboard'**
2811+
String get idCopied;
2812+
2813+
/// Tooltip for the copy ID action button.
2814+
///
2815+
/// In en, this message translates to:
2816+
/// **'Copy Ad ID'**
2817+
String get copyIdTooltip;
2818+
2819+
/// Title for the dialog asking to save an ad
2820+
///
2821+
/// In en, this message translates to:
2822+
/// **'Save Ad'**
2823+
String get saveAdTitle;
2824+
2825+
/// Message for the dialog asking to save an ad
2826+
///
2827+
/// In en, this message translates to:
2828+
/// **'Do you want to publish this ad or save it as a draft?'**
2829+
String get saveAdMessage;
27282830
}
27292831

27302832
class _AppLocalizationsDelegate

lib/l10n/app_localizations_ar.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,4 +1454,55 @@ class AppLocalizationsAr extends AppLocalizations {
14541454

14551455
@override
14561456
String get closeButtonText => 'إغلاق';
1457+
1458+
@override
1459+
String get filterLocalAds => 'تصفية الإعلانات المحلية';
1460+
1461+
@override
1462+
String get searchByAdTitleOrUrl => 'البحث بعنوان الإعلان أو الرابط...';
1463+
1464+
@override
1465+
String get adType => 'نوع الإعلان';
1466+
1467+
@override
1468+
String get loadingNativeAds => 'جاري تحميل الإعلانات الأصلية';
1469+
1470+
@override
1471+
String get noNativeAdsFound => 'لم يتم العثور على إعلانات أصلية.';
1472+
1473+
@override
1474+
String get loadingBannerAds => 'جاري تحميل إعلانات البانر';
1475+
1476+
@override
1477+
String get noBannerAdsFound => 'لم يتم العثور على إعلانات بانر.';
1478+
1479+
@override
1480+
String get adImageUrl => 'رابط الصورة';
1481+
1482+
@override
1483+
String get loadingInterstitialAds => 'جاري تحميل الإعلانات البينية';
1484+
1485+
@override
1486+
String get noInterstitialAdsFound => 'لم يتم العثور على إعلانات بينية.';
1487+
1488+
@override
1489+
String get loadingVideoAds => 'جاري تحميل إعلانات الفيديو';
1490+
1491+
@override
1492+
String get noVideoAdsFound => 'لم يتم العثور على إعلانات فيديو.';
1493+
1494+
@override
1495+
String get adVideoUrl => 'رابط الفيديو';
1496+
1497+
@override
1498+
String get idCopied => 'تم نسخ المعرف إلى الحافظة';
1499+
1500+
@override
1501+
String get copyIdTooltip => 'نسخ معرف الإعلان';
1502+
1503+
@override
1504+
String get saveAdTitle => 'حفظ الإعلان';
1505+
1506+
@override
1507+
String get saveAdMessage => 'هل تريد نشر هذا الإعلان أم حفظه كمسودة؟';
14571508
}

0 commit comments

Comments
 (0)