feat(ui): Hide the button when scrolled to the bottom

This commit is contained in:
2023-04-12 16:11:05 +02:00
parent 99021f2668
commit d38ee1692b
9 changed files with 396 additions and 167 deletions

View File

@@ -26,6 +26,7 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
on<MangaUpdatedEvent>(_onMangaUpdated);
on<AnimeRemovedEvent>(_onAnimeRemoved);
on<MangaRemovedEvent>(_onMangaRemoved);
on<AddButtonVisibilitySetEvent>(_onButtonVisibilityToggled);
}
/// Internal anime state
@@ -162,6 +163,7 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
emit(
state.copyWith(
trackingType: event.type,
buttonVisibility: true,
),
);
}
@@ -281,4 +283,12 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
// Update the database
await GetIt.I.get<DatabaseService>().deleteManga(event.id);
}
Future<void> _onButtonVisibilityToggled(AddButtonVisibilitySetEvent event, Emitter<AnimeListState> emit) async {
emit(
state.copyWith(
buttonVisibility: event.state,
),
);
}
}