showDropDown method

dynamic showDropDown({
  1. String title = "",
  2. double heightView = 300,
  3. List<OptionItem> items = const [],
  4. bool isSearch = false,
  5. CallbackData? callback,
  6. String hindText = "",
  7. Widget? childPopup,
  8. OptionItem? initItem,
})

Implementation

showDropDown({
  String title = "",
  double heightView = 300,
  List<OptionItem> items = const [],
  // required this.context,
  bool isSearch = false,
  CallbackData? callback,
  String hindText = "",
  Widget? childPopup,
  OptionItem? initItem,
}) {
  FocusScope.of(context).unfocus();
  var height = heightView;

  if (items.isNotEmpty) {
    height = (items.length * 42 + 150);
  }
  if (height <= 330) {
    height = 330;
  }
  if (height >= Get.height - 100) {
    height = Get.height - 100;
  }
  showModalBottomSheet<void>(
      backgroundColor: Colors.transparent,
      isScrollControlled: true,
      isDismissible: true,
      context: context,
      builder: (BuildContext context) {
        return SizedBox(
          height: height,
          child: ViewSearchContent(
            isSearch: isSearch,
            title: title,
            childPopup: childPopup,
            items: items,
            callback: (value) {
              if (callback != null) {
                callback(value);
              }
              // setState(() {});
            },
            listData: const [],
          ),
        );
      });
}