display<T extends Object> static method
Future
display<T extends Object>(
- BuildContext context, {
- FilterListThemeData? themeData,
- required List<
T> listData, - List<
T> ? selectedListData, - required LabelDelegate<
T> choiceChipLabel, - required ValidateSelectedItem<
T> validateSelectedItem, - ValidateRemoveItem<
T> ? validateRemoveItem, - required SearchPredict<
T> onItemSearch, - required OnApplyButtonClick<
T> onApplyButtonClick, - double? height,
- double? width,
- double borderRadius = 20,
- String? headlineText,
- bool hideSelectedTextCount = false,
- bool hideSearchField = false,
- bool hideCloseIcon = false,
- Widget? headerCloseIcon,
- bool hideHeader = false,
- bool barrierDismissible = true,
- bool useSafeArea = true,
- RouteSettings? routeSettings,
- bool enableOnlySingleSelection = false,
- Color backgroundColor = Colors.white,
- String? applyButtonText = 'Apply',
- String? resetButtonText = 'Reset',
- String? allButtonText = 'All',
- String? selectedItemsText = 'selected items',
- EdgeInsets? insetPadding = const EdgeInsets.symmetric(horizontal: 32.0, vertical: 24.0),
- ChoiceChipBuilder? choiceChipBuilder,
- List<
ControlButtonType> ? controlButtons,
Implementation
static Future display<T extends Object>(
BuildContext context, {
/// Filter theme
FilterListThemeData? themeData,
/// Pass list containing all data which needs to filter.
required List<T> listData,
/// pass selected list of object
/// every object on selectedListData should be present in list data.
List<T>? selectedListData,
/// Display text on choice chip.
required LabelDelegate<T> choiceChipLabel,
/// identifies weather a item is selected or not.
required ValidateSelectedItem<T> validateSelectedItem,
/// The `validateRemoveItem` identifies if a item should be remove or not and returns the list filtered.
ValidateRemoveItem<T>? validateRemoveItem,
/// 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 SearchPredict<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,
/// 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,
/// Widget to close the dialog.
///
/// If widget is not provided then default close icon will be used.
final Widget? headerCloseIcon,
/// Used to hide header.
bool hideHeader = false,
/// 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.
///
/// Default value is [false]
bool enableOnlySingleSelection = false,
/// Background color of dialog box.
Color backgroundColor = Colors.white,
/// Apply Button Label
String? applyButtonText = 'Apply',
/// Reset Button Label
String? resetButtonText = 'Reset',
/// All Button Label
String? allButtonText = 'All',
/// Selected items count text
String? selectedItemsText = 'selected items',
/// The amount of padding added to [MediaQueryData.viewInsets] on the outside of the dialog.
/// This defines the minimum space between the screen's edges and the dialog.
///
/// Defaults to EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0).
EdgeInsets? insetPadding =
const EdgeInsets.symmetric(horizontal: 32.0, vertical: 24.0),
/// The `choiceChipBuilder` is a builder to design custom choice chip.
ChoiceChipBuilder? choiceChipBuilder,
/// {@macro control_buttons}
List<ControlButtonType>? controlButtons,
}) async {
height ??= MediaQuery.of(context).size.height * .5;
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,
insetPadding: insetPadding,
child: Container(
height: height,
width: width,
color: Colors.transparent,
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(themeData?.borderRadius ?? 20),
),
child: FilterListWidget(
themeData: themeData,
listData: listData,
choiceChipLabel: choiceChipLabel,
hideHeader: hideHeader,
headlineText: headlineText,
onItemSearch: onItemSearch,
backgroundColor: backgroundColor,
selectedListData: selectedListData,
onApplyButtonClick: onApplyButtonClick,
validateSelectedItem: validateSelectedItem,
hideSelectedTextCount: hideSelectedTextCount,
hideCloseIcon: hideCloseIcon,
headerCloseIcon: headerCloseIcon,
hideSearchField: hideSearchField,
choiceChipBuilder: choiceChipBuilder,
enableOnlySingleSelection: enableOnlySingleSelection,
selectedItemsText: selectedItemsText,
applyButtonText: applyButtonText,
resetButtonText: resetButtonText,
allButtonText: allButtonText,
validateRemoveItem: validateRemoveItem,
controlButtons: controlButtons ??
[ControlButtonType.All, ControlButtonType.Reset],
),
),
),
);
},
);
}