buildListViewMultiSelectBuilder function
Widget
buildListViewMultiSelectBuilder({
- Key? key,
- required BuildContext context,
- required List<
CustomDropDownModel> listOfValues, - required List<
CustomDropDownModel> selectedValue, - ScrollController? scrollController,
- bool isPaginationLoader = false,
- required dynamic callback(),
Common widget for list view builder Multi select
Implementation
Widget buildListViewMultiSelectBuilder(
{Key? key,
required BuildContext context,
required List<CustomDropDownModel> listOfValues,
required List<CustomDropDownModel> selectedValue,
ScrollController? scrollController,
bool isPaginationLoader = false,
required Function(CustomDropDownModel) callback}) {
return SizedBox(
key: key,
height: CommonConfigurationDropDown.of(context).dropdownHeight,
child: ListView.builder(
controller: scrollController,
itemCount: listOfValues.length,
shrinkWrap: true,
itemBuilder: (context, index) {
CustomDropDownModel model = listOfValues[index];
final localContact = selectedValue.where((element) {
return (element.id == model.id &&
element.valueDisplay == model.valueDisplay);
}).toList();
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
buildRowItemForList(
context: context,
model: model,
selectedModel:
localContact.isNotEmpty ? localContact.first : null,
callback: (p0) {
callback(p0);
}),
if (isPaginationLoader && ((listOfValues.length - 1) == index))
Material(
child: Center(
key: UniqueKey(),
child: const CircularProgressIndicator()))
],
);
},
),
);
}