showCountrySelectorBottomSheet method

Future<Country?> showCountrySelectorBottomSheet(
  1. BuildContext context,
  2. List<Country> countries
)

shows a Dialog with list countries if the PhoneInputSelectorType.BOTTOM_SHEET is selected

Implementation

Future<Country?> showCountrySelectorBottomSheet(
    BuildContext context, List<Country> countries) {
  return showModalBottomSheet(
    context: context,
    clipBehavior: Clip.hardEdge,
    isScrollControlled: isScrollControlled,
    backgroundColor: Colors.transparent,
    shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.only(
            topLeft: Radius.circular(12), topRight: Radius.circular(12))),
    builder: (BuildContext context) {
      return Stack(children: [
        GestureDetector(
          onTap: () => Navigator.pop(context),
        ),
        DraggableScrollableSheet(
          builder: (BuildContext context, ScrollController controller) {
            return Container(
              decoration: ShapeDecoration(
                color: Theme.of(context).canvasColor,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(12),
                    topRight: Radius.circular(12),
                  ),
                ),
              ),
              child: CountrySearchListWidget(
                countries,
                locale,
                searchBoxDecoration: searchBoxDecoration,
                scrollController: controller,
                showFlags: selectorConfig.showFlags,
                useEmoji: selectorConfig.useEmoji,
                autoFocus: autoFocusSearchField,
              ),
            );
          },
        ),
      ]);
    },
  );
}