Skip to content

Commit 06dc69b

Browse files
committed
feat(app_configuration): improve localization and code structure
- Add localization for feed decorator types and user roles - Refactor feed decorator configuration display using FeedDecoratorType.values - Remove unnecessary conversion to list for feedDecoratorConfig entries
1 parent fb63cd3 commit 06dc69b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/app_configuration/view/app_configuration_page.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
44
import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/bloc/app_configuration_bloc.dart';
55
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart';
66
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
7+
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/app_user_role_l10n.dart';
8+
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/feed_decorator_type_l10n.dart';
79
import 'package:ui_kit/ui_kit.dart';
810

911
/// {@template app_configuration_page}
@@ -366,8 +368,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
366368
RemoteConfig remoteConfig,
367369
) {
368370
final l10n = AppLocalizationsX(context).l10n;
369-
final decoratorConfigs = remoteConfig.feedDecoratorConfig.entries.toList();
370-
371+
371372
return Column(
372373
crossAxisAlignment: CrossAxisAlignment.start,
373374
children: [
@@ -378,17 +379,17 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
378379
),
379380
),
380381
const SizedBox(height: AppSpacing.lg),
381-
for (final decoratorEntry in decoratorConfigs)
382+
for (final decoratorType in FeedDecoratorType.values)
382383
ExpansionTile(
383384
title: Text(
384-
decoratorEntry.key.name.toUpperCase(),
385+
decoratorType.l10n(context),
385386
),
386387
childrenPadding: const EdgeInsets.symmetric(
387388
horizontal: AppSpacing.xxl,
388389
),
389390
children: [
390391
_FeedDecoratorForm(
391-
decoratorType: decoratorEntry.key,
392+
decoratorType: decoratorType,
392393
remoteConfig: remoteConfig,
393394
onConfigChanged: (newConfig) {
394395
context.read<AppConfigurationBloc>().add(
@@ -1068,7 +1069,7 @@ class _FeedDecoratorFormState extends State<_FeedDecoratorForm> {
10681069
return Column(
10691070
children: [
10701071
CheckboxListTile(
1071-
title: Text(role.name), // Will be localized later
1072+
title: Text(role.l10n(context)),
10721073
value: roleConfig != null,
10731074
onChanged: (value) {
10741075
final newVisibleTo =

0 commit comments

Comments
 (0)