Skip to content

feature: add search bar for collect page#2235

Open
hl1282456555 wants to merge 2 commits into
Predidit:mainfrom
hl1282456555:feature_local_collect_search
Open

feature: add search bar for collect page#2235
hl1282456555 wants to merge 2 commits into
Predidit:mainfrom
hl1282456555:feature_local_collect_search

Conversation

@hl1282456555

Copy link
Copy Markdown
Contributor

add a search bar for collect page to filter bangumi by nameCn and name.
related issuse #2193

image image

for (List<CollectedBangumi> list in collectedBangumiRenderItemList) {
if (collectController.searchText.isNotEmpty) {
list.removeWhere((item) {
return !item.bangumiItem.nameCn.contains(collectController.searchText) &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Case-sensitive search may miss matches

String.contains is case-sensitive, so searching naruto will not match a title stored as Naruto. For the English name field in particular, users likely expect case-insensitive matching. Consider lower-casing both sides, e.g. normalize searchText once and compare against nameCn.toLowerCase() / name.toLowerCase().


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 2 Issues Found | Recommendation: Optional improvements before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1

Incremental review of commit 79c2bd9 (search bar refactored from a floating bottom bar into an AppBar action entry).

Issue Details (click to expand)

WARNING

File Line Issue
lib/pages/collect/collect_page.dart 34 _searchEntryFocusNode is created but never disposed in dispose(), leaking resources. (NEW)

SUGGESTION

File Line Issue
lib/pages/collect/collect_page.dart 295 Search uses case-sensitive String.contains; English name matches may be missed. Consider case-insensitive comparison. (carried forward)
Other Observations (not inline-commentable / UX-only)
File Line Observation
lib/pages/collect/collect_page.dart 33 searchBarHovering is now dead code — its only usages (MouseRegion.onHover/onExit) were removed when the floating search bar was deleted. Safe to remove.
lib/pages/collect/collect_page.dart 330-339 When a filter excludes every item in a tab, contentGrid falls back to childCount: 10 with a null builder (empty result) rather than an explicit "no matches" state. Pre-existing behavior, reachable via search.

Resolved since last review: The previous touch-device hover/opacity issue and the floating bar overlapping the grid/FAB are no longer applicable — the floating SearchBar was replaced by an AppBar search entry toggle.

Files Reviewed (3 files)
  • lib/pages/collect/collect_controller.dart - 0 issues (added isSearching observable)
  • lib/pages/collect/collect_controller.g.dart - generated, skipped
  • lib/pages/collect/collect_page.dart - 1 warning, 1 suggestion

Fix these issues in Kilo Cloud

Previous Review Summary (commit 0dd4aff)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 0dd4aff)

Status: 1 Issue Found | Recommendation: Optional improvements before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
lib/pages/collect/collect_page.dart 333 Search uses case-sensitive String.contains; English name matches may be missed. Consider case-insensitive comparison.
Other Observations (not inline-commentable / UX-only)

Non-blocking observations in the changed code:

File Line Observation
lib/pages/collect/collect_page.dart 267-272 The search bar opacity is driven by MouseRegion.onHover/onExit, which do not fire on touch devices. On mobile the bar will stay permanently at 0.5 opacity. Consider basing visibility on focus/text state too.
lib/pages/collect/collect_page.dart 259-303 The floating SearchBar overlays the bottom of the grid (no extra bottom padding added to the lists), so it can permanently obscure the last row of cards and may overlap the bottom-right sync FloatingActionButton on narrow layouts.
lib/pages/collect/collect_page.dart 330-339 When a filter excludes every item in a tab, contentGrid falls back to childCount: 10 with a null builder (empty result) rather than an explicit "no matches" state. Pre-existing behavior, but now reachable via search.
Files Reviewed (3 files)
  • lib/pages/collect/collect_controller.dart - 0 issues
  • lib/pages/collect/collect_controller.g.dart - generated, skipped
  • lib/pages/collect/collect_page.dart - 1 suggestion

Fix these issues in Kilo Cloud


Reviewed by claude-opus-4.8 · 279,242 tokens

@Predidit

Copy link
Copy Markdown
Owner

此PR的代码很棒,但是 UI/UX 有些太糟糕了,搜索框叠放在页面下方很奇怪

@hl1282456555

Copy link
Copy Markdown
Contributor Author

我的想法是考虑到手机端操作会方便一点,并且放在顶部的话会和现有网络搜索的按钮有视觉冲突,如果有什么其他好想法的话我可以改一下

@Predidit

Copy link
Copy Markdown
Owner

可以在 #2106 提到的群组中进一步讨论 UI/UX 的问题

@hl1282456555

Copy link
Copy Markdown
Contributor Author

OK,已加入

bool showDelete = false;
bool syncCollectiblesing = false;
bool searchBarHovering = false;
late final FocusNode _searchEntryFocusNode = FocusNode();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: _searchEntryFocusNode is created here but never disposed. The dispose() method (lines 162-166) disposes tabController and searchController, but not this FocusNode. An undisposed FocusNode leaks resources and is flagged by the Flutter analyzer.

Suggested change
late final FocusNode _searchEntryFocusNode = FocusNode();
late final FocusNode _searchEntryFocusNode = FocusNode();

Then add _searchEntryFocusNode.dispose(); inside dispose().


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

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