FilterListWidget<T extends Object> class
The FilterListWidget is a widget with some filter utilities and callbacks which helps in single/multiple selection from list of data.
This example shows how to use FilterListWidget
FilterListWidget<String>(
listData: ["One","Two","Three", "Four","five", "Six","Seven","Eight","Nine","Ten"],
selectedListData: ["One", "Three", "Four", "Eight", "Nine"],
hideHeaderText: true,
height: MediaQuery.of(context).size.height,
// hideHeaderText: true,
onApplyButtonClick: (list) {
Navigator.pop(context, list);
},
choiceChipLabel: (item) {
/// Used to print text on chip
return item;
},
validateSelectedItem: (list, val) {
/// identify if item is selected or not
return list!.contains(val);
},
onItemSearch: (list, text) {
/// When text change in search text field then return list containing that text value
///
///Check if list has value which match's to text
if (list!.any((element) =>
element.toLowerCase().contains(text.toLowerCase()))) {
/// return list which contains matches
return list
.where((element) =>
element.toLowerCase().contains(text.toLowerCase()))
.toList();
}
return [];
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- FilterListWidget
Constructors
-
FilterListWidget({Key? key, FilterListThemeData? themeData, List<
T> ? listData, required ValidateSelectedItem<T> validateSelectedItem, ValidateRemoveItem<T> ? validateRemoveItem, required LabelDelegate<T> choiceChipLabel, required SearchPredict<T> onItemSearch, List<T> ? selectedListData, OnApplyButtonClick<T> ? onApplyButtonClick, ChoiceChipBuilder? choiceChipBuilder, Widget? headerCloseIcon, String? headlineText, bool hideSelectedTextCount = false, bool hideSearchField = false, bool hideCloseIcon = true, bool? hideHeader = false, Color? backgroundColor = Colors.white, bool enableOnlySingleSelection = false, String? allButtonText = 'All', String? applyButtonText = 'Apply', String? resetButtonText = 'Reset', String? selectedItemsText = 'selected items', List<ControlButtonType> controlButtons = const [ControlButtonType.All, ControlButtonType.Reset]}) -
const
Properties
- allButtonText → String?
-
All Button Label
final
- applyButtonText → String?
-
Apply Button Label
final
- backgroundColor → Color?
-
final
- choiceChipBuilder → ChoiceChipBuilder?
-
The
choiceChipBuilder
is a builder to design custom choice chip.final -
choiceChipLabel
→ LabelDelegate<
T> -
The
choiceChipLabel
is callback which required String value to display text on choice chip.final -
controlButtons
→ List<
ControlButtonType> -
control buttons to show on bottom of dialog along with 'Apply' button.
final
- enableOnlySingleSelection → bool
-
if enableOnlySingleSelection is true then it disabled the multiple selection.
and enabled the single selection model.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerCloseIcon → Widget?
-
Widget to close the dialog.
final
- headlineText → String?
-
final
- hideCloseIcon → bool
-
if true then it hides close icon.
final
- hideHeader → bool?
-
If true then it hide complete header section.
final
- hideSearchField → bool
-
final
- hideSelectedTextCount → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
listData
→ List<
T> ? -
Pass list containing all data which needs to filter
final
-
onApplyButtonClick
→ OnApplyButtonClick<
T> ? -
The
onApplyButtonClick
is a callback which return list of all selected items on apply button click. if no item is selected then it will return empty list.final -
onItemSearch
→ SearchPredict<
T> -
The
onItemSearch
is delegate which filter the list on the basis of search field text.final - resetButtonText → String?
-
Reset Button Label
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedItemsText → String?
-
Selected items count text
final
-
selectedListData
→ List<
T> ? -
The selectedListData is used to preselect the choice chips.
It takes list of object and this list should be subset og listData
final
- themeData → FilterListThemeData?
-
Filter theme
final
-
validateRemoveItem
→ ValidateRemoveItem<
T> ? -
The
validateRemoveItem
identifies if a item should be remove or not and returns the list filtered.final -
validateSelectedItem
→ ValidateSelectedItem<
T> -
The
validateSelectedItem
identifies weather a item is selected or not.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited