Skip to content

Commit 40cddb4

Browse files
committed
style: misc format
1 parent eef890b commit 40cddb4

File tree

13 files changed

+117
-106
lines changed

13 files changed

+117
-106
lines changed

lib/app/services/app_status_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ class AppStatusService with WidgetsBindingObserver {
9494
// When the app comes to the foreground, immediately trigger a check.
9595
// This is crucial for catching maintenance mode that was enabled
9696
// while the app was in the background.
97-
_context
98-
.read<AppBloc>()
99-
.add(const AppConfigFetchRequested(isBackgroundCheck: true));
97+
_context.read<AppBloc>().add(
98+
const AppConfigFetchRequested(isBackgroundCheck: true),
99+
);
100100
}
101101
}
102102

lib/app/view/app.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ class App extends StatelessWidget {
7878
BlocProvider(
7979
create: (context) => AppBloc(
8080
authenticationRepository: context.read<AuthRepository>(),
81-
userAppSettingsRepository:
82-
context.read<DataRepository<UserAppSettings>>(),
83-
appConfigRepository:
84-
context.read<DataRepository<RemoteConfig>>(),
81+
userAppSettingsRepository: context
82+
.read<DataRepository<UserAppSettings>>(),
83+
appConfigRepository: context.read<DataRepository<RemoteConfig>>(),
8584
userRepository: context.read<DataRepository<User>>(),
8685
environment: _environment,
8786
demoDataMigrationService: demoDataMigrationService,

lib/authentication/bloc/authentication_state.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ class AuthenticationState extends Equatable {
7171
user: user ?? this.user,
7272
email: email ?? this.email,
7373
exception: exception ?? this.exception,
74-
cooldownEndTime:
75-
clearCooldownEndTime ? null : cooldownEndTime ?? this.cooldownEndTime,
74+
cooldownEndTime: clearCooldownEndTime
75+
? null
76+
: cooldownEndTime ?? this.cooldownEndTime,
7677
);
7778
}
7879

lib/authentication/view/request_code_page.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
203203
void _submitForm() {
204204
if (_formKey.currentState!.validate()) {
205205
context.read<AuthenticationBloc>().add(
206-
AuthenticationRequestSignInCodeRequested(
207-
email: _emailController.text.trim(),
208-
),
209-
);
206+
AuthenticationRequestSignInCodeRequested(
207+
email: _emailController.text.trim(),
208+
),
209+
);
210210
}
211211
}
212212

@@ -247,13 +247,15 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
247247
}
248248
return null;
249249
},
250-
onFieldSubmitted:
251-
widget.isLoading || _cooldownSeconds > 0 ? null : (_) => _submitForm(),
250+
onFieldSubmitted: widget.isLoading || _cooldownSeconds > 0
251+
? null
252+
: (_) => _submitForm(),
252253
),
253254
const SizedBox(height: AppSpacing.lg),
254255
ElevatedButton(
255-
onPressed:
256-
widget.isLoading || _cooldownSeconds > 0 ? null : _submitForm,
256+
onPressed: widget.isLoading || _cooldownSeconds > 0
257+
? null
258+
: _submitForm,
257259
style: ElevatedButton.styleFrom(
258260
padding: const EdgeInsets.symmetric(vertical: AppSpacing.md),
259261
textStyle: textTheme.labelLarge,
@@ -268,12 +270,8 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
268270
),
269271
)
270272
: _cooldownSeconds > 0
271-
? Text(
272-
l10n.requestCodeResendButtonCooldown(
273-
_cooldownSeconds,
274-
),
275-
)
276-
: Text(l10n.requestCodeSendCodeButton),
273+
? Text(l10n.requestCodeResendButtonCooldown(_cooldownSeconds))
274+
: Text(l10n.requestCodeSendCodeButton),
277275
),
278276
],
279277
),

