Skip to content

Commit

Permalink
Merge pull request #9 from zeref278/duytn/refactor_uistatus
Browse files Browse the repository at this point in the history
refactor ui status
  • Loading branch information
zeref278 authored Nov 8, 2022
2 parents f926f8e + 9d1204e commit 998bd3f
Show file tree
Hide file tree
Showing 10 changed files with 821 additions and 42 deletions.
3 changes: 0 additions & 3 deletions lib/features/application/bloc/application_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@ enum UIStatus {
loading,
loadSuccess,
loadFailed,
actionLoading,
actionSuccess,
actionFailed,
}
8 changes: 3 additions & 5 deletions lib/features/demo/bloc/demo_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class DemoBloc extends Bloc<DemoEvent, DemoState> {
) async {
try {
emit(state.copyWith(
status: UIStatus.loading,
isBusy: true,
));

Expand All @@ -72,16 +71,15 @@ class DemoBloc extends Bloc<DemoEvent, DemoState> {
images.removeWhere((element) => element.message == event.message);

emit(state.copyWith(
status: UIStatus.actionSuccess,
notification:
_NotificationInsertSuccess(message: S.current.delete_success),
images: images,
successMsg: S.current.delete_success,
isBusy: false,
));
} catch (e, s) {
_logService.e('DemoLoadImageFromDB failed', e, s);
emit(state.copyWith(
status: UIStatus.actionFailed,
errorMsg: e.toString(),
notification: _NotificationInsertFailed(message: e.toString()),
isBusy: false,
));
}
Expand Down
Loading

0 comments on commit 998bd3f

Please sign in to comment.