Skip to content

Commit 4f84cef

Browse files
committed
style: format
1 parent 90d00c0 commit 4f84cef

13 files changed

+64
-51
lines changed

lib/content_management/bloc/content_management_bloc.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ class ContentManagementBloc
9393
}
9494
}
9595

96-
void _onHeadlineAdded(HeadlineAdded event, Emitter<ContentManagementState> emit) {
96+
void _onHeadlineAdded(
97+
HeadlineAdded event,
98+
Emitter<ContentManagementState> emit,
99+
) {
97100
final updatedHeadlines = [event.headline, ...state.headlines];
98101
emit(
99102
state.copyWith(
@@ -121,8 +124,9 @@ class ContentManagementBloc
121124
) async {
122125
try {
123126
await _headlinesRepository.delete(id: event.id);
124-
final updatedHeadlines =
125-
state.headlines.where((h) => h.id != event.id).toList();
127+
final updatedHeadlines = state.headlines
128+
.where((h) => h.id != event.id)
129+
.toList();
126130
emit(state.copyWith(headlines: updatedHeadlines));
127131
} on HtHttpException catch (e) {
128132
emit(
@@ -197,7 +201,9 @@ class ContentManagementBloc
197201
Emitter<ContentManagementState> emit,
198202
) {
199203
final updatedCategories = List<Category>.from(state.categories);
200-
final index = updatedCategories.indexWhere((c) => c.id == event.category.id);
204+
final index = updatedCategories.indexWhere(
205+
(c) => c.id == event.category.id,
206+
);
201207
if (index != -1) {
202208
updatedCategories[index] = event.category;
203209
emit(state.copyWith(categories: updatedCategories));
@@ -210,8 +216,9 @@ class ContentManagementBloc
210216
) async {
211217
try {
212218
await _categoriesRepository.delete(id: event.id);
213-
final updatedCategories =
214-
state.categories.where((c) => c.id != event.id).toList();
219+
final updatedCategories = state.categories
220+
.where((c) => c.id != event.id)
221+
.toList();
215222
emit(state.copyWith(categories: updatedCategories));
216223
} on HtHttpException catch (e) {
217224
emit(
@@ -296,8 +303,9 @@ class ContentManagementBloc
296303
) async {
297304
try {
298305
await _sourcesRepository.delete(id: event.id);
299-
final updatedSources =
300-
state.sources.where((s) => s.id != event.id).toList();
306+
final updatedSources = state.sources
307+
.where((s) => s.id != event.id)
308+
.toList();
301309
emit(state.copyWith(sources: updatedSources));
302310
} on HtHttpException catch (e) {
303311
emit(

lib/content_management/bloc/content_management_state.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of 'content_management_bloc.dart';
22

3-
43
/// Represents the status of content loading and operations.
54
enum ContentManagementStatus {
65
/// The operation is in its initial state.
@@ -115,19 +114,19 @@ class ContentManagementState extends Equatable {
115114

116115
@override
117116
List<Object?> get props => [
118-
activeTab,
119-
headlinesStatus,
120-
headlines,
121-
headlinesCursor,
122-
headlinesHasMore,
123-
categoriesStatus,
124-
categories,
125-
categoriesCursor,
126-
categoriesHasMore,
127-
sourcesStatus,
128-
sources,
129-
sourcesCursor,
130-
sourcesHasMore,
131-
errorMessage,
132-
];
117+
activeTab,
118+
headlinesStatus,
119+
headlines,
120+
headlinesCursor,
121+
headlinesHasMore,
122+
categoriesStatus,
123+
categories,
124+
categoriesCursor,
125+
categoriesHasMore,
126+
sourcesStatus,
127+
sources,
128+
sourcesCursor,
129+
sourcesHasMore,
130+
errorMessage,
131+
];
133132
}

lib/content_management/bloc/edit_headline/edit_headline_state.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ final class EditHeadlineState extends Equatable {
3333
this.categories = const [],
3434
this.contentStatus = ContentStatus.active,
3535
this.errorMessage,
36-
this.updatedHeadline,
37-
36+
this.updatedHeadline,
3837
});
3938

4039
final EditHeadlineStatus status;

lib/content_management/view/categories_page.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class _CategoriesPageState extends State<CategoriesPage> {
8989
source: _CategoriesDataSource(
9090
context: context,
9191
categories: state.categories,
92-
isLoading: state.categoriesStatus == ContentManagementStatus.loading,
92+
isLoading:
93+
state.categoriesStatus == ContentManagementStatus.loading,
9394
hasMore: state.categoriesHasMore,
9495
l10n: l10n,
9596
),
@@ -157,7 +158,10 @@ class _CategoriesDataSource extends DataTableSource {
157158
return DataRow2(
158159
onSelectChanged: (selected) {
159160
if (selected ?? false) {
160-
context.goNamed(Routes.editCategoryName, pathParameters: {'id': category.id});
161+
context.goNamed(
162+
Routes.editCategoryName,
163+
pathParameters: {'id': category.id},
164+
);
161165
}
162166
},
163167
cells: [
@@ -211,7 +215,9 @@ class _CategoriesDataSource extends DataTableSource {
211215
if (hasMore) {
212216
// When loading, we show an extra row for the spinner.
213217
// Otherwise, we just indicate that there are more rows.
214-
return isLoading ? categories.length + 1 : categories.length + kDefaultRowsPerPage;
218+
return isLoading
219+
? categories.length + 1
220+
: categories.length + kDefaultRowsPerPage;
215221
}
216222
return categories.length;
217223
}

lib/content_management/view/content_management_page.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ class _ContentManagementPageState extends State<ContentManagementPage>
9696
icon: const Icon(Icons.add),
9797
tooltip: 'Add New Item', // Consider localizing this tooltip
9898
onPressed: () {
99-
final currentTab =
100-
context.read<ContentManagementBloc>().state.activeTab;
99+
final currentTab = context
100+
.read<ContentManagementBloc>()
101+
.state
102+
.activeTab;
101103
switch (currentTab) {
102104
case ContentManagementTab.headlines:
103105
context.goNamed(Routes.createHeadlineName);

lib/content_management/view/create_category_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class _CreateCategoryViewState extends State<_CreateCategoryView> {
8383
SnackBar(content: Text(l10n.categoryCreatedSuccessfully)),
8484
);
8585
context.read<ContentManagementBloc>().add(
86-
CategoryAdded(state.createdCategory!),
87-
);
86+
CategoryAdded(state.createdCategory!),
87+
);
8888
context.pop();
8989
}
9090
if (state.status == CreateCategoryStatus.failure) {
@@ -155,9 +155,9 @@ class _CreateCategoryViewState extends State<_CreateCategoryView> {
155155
}).toList(),
156156
onChanged: (value) {
157157
if (value == null) return;
158-
context
159-
.read<CreateCategoryBloc>()
160-
.add(CreateCategoryStatusChanged(value));
158+
context.read<CreateCategoryBloc>().add(
159+
CreateCategoryStatusChanged(value),
160+
);
161161
},
162162
),
163163
],

lib/content_management/view/create_headline_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> {
8585
SnackBar(content: Text(l10n.headlineCreatedSuccessfully)),
8686
);
8787
context.read<ContentManagementBloc>().add(
88-
HeadlineAdded(state.createdHeadline!),
89-
);
88+
HeadlineAdded(state.createdHeadline!),
89+
);
9090
context.pop();
9191
}
9292
if (state.status == CreateHeadlineStatus.failure) {

lib/content_management/view/create_source_page.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
8484
..showSnackBar(
8585
SnackBar(content: Text(l10n.sourceCreatedSuccessfully)),
8686
);
87-
context
88-
.read<ContentManagementBloc>()
89-
.add(SourceAdded(state.createdSource!));
87+
context.read<ContentManagementBloc>().add(
88+
SourceAdded(state.createdSource!),
89+
);
9090
context.pop();
9191
}
9292
if (state.status == CreateSourceStatus.failure) {

lib/content_management/view/edit_category_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ class _EditCategoryViewState extends State<_EditCategoryView> {
110110
const SnackBar(content: Text('Category updated successfully.')),
111111
);
112112
context.read<ContentManagementBloc>().add(
113-
CategoryUpdated(state.updatedCategory!),
114-
);
113+
CategoryUpdated(state.updatedCategory!),
114+
);
115115
context.pop();
116116
}
117117
if (state.status == EditCategoryStatus.failure) {

lib/content_management/view/edit_headline_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> {
116116
),
117117
);
118118
context.read<ContentManagementBloc>().add(
119-
HeadlineUpdated(state.updatedHeadline!),
120-
);
119+
HeadlineUpdated(state.updatedHeadline!),
120+
);
121121
context.pop();
122122
}
123123
if (state.status == EditHeadlineStatus.failure) {

0 commit comments

Comments
 (0)