display<T> static method
Future
display<T>(
- dynamic context, {
- required List<
T> listData, - List<
T> ? selectedListData, - required LabelDelegate<
T> choiceChipLabel, - required ValidateSelectedItem<
T> validateSelectedItem, - required ItemSearchDelegate<
T> onItemSearch, - required OnApplyButtonClick<
T> onApplyButtonClick, - double? height,
- double? width,
- double borderRadius = 20,
- String headlineText = "Select",
- String searchFieldHintText = "Search here",
- bool hideSelectedTextCount = false,
- bool hideSearchField = false,
- bool hideCloseIcon = false,
- bool hideheader = false,
- bool hideHeaderText = false,
- Color closeIconColor = Colors.black,
- bool barrierDismissible = true,
- bool useSafeArea = true,
- RouteSettings? routeSettings,
- bool enableOnlySingleSelection = false,
- Color backgroundColor = Colors.white,
- Color searchFieldBackgroundColor = const Color(0xfff5f5f5),
- Color applyButonTextBackgroundColor = Colors.blue,
- TextStyle? selectedChipTextStyle,
- TextStyle? unselectedChipTextStyle,
- TextStyle? controlButtonTextStyle,
- TextStyle? applyButtonTextStyle,
- TextStyle? headerTextStyle,
- TextStyle? searchFieldTextStyle,
- ChoiceChipBuilder? choiceChipBuilder,
Implementation
static Future display<T>(context,
{
/// Pass list containing all data which neeeds to filter.
required List<T> listData,
/// pass selected list of object
/// every object on selecteListData should be present in list data.
List<T>? selectedListData,
/// Display text on choice chip.
required LabelDelegate<T> choiceChipLabel,
/// identifies weather a item is selecte or not.
required ValidateSelectedItem<T> validateSelectedItem,
/// filter list on the basis of search field text.
/// When text change in search text field then return list containing that text value.
///
///Check if list has value which matches to text.
required ItemSearchDelegate<T> onItemSearch,
/// Return list of all selected items
required OnApplyButtonClick<T> onApplyButtonClick,
/// Height of the dialog
double? height,
/// Width of the dialog
double? width,
/// Border radius of dialog.
double borderRadius = 20,
/// Headline text to be display as header of dialog.
String headlineText = "Select",
/// Hint text for search field.
String searchFieldHintText = "Search here",
/// Used to hide selected text count.
bool hideSelectedTextCount = false,
/// Used to hide search field.
bool hideSearchField = false,
/// Used to hide close icon.
bool hideCloseIcon = false,
/// Used to hide header.
bool hideheader = false,
/// Used to hide header text.
bool hideHeaderText = false,
///Color of close icon
Color closeIconColor = Colors.black,
/// The `barrierDismissible` argument is used to indicate whether tapping on the barrier will dismiss the dialog.
///
/// It is true by default and can not be null.
bool barrierDismissible = true,
bool useSafeArea = true,
bool useRootNavigator = true,
RouteSettings? routeSettings,
/// if `enableOnlySingleSelection` is true then it disabled the multiple selection.
/// and enabled the single selection model.
///
/// Defautl value is [false]
bool enableOnlySingleSelection = false,
/// Background color of dialog box.
Color backgroundColor = Colors.white,
/// Background color for search field.
Color searchFieldBackgroundColor = const Color(0xfff5f5f5),
/// Background color for Apply button.
Color applyButonTextBackgroundColor = Colors.blue,
/// TextStyle for chip when selected.
TextStyle? selectedChipTextStyle,
/// TextStyle for chip when not selected.
TextStyle? unselectedChipTextStyle,
/// TextStyle for [All] and [Reset] button text.
TextStyle? controlButtonTextStyle,
/// TextStyle for [Apply] button.
TextStyle? applyButtonTextStyle,
/// TextStyle for header text.
TextStyle? headerTextStyle,
/// TextStyle for search field text.
TextStyle? searchFieldTextStyle,
/// The `choiceChipBuilder` is a builder to design custom choice chip.
ChoiceChipBuilder? choiceChipBuilder}) async {
if (height == null) {
height = MediaQuery.of(context).size.height * .8;
}
if (width == null) {
width = MediaQuery.of(context).size.width;
}
await showDialog(
context: context,
barrierDismissible: barrierDismissible,
routeSettings: routeSettings,
useRootNavigator: useRootNavigator,
useSafeArea: useSafeArea,
builder: (BuildContext context) {
return Dialog(
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
height: height,
width: width,
color: Colors.transparent,
child: FilterListWidget(
listData: listData,
choiceChipLabel: choiceChipLabel,
width: width,
height: height,
hideHeader: hideheader,
borderRadius: borderRadius,
headlineText: headlineText,
onItemSearch: onItemSearch,
closeIconColor: closeIconColor,
headerTextStyle: headerTextStyle,
backgroundColor: backgroundColor,
selectedListData: selectedListData,
onApplyButtonClick: onApplyButtonClick,
validateSelectedItem: validateSelectedItem,
hideSelectedTextCount: hideSelectedTextCount,
hideCloseIcon: hideCloseIcon,
hideHeaderText: hideHeaderText,
hideSearchField: hideSearchField,
choiceChipBuilder: choiceChipBuilder,
searchFieldHintText: searchFieldHintText,
applyButtonTextStyle: applyButtonTextStyle,
searchFieldTextStyle: searchFieldTextStyle,
selectedChipTextStyle: selectedChipTextStyle,
controlButtonTextStyle: controlButtonTextStyle,
unselectedChipTextStyle: unselectedChipTextStyle,
enableOnlySingleSelection: enableOnlySingleSelection,
searchFieldBackgroundColor: searchFieldBackgroundColor,
applyButonTextBackgroundColor: applyButonTextBackgroundColor,
),
),
);
},
);
}