Skip to content

Commit 9cf898a

Browse files
authored
Merge pull request #10 from headlines-toolkit/refactor_app_ui_enhancements
Refactor app UI enhancements
2 parents aaef5eb + ff903f7 commit 9cf898a

File tree

9 files changed

+636
-572
lines changed

9 files changed

+636
-572
lines changed

lib/app_configuration/view/app_configuration_page.dart

Lines changed: 276 additions & 272 deletions
Large diffs are not rendered by default.

lib/content_management/view/content_management_page.dart

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import 'package:ht_dashboard/content_management/view/categories_page.dart';
33
import 'package:ht_dashboard/content_management/view/headlines_page.dart';
44
import 'package:ht_dashboard/content_management/view/sources_page.dart';
55
import 'package:ht_dashboard/l10n/l10n.dart';
6+
import 'package:ht_dashboard/shared/constants/app_spacing.dart';
7+
import 'package:ht_dashboard/shared/theme/app_theme.dart';
68

79
/// {@template content_management_page}
810
/// A page for Content Management with tabbed navigation for sub-sections.
@@ -37,13 +39,36 @@ class _ContentManagementPageState extends State<ContentManagementPage>
3739
return Scaffold(
3840
appBar: AppBar(
3941
title: Text(l10n.contentManagement),
40-
bottom: TabBar(
41-
controller: _tabController,
42-
tabs: [
43-
Tab(text: l10n.headlines),
44-
Tab(text: l10n.categories),
45-
Tab(text: l10n.sources),
46-
],
42+
bottom: PreferredSize(
43+
preferredSize: Size.fromHeight(kTextTabBarHeight + AppSpacing.lg),
44+
child: Column(
45+
crossAxisAlignment: CrossAxisAlignment.start,
46+
children: [
47+
Padding(
48+
padding: const EdgeInsets.only(
49+
left: AppSpacing.lg,
50+
right: AppSpacing.lg,
51+
bottom: AppSpacing.lg,
52+
),
53+
child: Text(
54+
l10n.contentManagementPageDescription,
55+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
56+
color: Theme.of(context).colorScheme.onSurfaceVariant,
57+
),
58+
),
59+
),
60+
TabBar(
61+
controller: _tabController,
62+
tabAlignment: TabAlignment.start,
63+
isScrollable: true,
64+
tabs: [
65+
Tab(text: l10n.headlines),
66+
Tab(text: l10n.categories),
67+
Tab(text: l10n.sources),
68+
],
69+
),
70+
],
71+
),
4772
),
4873
),
4974
body: TabBarView(

lib/l10n/app_localizations.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ abstract class AppLocalizations {
212212
/// **'Content Management'**
213213
String get contentManagement;
214214

215+
/// Description for the Content Management page
216+
///
217+
/// In en, this message translates to:
218+
/// **'Manage news headlines, categories, and sources for the Dashboard.'**
219+
String get contentManagementPageDescription;
220+
215221
/// Label for the headlines subpage
216222
///
217223
/// In en, this message translates to:
@@ -236,6 +242,12 @@ abstract class AppLocalizations {
236242
/// **'App Configuration'**
237243
String get appConfiguration;
238244

245+
/// Description for the App Configuration page
246+
///
247+
/// In en, this message translates to:
248+
/// **'Configure global settings for the mobile application, including user content limits, ad display rules, in-app prompts, operational status, and force update parameters.'**
249+
String get appConfigurationPageDescription;
250+
239251
/// Label for the settings navigation item
240252
///
241253
/// In en, this message translates to:

lib/l10n/app_localizations_ar.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class AppLocalizationsAr extends AppLocalizations {
7373
@override
7474
String get contentManagement => 'إدارة المحتوى';
7575

76+
@override
77+
String get contentManagementPageDescription =>
78+
'إدارة العناوين الإخبارية والفئات والمصادر للوحة القيادة.';
79+
7680
@override
7781
String get headlines => 'العناوين الرئيسية';
7882

@@ -85,6 +89,10 @@ class AppLocalizationsAr extends AppLocalizations {
8589
@override
8690
String get appConfiguration => 'إعدادات التطبيق';
8791

92+
@override
93+
String get appConfigurationPageDescription =>
94+
'تكوين الإعدادات العامة للتطبيق المحمول، بما في ذلك حدود محتوى المستخدم، وقواعد عرض الإعلانات، والتنبيهات داخل التطبيق، وحالة التشغيل، ومعلمات التحديث الإجباري.';
95+
8896
@override
8997
String get settings => 'الإعدادات';
9098

lib/l10n/app_localizations_en.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ class AppLocalizationsEn extends AppLocalizations {
7272
@override
7373
String get contentManagement => 'Content Management';
7474

75+
@override
76+
String get contentManagementPageDescription =>
77+
'Manage news headlines, categories, and sources for the Dashboard.';
78+
7579
@override
7680
String get headlines => 'Headlines';
7781

@@ -84,6 +88,10 @@ class AppLocalizationsEn extends AppLocalizations {
8488
@override
8589
String get appConfiguration => 'App Configuration';
8690

91+
@override
92+
String get appConfigurationPageDescription =>
93+
'Configure global settings for the mobile application, including user content limits, ad display rules, in-app prompts, operational status, and force update parameters.';
94+
8795
@override
8896
String get settings => 'Settings';
8997

lib/l10n/arb/app_ar.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
"@contentManagement": {
8686
"description": "تسمية عنصر التنقل لإدارة المحتوى"
8787
},
88+
"contentManagementPageDescription": "إدارة العناوين الإخبارية والفئات والمصادر للوحة القيادة.",
89+
"@contentManagementPageDescription": {
90+
"description": "وصف صفحة إدارة المحتوى"
91+
},
8892
"headlines": "العناوين الرئيسية",
8993
"@headlines": {
9094
"description": "تسمية الصفحة الفرعية للعناوين الرئيسية"
@@ -101,6 +105,10 @@
101105
"@appConfiguration": {
102106
"description": "تسمية عنصر التنقل لإعدادات التطبيق"
103107
},
108+
"appConfigurationPageDescription": "تكوين الإعدادات العامة للتطبيق المحمول، بما في ذلك حدود محتوى المستخدم، وقواعد عرض الإعلانات، والتنبيهات داخل التطبيق، وحالة التشغيل، ومعلمات التحديث الإجباري.",
109+
"@appConfigurationPageDescription": {
110+
"description": "وصف صفحة إعدادات التطبيق"
111+
},
104112
"settings": "الإعدادات",
105113
"@settings": {
106114
"description": "تسمية عنصر التنقل للإعدادات"

lib/l10n/arb/app_en.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
"@contentManagement": {
8686
"description": "Label for the content management navigation item"
8787
},
88+
"contentManagementPageDescription": "Manage news headlines, categories, and sources for the Dashboard.",
89+
"@contentManagementPageDescription": {
90+
"description": "Description for the Content Management page"
91+
},
8892
"headlines": "Headlines",
8993
"@headlines": {
9094
"description": "Label for the headlines subpage"
@@ -101,6 +105,10 @@
101105
"@appConfiguration": {
102106
"description": "Label for the app configuration navigation item"
103107
},
108+
"appConfigurationPageDescription": "Configure global settings for the mobile application, including user content limits, ad display rules, in-app prompts, operational status, and force update parameters.",
109+
"@appConfigurationPageDescription": {
110+
"description": "Description for the App Configuration page"
111+
},
104112
"settings": "Settings",
105113
"@settings": {
106114
"description": "Label for the settings navigation item"

lib/settings/bloc/settings_bloc.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
3939
await _userAppSettingsRepository.create(item: defaultSettings);
4040
emit(SettingsLoadSuccess(userAppSettings: defaultSettings));
4141
} on HtHttpException catch (e) {
42-
emit(SettingsLoadFailure(e.message, userAppSettings: state.userAppSettings));
42+
emit(
43+
SettingsLoadFailure(e.message, userAppSettings: state.userAppSettings),
44+
);
4345
} catch (e) {
44-
emit(SettingsLoadFailure('An unexpected error occurred: $e', userAppSettings: state.userAppSettings));
46+
emit(
47+
SettingsLoadFailure(
48+
'An unexpected error occurred: $e',
49+
userAppSettings: state.userAppSettings,
50+
),
51+
);
4552
}
4653
}
4754

@@ -57,9 +64,19 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
5764
);
5865
emit(SettingsUpdateSuccess(userAppSettings: result));
5966
} on HtHttpException catch (e) {
60-
emit(SettingsUpdateFailure(e.message, userAppSettings: state.userAppSettings));
67+
emit(
68+
SettingsUpdateFailure(
69+
e.message,
70+
userAppSettings: state.userAppSettings,
71+
),
72+
);
6173
} catch (e) {
62-
emit(SettingsUpdateFailure('An unexpected error occurred: $e', userAppSettings: state.userAppSettings));
74+
emit(
75+
SettingsUpdateFailure(
76+
'An unexpected error occurred: $e',
77+
userAppSettings: state.userAppSettings,
78+
),
79+
);
6380
}
6481
}
6582

0 commit comments

Comments
 (0)