search_widget 0.1.0 copy "search_widget: ^0.1.0" to clipboard
search_widget: ^0.1.0 copied to clipboard

outdated

A Flutter package which provides a Search Widget for selecting an option from a data list.

Search Widget GitHub stars Twitter Follow GitHub last commit Website shields.ioOpen Source Love #

This Flutter package provides a Search Widget for selecting an option from a data list. Provides filtering of items based on the search text.

PieChart

💻 Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

Version

dependencies:
  search_widget: <latest version>

❔ Usage #

Import this class #

import 'package:search_widget/search_widget.dart';

Add Search Widget #

  • Accepts data list as input
  • Option for pop list item builder. This basically returns a widget to show as list item in popup
popupListItemBuilder: (LeaderBoard item) {
   return PopupListItem(item);
 }
  • Option for filtering data list based on search query
queryBuilder: (String query, List<LeaderBoard> list) {
   return list.where((LeaderBoard item) => item.username.toLowerCase().contains(query.toLowerCase())).toList();
 }
  • Option provided for selected list item builder which enables when a user selects an item from pop up list
selectedItemBuilder: (LeaderBoard selectedItem, deleteSelectedItem) {
   return SelectedItem(selectedItem,deleteSelectedItem);
 }

Full Implementation #

SearchWidget<LeaderBoard>(
 dataList: list,
 hideSearchBoxWhenItemSelected: false,
 listContainerHeight: MediaQuery.of(context).size.height / 4,
 queryBuilder: (String query, List<LeaderBoard> list) {
   return list.where((LeaderBoard item) => item.username.toLowerCase().contains(query.toLowerCase())).toList();
 },
 popupListItemBuilder: (LeaderBoard item) {
   return PopupListItem(item);
 },
 selectedItemBuilder: (LeaderBoard selectedItem, deleteSelectedItem) {
   return SelectedItem(selectedItem,deleteSelectedItem);
 },
)

Key Highlights #

  • Adaptive Popup Position to prevent popup getting hidden behind keyboard

PieChart PieChart

  • Popup to scroll with scroll gesture if this widget is used inside ScrollView
PieChart

TODO #

  • Add support for selecting multiple items
  • Add visibility bool to show selected item widget
  • Give support for onSelectedItem method to return selected item(s) directly

⭐ My Flutter Packages #

  • pie_chart GitHub stars Flutter Pie Chart with cool animation.
  • avatar_glow GitHub stars Flutter Avatar Glow Widget with glowing animation.

⭐ My Flutter Apps #

👍 Contribution #

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
142
likes
0
pub points
84%
popularity

Publisher

verified publisherayushpgupta.com

A Flutter package which provides a Search Widget for selecting an option from a data list.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, keyboard_visibility

More

Packages that depend on search_widget