एक विजेट जो उपयोगकर्ता को एक कस्टमाइज़ेबल कीबोर्ड पर टाइप किए गए कीवर्ड स्ट्रिंग में सर्च करने की अनुमति देता है, जिसे डायलॉग बॉक्स या मेनू में एक सिंगल या मल्टीपल चॉइस लिस्ट के रूप में प्रस्तुत किया जाता है।
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक फ्लटर विजेट जो उपयोगकर्ताओं को एक विकल्प सूची में एक कस्टमाइज़ेबल कीबोर्ड का उपयोग करके खोजने की अनुमति देता है। यह एकल और बहुचयन मोड दोनों का समर्थन करता है, चयन को एक ड्रॉपडाउन मेनू या डायलॉग बॉक्स में प्रस्तुत करता है। बड़ी सूची से त्वरित रूप से चयन करने की आवश्यकता वाले फॉर्म और डेटा एंट्री के लिए आदर्श है। विजेट बहुत अनुकूलनीय है, जिससे इनपुट फ़ील्ड, ड्रॉपडाउन दिखावट और खोज व्यवहार को कस्टमाइज़ किया जा सकता है। विस्तृत सूचियों में नेविगेशन समय को कम करके उपयोगकर्ता अनुभव को बढ़ाता है।
उपयोग
बड़े विकल्प सूची वाले फॉर्म इनपुट
फ़िल्टरिंग के साथ उपयोगकर्ता प्रोफ़ाइल चयन
ई-कॉमर्स उत्पाद श्रेणी चयन
प्रशासन पैनल में डायनामिक डेटा फ़िल्टरिंग
खोज के साथ बहु-चयन ड्रॉपडाउन
कस्टमाइज़ किए गए सर्च इंटरफेस
मुख्य विशेषताएँ
वास्तविक समय फ़िल्टरिंग के साथ खोजने योग्य ड्रॉपडाउन
एकल और बहुचयन के लिए समर्थन
कस्टमाइज़ किए गए कीबोर्ड और इनपुट फ़ील्ड
डायलॉग या मेनू में प्रस्तुत ड्रॉपडाउन
विस्तारशील शैली और थीम समर्थन
बड़े डेटासेट्स के साथ कुशल प्रदर्शन
इनके लिए उपयुक्त
लंबी विकल्प सूचियों के साथ फॉर्म बना रहे डेवलपर्स
त्वरित डेटा खोज की आवश्यकता वाले एप्स
स्पष्ट चयन की आवश्यकता वाले UI-भारी एप्लिकेशन
पुन: उपयोग करने योग्य, कॉन्फ़िगर करने योग्य ड्रॉपडाउन घटक चाहने वाली टीमें
डेटा एंट्री में उपयोगकर्ता अनुभव पर बल देने वाले प्रोजेक्ट
विचार योग्य बातें
सीमित प्लेटफॉर्म-विशिष्ट एकीकरण (कोई प्लेटफॉर्म नहीं बताया गया)
जटिल थीम के लिए अतिरिक्त स्टाइलिंग की आवश्यकता हो सकती है
प्रदर्शन सूची के आकार और फ़िल्टरिंग तर्क पर निर्भर करता है
कोई निर्मित लोकलाइजेशन समर्थन नहीं है
पृष्ठांतरण के बिना बहुत बड़े डेटासेट के लिए अनअनुकूलित
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
searchable_dropdown
Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list presented as a dropdown in a dialog box or a menu.
Platforms
This widget has been successfully tested on iOS, Android and Chrome.
Call either the single choice or the multiple choice constructor.
Single choice constructor
Search choices Widget with a single choice that opens a dialog or a menu to let the user do the selection conveniently with a search.
factorySearchableDropdown.single({
Key key,
@requiredList<DropdownMenuItem<T>> items,
@requiredFunction onChanged,
T value,
TextStyle style,
dynamic searchHint,
dynamic hint,
dynamic disabledHint,
dynamic icon = constIcon(Icons.arrow_drop_down),
dynamic underline,
dynamic doneButton,
dynamic label,
dynamic closeButton = "Close",
bool displayClearIcon = true,
Icon clearIcon = constIcon(Icons.clear),
Color iconEnabledColor,
Color iconDisabledColor,
double iconSize = 24.0,
bool isExpanded = false,
bool isCaseSensitiveSearch = false,
Function searchFn,
Function onClear,
Function selectedValueWidgetFn,
TextInputType keyboardType = TextInputType.text,
Function validator,
bool assertUniqueValue = true,
Function displayItem,
bool dialogBox = true,
BoxConstraints menuConstraints,
bool readOnly: false,
Color menuBackgroundColor,
}
)
items with child: Widget displayed ; value: any object with .toString() used to match search keyword.
onChanged Function with parameter: value not returning executed after the selection is done.
value value to be preselected.
style used for the hint if it is given is String.
searchHint String|Widget|Function with no parameter returning String|Widget displayed at the top of the search dialog box.
hint String|Widget|Function with no parameter returning String|Widget displayed before any value is selected or after the selection is cleared.
disabledHint String|Widget|Function with no parameter returning String|Widget displayed instead of hint when the widget is displayed.
icon String|Widget|Function with parameter: value returning String|Widget displayed next to the selected item or the hint if none.
underline String|Widget|Function with parameter: value returning String|Widget displayed below the selected item or the hint if none.
doneButton String|Widget|Function with parameter: value returning String|Widget displayed at the top of the search dialog box.
label String|Widget|Function with parameter: value returning String|Widget displayed above the selected item or the hint if none.
closeButton String|Widget|Function with parameter: value returning String|Widget displayed at the bottom of the search dialog box.
displayClearIcon whether or not to display an icon to clear the selected value.
clearIcon Icon to be used for clearing the selected value.
iconEnabledColor Color to be used for enabled icons.
iconDisabledColor Color to be used for disabled icons.
iconSize for the icons next to the selected value (icon and clearIcon).
isExpanded can be necessary to avoid pixel overflows (zebra symptom).
isCaseSensitiveSearch only used when searchFn is not specified.
searchFn Function with parameters: keyword, items returning List as the list of indexes for the items to be displayed.
onClear Function with no parameter not returning executed when the clear icon is tapped.
selectedValueWidgetFn Function with parameter: item returning Widget to be used to display the selected value.
keyboardType used for the search.
validator Function with parameter: value returning String displayed below selected value when not valid and null when valid.
assertUniqueValue whether to run a consistency check of the list of items.
displayItem Function with parameters: item, selected returning Widget to be displayed in the search list.
dialogBox whether the search should be displayed as a dialog box or as a menu below the selected value if any.
menuConstraints BoxConstraints used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
readOnly bool whether to let the user choose the value to select or just present the selected value if any.
menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
Multiple choice constructor
Search choices Widget with a multiple choice that opens a dialog or a menu to let the user do the selection conveniently with a search.
SearchableDropdown<T>.multiple(
{
Key key,
@requiredList<DropdownMenuItem<T>> items,
@requiredFunction onChanged,
List<int> selectedItems: const [],
TextStyle style,
dynamic searchHint,
dynamic hint,
dynamic disabledHint,
dynamic icon: constIcon(Icons.arrow_drop_down),
dynamic underline,
dynamic doneButton: "Done",
dynamic label,
dynamic closeButton: "Close",
bool displayClearIcon: true,
Icon clearIcon: constIcon(Icons.clear),
Color iconEnabledColor,
Color iconDisabledColor,
double iconSize: 24.0,
bool isExpanded: false,
bool isCaseSensitiveSearch: false,
Function searchFn,
Function onClear,
Function selectedValueWidgetFn,
TextInputType keyboardType: TextInputType.text,
Function validator,
Function displayItem,
bool dialogBox: true,
BoxConstraints menuConstraints,
bool readOnly: false,
Color menuBackgroundColor,
}
)
items with child: Widget displayed ; value: any object with .toString() used to match search keyword.
onChanged Function with parameter: selectedItems not returning executed after the selection is done.
selectedItems indexes of items to be preselected.
style used for the hint if it is given is String.
searchHint String|Widget|Function with no parameter returning String|Widget displayed at the top of the search dialog box.
hint String|Widget|Function with no parameter returning String|Widget displayed before any value is selected or after the selection is cleared.
disabledHint String|Widget|Function with no parameter returning String|Widget displayed instead of hint when the widget is displayed.
icon String|Widget|Function with parameter: selectedItems returning String|Widget displayed next to the selected items or the hint if none.
underline String|Widget|Function with parameter: selectedItems returning String|Widget displayed below the selected items or the hint if none.
doneButton String|Widget|Function with parameter: selectedItems returning String|Widget displayed at the top of the search dialog box. Cannot be null in multiple selection mode.
label String|Widget|Function with parameter: selectedItems returning String|Widget displayed above the selected items or the hint if none.
closeButton String|Widget|Function with parameter: selectedItems returning String|Widget displayed at the bottom of the search dialog box.
displayClearIcon whether or not to display an icon to clear the selected values.
clearIcon Icon to be used for clearing the selected values.
iconEnabledColor Color to be used for enabled icons.
iconDisabledColor Color to be used for disabled icons.
iconSize for the icons next to the selected values (icon and clearIcon).
isExpanded can be necessary to avoid pixel overflows (zebra symptom).
isCaseSensitiveSearch only used when searchFn is not specified.
searchFn Function with parameters: keyword, items returning List as the list of indexes for the items to be displayed.
onClear Function with no parameter not returning executed when the clear icon is tapped.
selectedValueWidgetFn Function with parameter: item returning Widget to be used to display the selected values.
keyboardType used for the search.
validator Function with parameter: selectedItems returning String displayed below selected values when not valid and null when valid.
displayItem Function with parameters: item, selected returning Widget to be displayed in the search list.
dialogBox whether the search should be displayed as a dialog box or as a menu below the selected values if any.
menuConstraints BoxConstraints used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
readOnly bool whether to let the user choose the value to select or just present the selected value if any.
menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
SearchableDropdown.single(
items: [
DropdownMenuItem(
child: Text(
"way too long text for a smartphone at least one that goes in a normal sized pair of trousers but maybe not for a gigantic screen like there is one at my cousin's home in a very remote country where I
wouldn't want to go right now"),
value:
"way too long text for a smartphone at least one that goes in a normal sized pair of trousers but maybe not for a gigantic screen like there is one at my cousin's home in a very remote country where I
wouldn't want to go right now",
)
],
value: "",
hint: "Select one",
searchHint: "Select one",
onChanged: (value) {
setState(() {
selectedValue = value;
});
},
dialogBox: true,
isExpanded: true,
),