buildListViewSingleSelectBuilder function

Widget buildListViewSingleSelectBuilder({
  1. required BuildContext context,
  2. required List<CustomDropDownModel> listOfValues,
  3. CustomDropDownModel? selectedValue,
  4. ScrollController? scrollController,
  5. bool isPaginationLoader = false,
  6. required dynamic callback(
    1. CustomDropDownModel
    ),
})

Common widget for list view builder Single select

Implementation

Widget buildListViewSingleSelectBuilder(
    {required BuildContext context,
    required List<CustomDropDownModel> listOfValues,
    CustomDropDownModel? selectedValue,
    ScrollController? scrollController,
    bool isPaginationLoader = false,
    required Function(CustomDropDownModel) callback}) {
  return SizedBox(
    height: CommonConfigurationDropDown.of(context).dropdownHeight,
    child: ListView.builder(
      controller: scrollController,
      itemCount: listOfValues.length,
      shrinkWrap: true,
      itemBuilder: (context, index) {
        CustomDropDownModel model = listOfValues[index];
        return Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: [
            buildRowItemForList(
                context: context,
                model: model,
                selectedModel: selectedValue,
                callback: (p0) {
                  callback(p0);
                }),
            if (isPaginationLoader && ((listOfValues.length - 1) == index))
              Material(
                  child: Center(
                      key: UniqueKey(),
                      child: const CircularProgressIndicator()))
          ],
        );
      },
    ),
  );
}