showDropDownMenu method

void showDropDownMenu()

Implementation

void showDropDownMenu() {
  /// Find RenderBox object
  RenderBox renderBox =
      (widget.child.key as GlobalKey).currentContext?.findRenderObject() as RenderBox;
  Offset position = renderBox.localToGlobal(Offset.zero);

  if (widget.children.isNotEmpty) {
    showCupertinoDialog<void>(
      context: context,
      barrierDismissible: false,
      builder: (_) {
        return _DropDownMenuContent<T>(
          maxHeight: widget.maxHeight,
          radius: widget.radius,
          space: widget.space,
          showMode: widget.showMode,
          itemWidgetBuilder: widget.itemWidgetBuilder,
          mode: widget.mode,
          position: position,
          size: renderBox.size,
          onChanged: widget.onChanged,
          children: widget.children,
          valueNotifier: widget.valueNotifier,
          decoration: widget.decoration,
          exit: widget.exit,
          isExpanded: widget.isExpanded,
          showOtherAndItsTextField: widget.showOtherAndItsTextField,
          showSeparator: widget.showSeparator,

          /// Search
          showSearchTextField: widget.showSearchTextField,
          searchDecoration: widget.searchDecoration,
          searchValidator: widget.searchValidator,
          searchTextFormFieldStyle: widget.searchTextFormFieldStyle,

          itemPadding: widget.itemPadding,
          itemOverlayColor: widget.itemOverlayColor,
          selectedItemBackgroundColor: widget.selectedItemBackgroundColor,
          itemBackgroundColor: widget.itemBackgroundColor,
          showItemSelectedBackgroundColor: widget.showSelectedItemBackgroundColor,
          itemMargin: widget.itemMargin,
          itemHeight: widget.itemHeight,
          separatorColor: widget.separatorColor,
          listThumbVisibility: widget.listThumbVisibility,

          /// Other
          onOtherChanged: widget.onOtherChanged,
          otherController: widget.otherController,
          otherDecoration: widget.otherDecoration,
          otherValidator: widget.otherValidator,
          otherOnFieldSubmitted: widget.otherOnFieldSubmitted,
          otherHeight: widget.otherHeight,
          otherMargin: widget.otherMargin,
          other: widget.other,
          itemHighLightBuilder: widget.itemHighLightBuilder,
          animationDuration: widget.animationDuration,
          searchNoDataWidget: widget.searchNoDataWidget,
        );
      },
    );
  } else {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text(
          widget.emptyListMessage ?? 'MiraiDropDown: Empty Children!',
        ),
      ),
    );
  }
}