Skip to content

Fix "Show extensions" Button AND Fix category rearrange bug AND hide ItemType from calendar#636

Merged
kodjodevf merged 23 commits intokodjodevf:mainfrom
NBA2K1:main
Jan 5, 2026
Merged

Fix "Show extensions" Button AND Fix category rearrange bug AND hide ItemType from calendar#636
kodjodevf merged 23 commits intokodjodevf:mainfrom
NBA2K1:main

Conversation

@NBA2K1
Copy link
Copy Markdown
Contributor

@NBA2K1 NBA2K1 commented Dec 30, 2025

  • Fix "Show extensions" Button

    • The "Show extensions" Button was not working properly when categories were hidden.
      An _AssertionError Exception would throw.
      And jump to the end of the tab list regardless of where you clicked the button.
  • Fix category rearrange bug

    • When rearranging categories in the Manga library, all categories in Anime and Novel were being deleted.
  • Hide ItemType in calendar

    • When the user has hidden Manga or Anime or Novel, hide the buttons in the calendar.
  • Reduce Code Duplication

    • Extract the _updateLibrary() function from updates_screen.dart and library_screen.dart to a top-level function in libray_updater.dart.
      • Add logging and detailed botToast to the library updater.
    • Refactor tabbed screens (updates_screen.dart and history_screen.dart) into base class base_library_tab_screen.dart
    • Extract the localizedItemType() function from base_library_tab_screen.dart, statistics_screen.dart and categories_screen.dart to an extension in item_type_localization.dart
    • Add localizedSources() and localizedExtensions() for browse_screen.dart to item_type_localization.dart
    • Remove now redundant if-statements
    • Introduce item_type_filters.dart for the hiddenItemTypes function.
      • reduces code duplication in statistics_screen, categories_screen and base_library_tab_screen
    • Refactor "moveUp" and "moveDown" buttons in categories_screen.dart into a helper method.
  • Extract helper methods in calendar_screen.dart, making it more readable.

  • Improve performance of method _getEntriesForDay() in calendar

    • by caching the days, avoiding recomputing every day again and again
    • by comparing integers instead of Strings

Extract the `_updateLibrary()` function from `updates_screen.dart` and `library_screen.dart` to a top-level function in `libray_updater.dart`.
- Use the logger to log failed updates

- After the update-botToast another botToast is being spawned to show exactly which manga(s) couldn't be updated.

- Remove the doWhile loop because it is unnecessary. The condition of mangaList.length == numbers is always true, meaning it only runs once.
No need to pass hideItems down, they all can use the top hideItems variable. It's never changed.
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.
The previous version was just unnecessarily complicated, hard to read.
New version is very easy to read.
- Change _tabList String-list to be a list of ItemType
- Change its name to _visibleTabTypes
- Use that list in getCurrentItemType(), instead of creating a new list
Use the _visibleTabTypes list instead of the repeated if-statements.
- remove hideItems parameter
- Make TabBar and TabBarView cleaner
- Extract localizedItemType() from `base_library_tab_screen.dart`
- Add localizedSources() and localizedExtensions() for browse_screen.dart
- Reduce if-statements in statistics_screen.dart
- Reduce if-statements in categories_screen.dart
- Reduce if-statements in browse_screen.dart
The "Show extensions" Button was not working properly when categories were hidden.
An Exception would throw:
```
_AssertionError ('package:flutter/src/material/tab_controller.dart': Failed assertion: line 202 pos 12: 'value >= 0 && (value < length || length == 0)': is not true.)
```
And jump to the end of the tab list regardless of where you clicked the button.
- new file item_type_filters.dart for the hiddenItemTypes function.
- reduces code duplication in statistics_screen, categories_screen and base_library_tab_screen
_updateCategoriesOrder() is now async
When rearranging categories in the Manga library, all categories in Anime and Novel were being deleted.
And add comments
When the user has hidden Manga or Anime or Novel, hide the buttons in the calendar.
Don't show manga calendar if manga is hidden.
for better readability
- compare integers instead of Strings
- cache results per day
- avoids extra text file
- simplify RenderBox lookup
@kodjodevf kodjodevf merged commit 2365e28 into kodjodevf:main Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants