@@ -3,7 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
3
3
import 'package:ht_main/l10n/l10n.dart' ;
4
4
import 'package:ht_main/settings/bloc/settings_bloc.dart' ;
5
5
import 'package:ht_main/shared/constants/constants.dart' ;
6
- import 'package:ht_preferences_client/ht_preferences_client.dart' ;
6
+ import 'package:ht_shared/ht_shared.dart'
7
+ show AppTextScaleFactor; // Import new enum
7
8
8
9
/// {@template article_settings_page}
9
10
/// A page for configuring article display settings.
@@ -12,15 +13,21 @@ class ArticleSettingsPage extends StatelessWidget {
12
13
/// {@macro article_settings_page}
13
14
const ArticleSettingsPage ({super .key});
14
15
15
- // Helper to map FontSize enum to user-friendly strings
16
- String _fontSizeToString (FontSize size, AppLocalizations l10n) {
17
- switch (size) {
18
- case FontSize .small:
16
+ // Helper to map AppTextScaleFactor enum to user-friendly strings
17
+ String _textScaleFactorToString (
18
+ AppTextScaleFactor factor,
19
+ AppLocalizations l10n,
20
+ ) {
21
+ switch (factor) {
22
+ case AppTextScaleFactor .small:
19
23
return l10n.settingsAppearanceFontSizeSmall; // Reuse key
20
- case FontSize .large:
21
- return l10n.settingsAppearanceFontSizeLarge; // Reuse key
22
- case FontSize .medium:
24
+ case AppTextScaleFactor .medium:
23
25
return l10n.settingsAppearanceFontSizeMedium; // Reuse key
26
+ case AppTextScaleFactor .large:
27
+ return l10n.settingsAppearanceFontSizeLarge; // Reuse key
28
+ case AppTextScaleFactor .extraLarge:
29
+ return l10n
30
+ .settingsAppearanceFontSizeExtraLarge; // Add l10n key if needed
24
31
}
25
32
}
26
33
@@ -48,15 +55,21 @@ class ArticleSettingsPage extends StatelessWidget {
48
55
padding: const EdgeInsets .all (AppSpacing .lg),
49
56
children: [
50
57
// --- Article Font Size ---
51
- _buildDropdownSetting <FontSize >(
58
+ _buildDropdownSetting <AppTextScaleFactor >(
52
59
context: context,
53
60
title: l10n.settingsArticleFontSizeLabel, // Add l10n key
54
- currentValue: state.articleSettings.articleFontSize,
55
- items: FontSize .values,
56
- itemToString: (size) => _fontSizeToString (size, l10n),
61
+ currentValue:
62
+ state
63
+ .userAppSettings
64
+ .displaySettings
65
+ .textScaleFactor, // Use new model field
66
+ items: AppTextScaleFactor .values,
67
+ itemToString: (factor) => _textScaleFactorToString (factor, l10n),
57
68
onChanged: (value) {
58
69
if (value != null ) {
59
- settingsBloc.add (SettingsArticleFontSizeChanged (value));
70
+ settingsBloc.add (
71
+ SettingsAppFontSizeChanged (value),
72
+ ); // Use new event
60
73
}
61
74
},
62
75
),
0 commit comments