From 5cd3909c4dedb8e15e2d57043ac657fcc17d47b0 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Wed, 8 Feb 2023 20:25:20 +0100 Subject: [PATCH] fix(ui): Fix adding anime or manga --- lib/src/ui/bloc/anime_list_bloc.dart | 32 +++++++++------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/lib/src/ui/bloc/anime_list_bloc.dart b/lib/src/ui/bloc/anime_list_bloc.dart index fe5bb6f..636a93d 100644 --- a/lib/src/ui/bloc/anime_list_bloc.dart +++ b/lib/src/ui/bloc/anime_list_bloc.dart @@ -59,17 +59,11 @@ class AnimeListBloc extends Bloc { // Add it to the cache _animes.add(event.data); - if (event.data.state == state.animeFilterState || - state.animeFilterState == MediumTrackingState.all) { - emit( - state.copyWith( - animes: List.from([ - ...state.animes, - event.data, - ]), - ), - ); - } + emit( + state.copyWith( + animes: _getFilteredAnime(), + ), + ); } Future _onMangaAdded(MangaAddedEvent event, Emitter emit) async { @@ -79,17 +73,11 @@ class AnimeListBloc extends Bloc { // Add it to the cache _mangas.add(event.data); - if (event.data.state == state.mangaFilterState || - state.mangaFilterState == MediumTrackingState.all) { - emit( - state.copyWith( - mangas: List.from([ - ...state.mangas, - event.data, - ]), - ), - ); - } + emit( + state.copyWith( + mangas: _getFilteredManga(), + ), + ); } Future _onAnimeIncremented(AnimeEpisodeIncrementedEvent event, Emitter emit) async {