lib/entity_details/bloc/entity_details_bloc.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class EntityDetailsBloc extends Bloc<EntityDetailsEvent, EntityDetailsState> {
2121
required AccountBloc accountBloc,
2222
required AppBloc appBloc,
2323
required FeedDecoratorService feedDecoratorService,
24-
}) : _headlinesRepository = headlinesRepository,
25-
_topicRepository = topicRepository,
26-
_sourceRepository = sourceRepository,
27-
_accountBloc = accountBloc,
28-
_appBloc = appBloc,
29-
_feedDecoratorService = feedDecoratorService,
30-
super(const EntityDetailsState()) {
24+
}) : _headlinesRepository = headlinesRepository,
25+
_topicRepository = topicRepository,
26+
_sourceRepository = sourceRepository,
27+
_accountBloc = accountBloc,
28+
_appBloc = appBloc,
29+
_feedDecoratorService = feedDecoratorService,
30+
super(const EntityDetailsState()) {
3131
on<EntityDetailsLoadRequested>(_onEntityDetailsLoadRequested);
3232
on<EntityDetailsToggleFollowRequested>(
3333
_onEntityDetailsToggleFollowRequested,

lib/entity_details/view/entity_details_page.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,17 @@ class EntityDetailsPage extends StatelessWidget {
5151
topicsRepository: topicsRepository,
5252
sourcesRepository: sourcesRepository,
5353
);
54-
final entityDetailsBloc = EntityDetailsBloc(
55-
headlinesRepository: context.read<DataRepository<Headline>>(),
56-
topicRepository: topicsRepository,
57-
sourceRepository: sourcesRepository,
58-
accountBloc: context.read<AccountBloc>(),
59-
appBloc: context.read<AppBloc>(),
60-
feedDecoratorService: feedDecoratorService,
61-
)..add(
62-
EntityDetailsLoadRequested(
63-
entityId: args.entityId,
54+
final entityDetailsBloc =
55+
EntityDetailsBloc(
56+
headlinesRepository: context.read<DataRepository<Headline>>(),
57+
topicRepository: topicsRepository,
58+
sourceRepository: sourcesRepository,
59+
accountBloc: context.read<AccountBloc>(),
60+
appBloc: context.read<AppBloc>(),
61+
feedDecoratorService: feedDecoratorService,
62+
)..add(
63+
EntityDetailsLoadRequested(
64+
entityId: args.entityId,
6465
contentType: args.contentType,
6566
entity: args.entity,
6667
),

lib/headlines-feed/bloc/headlines_feed_bloc.dart

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
2525
/// Requires repositories and services for its operations.
2626
HeadlinesFeedBloc({
2727
required DataRepository<Headline> headlinesRepository,
28-
required DataRepository<UserContentPreferences> userContentPreferencesRepository,
28+
required DataRepository<UserContentPreferences>
29+
userContentPreferencesRepository,
2930
required FeedDecoratorService feedDecoratorService,
3031
required AppBloc appBloc,
3132
}) : _headlinesRepository = headlinesRepository,
@@ -57,18 +58,13 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
5758
_onSuggestedItemFollowToggled,
5859
transformer: sequential(),
5960
);
60-
on<CallToActionTapped>(
61-
_onCallToActionTapped,
62-
transformer: sequential(),
63-
);
64-
on<NavigationHandled>(
65-
_onNavigationHandled,
66-
transformer: sequential(),
67-
);
61+
on<CallToActionTapped>(_onCallToActionTapped, transformer: sequential());
62+
on<NavigationHandled>(_onNavigationHandled, transformer: sequential());
6863
}
6964

7065
final DataRepository<Headline> _headlinesRepository;
71-
final DataRepository<UserContentPreferences> _userContentPreferencesRepository;
66+
final DataRepository<UserContentPreferences>
67+
_userContentPreferencesRepository;
7268
final FeedDecoratorService _feedDecoratorService;
7369
final AppBloc _appBloc;
7470

@@ -167,8 +163,10 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
167163
headlines: headlineResponse.items,
168164
user: currentUser,
169165
remoteConfig: appConfig,
170-
followedTopicIds: userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
171-
followedSourceIds: userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
166+
followedTopicIds:
167+
userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
168+
followedSourceIds:
169+
userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
172170
);
173171

174172
emit(
@@ -244,8 +242,10 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
244242
headlines: headlineResponse.items,
245243
user: currentUser,
246244
remoteConfig: appConfig,
247-
followedTopicIds: userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
248-
followedSourceIds: userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
245+
followedTopicIds:
246+
userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
247+
followedSourceIds:
248+
userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
249249
);
250250

251251
emit(
@@ -318,8 +318,10 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
318318
headlines: headlineResponse.items,
319319
user: currentUser,
320320
remoteConfig: appConfig,
321-
followedTopicIds: userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
322-
followedSourceIds: userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
321+
followedTopicIds:
322+
userPreferences?.followedTopics.map((t) => t.id).toList() ?? [],
323+
followedSourceIds:
324+
userPreferences?.followedSources.map((s) => s.id).toList() ?? [],
323325
);
324326

325327
emit(
@@ -410,7 +412,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
410412
UserContentPreferences updatedPreferences;
411413
if (event.item is Topic) {
412414
final topic = event.item as Topic;
413-
final currentTopics = List<Topic>.from(currentPreferences.followedTopics);
415+
final currentTopics = List<Topic>.from(
416+
currentPreferences.followedTopics,
417+
);
414418
if (event.isFollowing) {
415419
currentTopics.add(topic);
416420
} else {
@@ -421,7 +425,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
421425
);
422426
} else if (event.item is Source) {
423427
final source = event.item as Source;
424-
final currentSources = List<Source>.from(currentPreferences.followedSources);
428+
final currentSources = List<Source>.from(
429+
currentPreferences.followedSources,
430+
);
425431
if (event.isFollowing) {
426432
currentSources.add(source);
427433
} else {

lib/headlines-feed/bloc/headlines_feed_state.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ class HeadlinesFeedState extends Equatable {
4242
cursor: clearCursor ? null : cursor ?? this.cursor,
4343
filter: filter ?? this.filter,
4444
error: error ?? this.error,
45-
navigationUrl: clearNavigationUrl ? null : navigationUrl ?? this.navigationUrl,
45+
navigationUrl: clearNavigationUrl
46+
? null
47+
: navigationUrl ?? this.navigationUrl,
4648
);
4749
}
4850

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ class HeadlinesSearchBloc
1919
required DataRepository<Source> sourceRepository,
2020
required AppBloc appBloc,
2121
required FeedDecoratorService feedDecoratorService,
22-
}) : _headlinesRepository = headlinesRepository,
23-
_topicRepository = topicRepository,
24-
_sourceRepository = sourceRepository,
25-
_appBloc = appBloc,
26-
_feedDecoratorService = feedDecoratorService,
27-
super(const HeadlinesSearchInitial()) {
22+
}) : _headlinesRepository = headlinesRepository,
23+
_topicRepository = topicRepository,
24+
_sourceRepository = sourceRepository,
25+
_appBloc = appBloc,
26+
_feedDecoratorService = feedDecoratorService,
27+
super(const HeadlinesSearchInitial()) {
2828
on<HeadlinesSearchModelTypeChanged>(_onHeadlinesSearchModelTypeChanged);
2929
on<HeadlinesSearchFetchRequested>(
3030
_onSearchFetchRequested,

lib/router/router.dart

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ GoRouter createRouter({
6060
required DataRepository<Source> sourcesRepository,
6161
required DataRepository<UserAppSettings> userAppSettingsRepository,
6262
required DataRepository<UserContentPreferences>
63-
userContentPreferencesRepository,
63+
userContentPreferencesRepository,
6464
required DataRepository<RemoteConfig> remoteConfigRepository,
6565
required DataRepository<User> userRepository,
6666
required local_config.AppEnvironment environment,
@@ -141,20 +141,24 @@ GoRouter createRouter({
141141
if (isGoingToAuth) {
142142
// A fully authenticated user should never see auth pages.
143143
if (appStatus == AppStatus.authenticated) {
144-
print(' Action: Authenticated user on auth path. Redirecting to feed.');
144+
print(
145+
' Action: Authenticated user on auth path. Redirecting to feed.',
146+
);
145147
return feedPath;
146148
}
147149

148150
// An anonymous user is only allowed on auth paths for account linking.
149151
final isLinking =
150152
state.uri.queryParameters['context'] == 'linking' ||
151-
currentLocation.contains('/linking/');
153+
currentLocation.contains('/linking/');
152154

153155
if (isLinking) {
154156
print(' Action: Anonymous user on linking path. Allowing.');
155157
return null;
156158
} else {
157-
print(' Action: Anonymous user on non-linking auth path. Redirecting to feed.');
159+
print(
160+
' Action: Anonymous user on non-linking auth path. Redirecting to feed.',
161+
);
158162
return feedPath;
159163
}
160164
}
@@ -176,10 +180,7 @@ GoRouter createRouter({
176180
// A neutral root route that the app starts on. The redirect logic will
177181
// immediately move the user to the correct location. This route's
178182
// builder will never be called in practice.
179-
GoRoute(
180-
path: '/',
181-
builder: (context, state) => const SizedBox.shrink(),
182-
),
183+
GoRoute(path: '/', builder: (context, state) => const SizedBox.shrink()),
183184
GoRoute(
184185
path: Routes.authentication,
185186
name: Routes.authenticationName,
@@ -361,8 +362,8 @@ GoRouter createRouter({
361362
BlocProvider(
362363
create: (context) {
363364
return HeadlinesFeedBloc(
364-
headlinesRepository:
365-
context.read<DataRepository<Headline>>(),
365+
headlinesRepository: context
366+
.read<DataRepository<Headline>>(),
366367
userContentPreferencesRepository: context
367368
.read<DataRepository<UserContentPreferences>>(),
368369
feedDecoratorService: feedDecoratorService,
@@ -373,8 +374,8 @@ GoRouter createRouter({
373374
BlocProvider(
374375
create: (context) {
375376
return HeadlinesSearchBloc(
376-
headlinesRepository:
377-
context.read<DataRepository<Headline>>(),
377+
headlinesRepository: context
378+
.read<DataRepository<Headline>>(),
378379
topicRepository: context.read<DataRepository<Topic>>(),
379380
sourceRepository: context.read<DataRepository<Source>>(),
380381
appBloc: context.read<AppBloc>(),
@@ -478,8 +479,8 @@ GoRouter createRouter({
478479
sourcesRepository: context
479480
.read<DataRepository<Source>>(),
480481
countriesRepository: // Added missing repository
481-
context
482-
.read<DataRepository<Country>>(),
482+
context
483+
.read<DataRepository<Country>>(),
483484
),
484485
// Pass initialSelectedSources, country ISO codes, and source types from state.extra
485486
child: Builder(

0 commit comments

Comments
 (0)