Use getCurrentItemType() method to determine the ItemType of the current tab instead of the conditional with `_tabBarController.index`, which doesn't take into account that there could be hidden tabs.
This commit is contained in:
NBA2K1 2025-12-28 23:42:45 +01:00
parent da566d3d0b
commit 67a83c0e6a

View file

@ -34,14 +34,8 @@ class _UpdatesScreenState extends ConsumerState<UpdatesScreen>
bool _isLoading = false;
Future<void> _updateLibrary() async {
setState(() {
_isLoading = true;
});
final itemType = _tabBarController.index == 0
? ItemType.manga
: _tabBarController.index == 1
? ItemType.anime
: ItemType.novel;
setState(() => _isLoading = true);
final itemType = getCurrentItemType();
final mangaList = isar.mangas
.filter()
.idIsNotNull()
@ -57,9 +51,7 @@ class _UpdatesScreenState extends ConsumerState<UpdatesScreen>
mangaList: mangaList,
itemType: itemType,
);
setState(() {
_isLoading = false;
});
setState(() => _isLoading = false);
}
void tabListener() {