Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while searching if no data is match, we can simple show no data found or something like that widget #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/dropdown_button2/lib/src/dropdown_style_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ class DropdownSearchData<T> {
/// Creates a DropdownSearchData.
const DropdownSearchData({
this.searchController,
this.searchBarWidget,
this.searchBarWidgetHeight,
this.noResultsWidget,
this.searchInnerWidget,
this.searchInnerWidgetHeight,
this.searchMatchFn,
this.noDataFoundWidget, // New property for displaying "No data found"
}) : assert(
(searchBarWidget == null) == (searchBarWidgetHeight == null),
'searchBarWidgetHeight should not be null when using searchBarWidget\n'
(searchInnerWidget == null) == (searchInnerWidgetHeight == null),
'searchInnerWidgetHeight should not be null when using searchInnerWidget\n'
'This is necessary to properly determine menu limits and scroll offset',
);

Expand All @@ -290,13 +290,10 @@ class DropdownSearchData<T> {

/// The widget to use for searchable dropdowns, such as search bar.
/// It will be shown at the top of the dropdown menu.
final Widget? searchBarWidget;
final Widget? searchInnerWidget;

/// The height of the searchBarWidget if used.
final double? searchBarWidgetHeight;

/// The widget to show when the search results are empty.
final Widget? noResultsWidget;
/// The height of the searchInnerWidget if used.
final double? searchInnerWidgetHeight;

/// The match function used for searchable dropdowns. If this is null,
/// then _defaultSearchMatchFn will be used.
Expand All @@ -306,4 +303,7 @@ class DropdownSearchData<T> {
/// item.value.toString().toLowerCase().contains(searchValue.toLowerCase());
/// ```
final SearchMatchFn<T>? searchMatchFn;

/// Widget to display when no data is found after searching.
final Widget? noDataFoundWidget;
}