DevWidgets icon indicating copy to clipboard operation
DevWidgets copied to clipboard

Implement custom function for the search box

Open gumbarros opened this issue 3 years ago • 3 comments

Currently the searchbox only filter tools by menu name. The best way to search would be adding search tags plus the tool name in the menu and home page.

gumbarros avatar Oct 09 '22 17:10 gumbarros

Here's a search I deviced:

let x be the search term, The results have to be list in the order below:

  1. name starts with x
  2. name contains x
  3. tag starts with x
  4. tag contains x
  5. description starts with x
  6. desc contains x

For this, we can add static data members to the stateless page widgets and use it as key for searching.

Also, as the list increases, we can asynchronously add matched to the search results. Ex: Loop over 1 and 2, show matches, loop over 3,4 and append is search box is still open, and so on.

Also, you mentioned tags, plural. Are multiple necessary? help me understand with a example plis.

kphanipavan avatar Oct 10 '22 06:10 kphanipavan

Great algorithm! I was thinking in add the search tags on the Tool class as a List<String> like the original DevToys and then add to the DTO object LinuxMenuItem. Example for JSON Formatter(I'm on the phone and maybe the syntax is incorrect):

@override
List<String> get searchTags => ["Formatter","JSON","Sort"]

gumbarros avatar Oct 10 '22 11:10 gumbarros

https://github.com/fzyzcjy/flutter_smooth

Ensures smooth listview animations regardless of the size.

Found it on reddit, might be useful when search is being implemented.

kphanipavan avatar Oct 28 '22 16:10 kphanipavan