From 98a655365d56355ca1e8ed4f31073a498f983415 Mon Sep 17 00:00:00 2001 From: Vibhash Date: Mon, 3 Jun 2024 12:45:54 +0530 Subject: [PATCH] while searching if data is not found, show some widget --- .../lib/src/dropdown_style_data.dart | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/dropdown_button2/lib/src/dropdown_style_data.dart b/packages/dropdown_button2/lib/src/dropdown_style_data.dart index 9a02b6a..7c5e83e 100644 --- a/packages/dropdown_button2/lib/src/dropdown_style_data.dart +++ b/packages/dropdown_button2/lib/src/dropdown_style_data.dart @@ -274,13 +274,13 @@ class DropdownSearchData { /// 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', ); @@ -290,13 +290,10 @@ class DropdownSearchData { /// 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. @@ -306,4 +303,7 @@ class DropdownSearchData { /// item.value.toString().toLowerCase().contains(searchValue.toLowerCase()); /// ``` final SearchMatchFn? searchMatchFn; + + /// Widget to display when no data is found after searching. + final Widget? noDataFoundWidget; }