showCountryCodePickerSheet function

Future<CountryCode?> showCountryCodePickerSheet({
  1. required BuildContext context,
  2. void onCountryCodeTap(
    1. CountryCode code
    )?,
  3. CustomizationBuilders? customizationBuilders,
  4. Color backgroundColor = Colors.white,
  5. double maxSize = 1,
  6. double initialSize = 0.5,
  7. double minSize = 0.5,
  8. bool snap = true,
  9. ShapeBorder shape = const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24))),
  10. String? countryNameLocale,
})

Implementation

Future<CountryCode?> showCountryCodePickerSheet({
  required BuildContext context,
  void Function(CountryCode code)? onCountryCodeTap,
  CustomizationBuilders? customizationBuilders,
  Color backgroundColor = Colors.white,
  double maxSize = 1,
  double initialSize = 0.5,
  double minSize = 0.5,
  bool snap = true,
  ShapeBorder shape = const RoundedRectangleBorder(
    borderRadius: BorderRadius.vertical(
      top: Radius.circular(24),
    ),
  ),
  String? countryNameLocale,
}) async {
  return await showModalBottomSheet(
    isScrollControlled: true,
    useSafeArea: true,
    backgroundColor: backgroundColor,
    shape: shape,
    context: context,
    builder: (context) => DraggableScrollableSheet(
      expand: false,
      maxChildSize: maxSize,
      initialChildSize: UtilsFunctions.manageSheetSize(
          context: context,
          initialSize: initialSize,
          maxSize: maxSize,
          minSize: minSize),
      minChildSize: minSize,
      snap: snap,
      builder: (context, scrollController) {
        return CountryCodeSelector(
          shape: shape,
          countryNameLocale: countryNameLocale,
          scrollController: scrollController,
          customizationBuilders: customizationBuilders,
          backgroundColor: backgroundColor,
          onCountryCodeTap: onCountryCodeTap,
        );
      },
    ),
  );
}