feat: Show torrent count for each filter state in drawer (#109)
Closes #109
Summary
Shows the count of torrents for each filter state (All, Downloading, Completed, Active, Inactive, Error) as a badge next to each filter tile in the drawer, matching the ruTorrent web interface behavior.
Changes
torrent_service.dart: AddedgetFilterCount(Filter)method that reuses the existing_filterList()logic to return the count-
drawer_viewmodel.dart: ExposedgetFilterCount()via the DrawerViewModel
-
filter_tile_list_widgets.dart: Added a trailing count badge with themed styling to each FilterTile The count updates reactively as torrents change state (download, complete, error, etc.).
Summary by CodeRabbit
- New Features
- Filter tiles now display the count of matching torrents as a trailing badge. The badge styling adapts based on selection state to maintain visual clarity across different filter categories.
This change adds filter count display functionality to the app's drawer. A new 🎯 2 (Simple) | ⏱️ ~12 minutes 🐰 A counter's delight, so neat and divine, ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
getFilterCount() method is introduced across the service and view model layers to compute matching torrents per filter, and the UI is updated to render these counts as styled trailing widgets in filter tiles.Changes
Cohort / File(s)
Summary
Service Layer
lib/services/state_services/torrent_service.dartAdded public
getFilterCount(Filter filter) method that delegates to internal _filterList() and returns the count of matching torrents, defaulting to 0 when null.
ViewModel Layer
lib/ui/widgets/smart_widgets/drawer/drawer_viewmodel.dartAdded public
getFilterCount(Filter filter) method as a null-safe wrapper that delegates to the torrent service.
UI Rendering
lib/ui/widgets/dumb_widgets/filter_tile_list_widgets.dartModified
FilterTile.build() to compute and display filter counts as styled trailing widgets in ListTiles, with opacity and color adjustments based on selection state.Estimated code review effort
Poem
Each filter now shows its torrent count line,
No more shall we guess what downloads await,
The drawer reveals them—how simply ornate!
From service to view, the logic flows free, ✨🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The PR title clearly and concisely summarizes the main change: adding torrent count display for each filter state in the drawer, which directly matches the primary objective.
Linked Issues check
✅ Passed
The PR implements all coding requirements from
#109: getFilterCount() method in TorrentService, delegation through DrawerViewModel, and count display with styling in FilterTile.
Out of Scope Changes check
✅ Passed
All changes are directly scoped to implement filter count display: the new getFilterCount() method, its delegation through DrawerViewModel, and the trailing count badge UI in FilterTile.
Docstring Coverage
✅ Passed
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.