showCountryCodePickerDialog method

void showCountryCodePickerDialog()

Implementation

void showCountryCodePickerDialog() {
  if (!UniversalPlatform.isAndroid && !UniversalPlatform.isIOS) {
    showDialog(
      barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5),
      // backgroundColor: widget.backgroundColor ?? Colors.transparent,
      context: context,
      builder: (context) => Center(
        child: Container(
          constraints: BoxConstraints(maxHeight: 500, maxWidth: 400),
          child: Dialog(
            child: SelectionDialog(
              elements,
              favoriteElements,
              showCountryOnly: widget.showCountryOnly,
              emptySearchBuilder: widget.emptySearchBuilder,
              searchDecoration: widget.searchDecoration,
              searchStyle: widget.searchStyle,
              textStyle: widget.dialogTextStyle,
              boxDecoration: widget.boxDecoration,
              showFlag: widget.showFlagDialog != null
                  ? widget.showFlagDialog
                  : widget.showFlag,
              flagWidth: widget.flagWidth,
              size: widget.dialogSize,
              backgroundColor: widget.dialogBackgroundColor,
              barrierColor: widget.barrierColor,
              hideSearch: widget.hideSearch,
              closeIcon: widget.closeIcon,
              flagDecoration: widget.flagDecoration,
            ),
          ),
        ),
      ),
    ).then((e) {
      if (e != null) {
        setState(() {
          selectedItem = e;
        });

        _publishSelection(e);
      }
    });
  } else {
    showMaterialModalBottomSheet(
      barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5),
      backgroundColor: widget.backgroundColor ?? Colors.transparent,
      context: context,
      builder: (context) => Center(
        child: SelectionDialog(
          elements,
          favoriteElements,
          showCountryOnly: widget.showCountryOnly,
          emptySearchBuilder: widget.emptySearchBuilder,
          searchDecoration: widget.searchDecoration,
          searchStyle: widget.searchStyle,
          textStyle: widget.dialogTextStyle,
          boxDecoration: widget.boxDecoration,
          showFlag: widget.showFlagDialog != null
              ? widget.showFlagDialog
              : widget.showFlag,
          flagWidth: widget.flagWidth,
          flagDecoration: widget.flagDecoration,
          size: widget.dialogSize,
          backgroundColor: widget.dialogBackgroundColor,
          barrierColor: widget.barrierColor,
          hideSearch: widget.hideSearch,
          closeIcon: widget.closeIcon,
        ),
      ),
    ).then((e) {
      if (e != null) {
        setState(() {
          selectedItem = e;
        });

        _publishSelection(e);
      }
    });
  }
}