Skip to content

Commit cd02fb8

Browse files
committed
feat: modify edit_category_state.dart. I'm adding an updatedCategory property. This will allow the EditCategoryBloc to hold the successfully updated category object, which is necessary for the UI to later perform a local update on the main content list.
1 parent 53ebeb8 commit cd02fb8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/content_management/bloc/edit_category/edit_category_state.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ final class EditCategoryState extends Equatable {
2828
this.iconUrl = '',
2929
this.contentStatus = ContentStatus.active,
3030
this.errorMessage,
31+
this.updatedCategory,
3132
});
3233

3334
final EditCategoryStatus status;
@@ -37,6 +38,7 @@ final class EditCategoryState extends Equatable {
3738
final String iconUrl;
3839
final ContentStatus contentStatus;
3940
final String? errorMessage;
41+
final Category? updatedCategory;
4042

4143
/// Returns true if the form is valid and can be submitted.
4244
bool get isFormValid => name.isNotEmpty;
@@ -49,6 +51,7 @@ final class EditCategoryState extends Equatable {
4951
String? iconUrl,
5052
ContentStatus? contentStatus,
5153
String? errorMessage,
54+
Category? updatedCategory,
5255
}) {
5356
return EditCategoryState(
5457
status: status ?? this.status,
@@ -58,17 +61,19 @@ final class EditCategoryState extends Equatable {
5861
iconUrl: iconUrl ?? this.iconUrl,
5962
contentStatus: contentStatus ?? this.contentStatus,
6063
errorMessage: errorMessage ?? this.errorMessage,
64+
updatedCategory: updatedCategory ?? this.updatedCategory,
6165
);
6266
}
6367

6468
@override
6569
List<Object?> get props => [
66-
status,
67-
initialCategory,
68-
name,
69-
description,
70-
iconUrl,
71-
contentStatus,
72-
errorMessage,
73-
];
70+
status,
71+
initialCategory,
72+
name,
73+
description,
74+
iconUrl,
75+
contentStatus,
76+
errorMessage,
77+
updatedCategory,
78+
];
7479
}

0 commit comments

Comments
 (0)