1
+ import 'package:core/core.dart' ;
2
+ import 'package:data_repository/data_repository.dart' ;
1
3
import 'package:flutter/material.dart' ;
2
4
import 'package:flutter_bloc/flutter_bloc.dart' ;
3
- import 'package:ht_dashboard/app/bloc/app_bloc.dart' ;
4
- import 'package:ht_dashboard/l10n/app_localizations.dart' ;
5
- import 'package:ht_dashboard/l10n/l10n.dart' ;
6
- import 'package:ht_dashboard/settings/bloc/settings_bloc.dart' ;
7
- import 'package:ht_data_repository/ht_data_repository.dart' ;
8
- import 'package:ht_shared/ht_shared.dart' ;
9
- import 'package:ht_ui_kit/ht_ui_kit.dart' ;
5
+ import 'package:flutter_news_app_web_dashboard_full_source_code/app/bloc/app_bloc.dart' ;
6
+ import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart' ;
7
+ import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart' ;
8
+ import 'package:flutter_news_app_web_dashboard_full_source_code/settings/bloc/settings_bloc.dart' ;
9
+ import 'package:ui_kit/ui_kit.dart' ;
10
10
11
11
/// {@template settings_page}
12
12
/// A page for user settings, allowing customization of theme and language.
@@ -20,7 +20,7 @@ class SettingsPage extends StatelessWidget {
20
20
return BlocProvider (
21
21
create: (context) => SettingsBloc (
22
22
userAppSettingsRepository: context
23
- .read <HtDataRepository <UserAppSettings >>(),
23
+ .read <DataRepository <UserAppSettings >>(),
24
24
)..add (SettingsLoaded (userId: context.read <AppBloc >().state.user? .id)),
25
25
child: const _SettingsView (),
26
26
);
@@ -62,9 +62,7 @@ class _SettingsView extends StatelessWidget {
62
62
ScaffoldMessenger .of (context)
63
63
..hideCurrentSnackBar ()
64
64
..showSnackBar (
65
- SnackBar (
66
- content: Text (l10n.settingsSavedSuccessfully),
67
- ),
65
+ SnackBar (content: Text (l10n.settingsSavedSuccessfully)),
68
66
);
69
67
// Trigger AppBloc to reload settings for immediate UI update
70
68
if (state.userAppSettings != null ) {
@@ -77,9 +75,7 @@ class _SettingsView extends StatelessWidget {
77
75
..hideCurrentSnackBar ()
78
76
..showSnackBar (
79
77
SnackBar (
80
- content: Text (
81
- state.exception.toFriendlyMessage (context),
82
- ),
78
+ content: Text (state.exception.toFriendlyMessage (context)),
83
79
),
84
80
);
85
81
}
@@ -89,9 +85,7 @@ class _SettingsView extends StatelessWidget {
89
85
state is ! SettingsLoadInProgress ) {
90
86
// If settings are null and not loading, try to load them
91
87
context.read <SettingsBloc >().add (
92
- SettingsLoaded (
93
- userId: context.read <AppBloc >().state.user? .id,
94
- ),
88
+ SettingsLoaded (userId: context.read <AppBloc >().state.user? .id),
95
89
);
96
90
}
97
91
@@ -138,9 +132,7 @@ class _SettingsView extends StatelessWidget {
138
132
onChanged: (value) {
139
133
if (value != null ) {
140
134
context.read <SettingsBloc >().add (
141
- SettingsBaseThemeChanged (
142
- value,
143
- ),
135
+ SettingsBaseThemeChanged (value),
144
136
);
145
137
}
146
138
},
@@ -149,10 +141,7 @@ class _SettingsView extends StatelessWidget {
149
141
(theme) => DropdownMenuItem (
150
142
value: theme,
151
143
child: Text (
152
- _getAppBaseThemeName (
153
- theme,
154
- l10n,
155
- ),
144
+ _getAppBaseThemeName (theme, l10n),
156
145
),
157
146
),
158
147
)
@@ -169,9 +158,7 @@ class _SettingsView extends StatelessWidget {
169
158
onChanged: (value) {
170
159
if (value != null ) {
171
160
context.read <SettingsBloc >().add (
172
- SettingsAccentThemeChanged (
173
- value,
174
- ),
161
+ SettingsAccentThemeChanged (value),
175
162
);
176
163
}
177
164
},
@@ -180,10 +167,7 @@ class _SettingsView extends StatelessWidget {
180
167
(theme) => DropdownMenuItem (
181
168
value: theme,
182
169
child: Text (
183
- _getAppAccentThemeName (
184
- theme,
185
- l10n,
186
- ),
170
+ _getAppAccentThemeName (theme, l10n),
187
171
),
188
172
),
189
173
)
@@ -207,22 +191,15 @@ class _SettingsView extends StatelessWidget {
207
191
onChanged: (value) {
208
192
if (value != null ) {
209
193
context.read <SettingsBloc >().add (
210
- SettingsFontFamilyChanged (
211
- value,
212
- ),
194
+ SettingsFontFamilyChanged (value),
213
195
);
214
196
}
215
197
},
216
198
items: _supportedFontFamilies
217
199
.map (
218
200
(font) => DropdownMenuItem (
219
201
value: font,
220
- child: Text (
221
- _getFontFamilyName (
222
- font,
223
- l10n,
224
- ),
225
- ),
202
+ child: Text (_getFontFamilyName (font, l10n)),
226
203
),
227
204
)
228
205
.toList (),
@@ -239,9 +216,7 @@ class _SettingsView extends StatelessWidget {
239
216
onChanged: (value) {
240
217
if (value != null ) {
241
218
context.read <SettingsBloc >().add (
242
- SettingsTextScaleFactorChanged (
243
- value,
244
- ),
219
+ SettingsTextScaleFactorChanged (value),
245
220
);
246
221
}
247
222
},
@@ -250,10 +225,7 @@ class _SettingsView extends StatelessWidget {
250
225
(scale) => DropdownMenuItem (
251
226
value: scale,
252
227
child: Text (
253
- _getAppTextScaleFactorName (
254
- scale,
255
- l10n,
256
- ),
228
+ _getAppTextScaleFactorName (scale, l10n),
257
229
),
258
230
),
259
231
)
@@ -270,9 +242,7 @@ class _SettingsView extends StatelessWidget {
270
242
onChanged: (value) {
271
243
if (value != null ) {
272
244
context.read <SettingsBloc >().add (
273
- SettingsFontWeightChanged (
274
- value,
275
- ),
245
+ SettingsFontWeightChanged (value),
276
246
);
277
247
}
278
248
},
@@ -281,10 +251,7 @@ class _SettingsView extends StatelessWidget {
281
251
(weight) => DropdownMenuItem (
282
252
value: weight,
283
253
child: Text (
284
- _getAppFontWeightName (
285
- weight,
286
- l10n,
287
- ),
254
+ _getAppFontWeightName (weight, l10n),
288
255
),
289
256
),
290
257
)
@@ -338,10 +305,7 @@ class _SettingsView extends StatelessWidget {
338
305
child: Column (
339
306
crossAxisAlignment: CrossAxisAlignment .start,
340
307
children: [
341
- Text (
342
- title,
343
- style: Theme .of (context).textTheme.titleMedium,
344
- ),
308
+ Text (title, style: Theme .of (context).textTheme.titleMedium),
345
309
const SizedBox (height: AppSpacing .xs),
346
310
Text (
347
311
description,
@@ -467,10 +431,7 @@ class _LanguageSelectionList extends StatelessWidget {
467
431
style: Theme .of (context).textTheme.titleMedium,
468
432
),
469
433
trailing: isSelected
470
- ? Icon (
471
- Icons .check,
472
- color: Theme .of (context).colorScheme.primary,
473
- )
434
+ ? Icon (Icons .check, color: Theme .of (context).colorScheme.primary)
474
435
: null ,
475
436
onTap: () {
476
437
if (! isSelected) {
@@ -495,8 +456,5 @@ class _LanguageSelectionList extends StatelessWidget {
495
456
}
496
457
}
497
458
498
- static const List <AppLanguage > _supportedLanguages = [
499
- 'en' ,
500
- 'ar' ,
501
- ];
459
+ static const List <AppLanguage > _supportedLanguages = ['en' , 'ar' ];
502
460
}
0 commit comments