@@ -20,8 +20,8 @@ class SettingsPage extends StatelessWidget {
20
20
Widget build (BuildContext context) {
21
21
return BlocProvider (
22
22
create: (context) => SettingsBloc (
23
- userAppSettingsRepository:
24
- context .read <HtDataRepository <UserAppSettings >>(),
23
+ userAppSettingsRepository: context
24
+ .read <HtDataRepository <UserAppSettings >>(),
25
25
)..add (SettingsLoaded (userId: context.read <AppBloc >().state.user? .id)),
26
26
child: const _SettingsView (),
27
27
);
@@ -40,7 +40,8 @@ class _SettingsView extends StatelessWidget {
40
40
),
41
41
body: BlocConsumer <SettingsBloc , SettingsState >(
42
42
listenWhen: (previous, current) =>
43
- current is SettingsUpdateSuccess || current is SettingsUpdateFailure ,
43
+ current is SettingsUpdateSuccess ||
44
+ current is SettingsUpdateFailure ,
44
45
listener: (context, state) {
45
46
if (state is SettingsUpdateSuccess ) {
46
47
ScaffoldMessenger .of (context)
@@ -52,23 +53,23 @@ class _SettingsView extends StatelessWidget {
52
53
);
53
54
// Optionally, trigger AppBloc to reload settings if it caches them
54
55
context.read <AppBloc >().add (
55
- AppUserChanged (
56
- context.read <AppBloc >().state.user? .copyWith (
57
- // This is a simplified way to trigger AppBloc update.
58
- // A more robust solution might involve AppBloc listening
59
- // to SettingsBloc directly or a dedicated event.
60
- // For now, we'll rely on the AppBloc's authStateChanges
61
- // listener to eventually pick up the change if the
62
- // repository emits it, or a manual refresh.
63
- // For immediate UI update, we might need to pass the
64
- // updated settings to AppBloc.
65
- // For this task, we'll assume AppBloc will react
66
- // to the repository change or a full app restart.
67
- // A better approach would be to have AppBloc listen
68
- // to UserAppSettings changes from its repository.
69
- ),
70
- ),
71
- );
56
+ AppUserChanged (
57
+ context.read <AppBloc >().state.user? .copyWith (
58
+ // This is a simplified way to trigger AppBloc update.
59
+ // A more robust solution might involve AppBloc listening
60
+ // to SettingsBloc directly or a dedicated event.
61
+ // For now, we'll rely on the AppBloc's authStateChanges
62
+ // listener to eventually pick up the change if the
63
+ // repository emits it, or a manual refresh.
64
+ // For immediate UI update, we might need to pass the
65
+ // updated settings to AppBloc.
66
+ // For this task, we'll assume AppBloc will react
67
+ // to the repository change or a full app restart.
68
+ // A better approach would be to have AppBloc listen
69
+ // to UserAppSettings changes from its repository.
70
+ ),
71
+ ),
72
+ );
72
73
} else if (state is SettingsUpdateFailure ) {
73
74
ScaffoldMessenger .of (context)
74
75
..hideCurrentSnackBar ()
@@ -93,10 +94,10 @@ class _SettingsView extends StatelessWidget {
93
94
message: l10n.failedToLoadSettingsMessage (state.errorMessage),
94
95
onRetry: () {
95
96
context.read <SettingsBloc >().add (
96
- SettingsLoaded (
97
- userId: context.read <AppBloc >().state.user? .id,
98
- ),
99
- );
97
+ SettingsLoaded (
98
+ userId: context.read <AppBloc >().state.user? .id,
99
+ ),
100
+ );
100
101
},
101
102
);
102
103
} else if (state is SettingsLoadSuccess ) {
@@ -132,9 +133,9 @@ class _SettingsView extends StatelessWidget {
132
133
value: userAppSettings.displaySettings.baseTheme,
133
134
onChanged: (value) {
134
135
if (value != null ) {
135
- context
136
- . read < SettingsBloc >()
137
- . add ( SettingsBaseThemeChanged (value) );
136
+ context. read < SettingsBloc >(). add (
137
+ SettingsBaseThemeChanged (value),
138
+ );
138
139
}
139
140
},
140
141
items: AppBaseTheme .values
@@ -158,9 +159,9 @@ class _SettingsView extends StatelessWidget {
158
159
value: userAppSettings.displaySettings.accentTheme,
159
160
onChanged: (value) {
160
161
if (value != null ) {
161
- context
162
- . read < SettingsBloc >()
163
- . add ( SettingsAccentThemeChanged (value) );
162
+ context. read < SettingsBloc >(). add (
163
+ SettingsAccentThemeChanged (value),
164
+ );
164
165
}
165
166
},
166
167
items: AppAccentTheme .values
@@ -184,9 +185,9 @@ class _SettingsView extends StatelessWidget {
184
185
value: userAppSettings.displaySettings.fontFamily,
185
186
onChanged: (value) {
186
187
if (value != null ) {
187
- context
188
- . read < SettingsBloc >()
189
- . add ( SettingsFontFamilyChanged (value) );
188
+ context. read < SettingsBloc >(). add (
189
+ SettingsFontFamilyChanged (value),
190
+ );
190
191
}
191
192
},
192
193
items: _supportedFontFamilies
@@ -210,9 +211,9 @@ class _SettingsView extends StatelessWidget {
210
211
value: userAppSettings.displaySettings.textScaleFactor,
211
212
onChanged: (value) {
212
213
if (value != null ) {
213
- context
214
- . read < SettingsBloc >()
215
- . add ( SettingsTextScaleFactorChanged (value) );
214
+ context. read < SettingsBloc >(). add (
215
+ SettingsTextScaleFactorChanged (value),
216
+ );
216
217
}
217
218
},
218
219
items: AppTextScaleFactor .values
@@ -236,9 +237,9 @@ class _SettingsView extends StatelessWidget {
236
237
value: userAppSettings.displaySettings.fontWeight,
237
238
onChanged: (value) {
238
239
if (value != null ) {
239
- context
240
- . read < SettingsBloc >()
241
- . add ( SettingsFontWeightChanged (value) );
240
+ context. read < SettingsBloc >(). add (
241
+ SettingsFontWeightChanged (value),
242
+ );
242
243
}
243
244
},
244
245
items: AppFontWeight .values
@@ -262,9 +263,9 @@ class _SettingsView extends StatelessWidget {
262
263
value: userAppSettings.language,
263
264
onChanged: (value) {
264
265
if (value != null ) {
265
- context
266
- . read < SettingsBloc >()
267
- . add ( SettingsLanguageChanged (value) );
266
+ context. read < SettingsBloc >(). add (
267
+ SettingsLanguageChanged (value),
268
+ );
268
269
}
269
270
},
270
271
items: _supportedLanguages
@@ -299,8 +300,8 @@ class _SettingsView extends StatelessWidget {
299
300
Text (
300
301
description,
301
302
style: Theme .of (context).textTheme.bodySmall? .copyWith (
302
- color: Theme .of (context).colorScheme.onSurfaceVariant,
303
- ),
303
+ color: Theme .of (context).colorScheme.onSurfaceVariant,
304
+ ),
304
305
),
305
306
const SizedBox (height: AppSpacing .sm),
306
307
Align (
0 commit comments