showCountryCodePickerDialog function

Future<CountryCode?> showCountryCodePickerDialog({
  1. required BuildContext context,
  2. void onCountryCodeTap(
    1. CountryCode code
    )?,
  3. EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 28, vertical: 100),
  4. CustomizationBuilders? customizationBuilders,
  5. Color backgroundColor = Colors.white,
  6. double elevation = 0.0,
  7. Color? shadowColor,
  8. Color? surfaceTintColor,
  9. Color barrierColor = Colors.black54,
  10. bool barrierDismissible = true,
  11. bool useRootNavigator = true,
  12. ShapeBorder shape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(24))),
  13. double maxSize = 1,
  14. double initialSize = 0.5,
  15. double minSize = 0.5,
  16. bool snap = true,
  17. String? countryNameLocale,
})

Implementation

Future<CountryCode?> showCountryCodePickerDialog({
  required BuildContext context,
  void Function(CountryCode code)? onCountryCodeTap,
  EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 28, vertical: 100),
  CustomizationBuilders? customizationBuilders,
  Color backgroundColor = Colors.white,
  double elevation = 0.0,
  Color? shadowColor,
  Color? surfaceTintColor,
  Color barrierColor = Colors.black54,
  bool barrierDismissible = true,
  bool useRootNavigator = true,
  ShapeBorder shape = const RoundedRectangleBorder(
    borderRadius: BorderRadius.all(Radius.circular(24)),
  ),
  double maxSize = 1,
  double initialSize = 0.5,
  double minSize = 0.5,
  bool snap = true,
  String? countryNameLocale,
}) async {
  return await showDialog(
    barrierColor: barrierColor,
    barrierDismissible: barrierDismissible,
    useRootNavigator: useRootNavigator,
    context: context,
    builder: (context) => Padding(
      padding: margin,
      child: Material(
        shape: shape,
        elevation: elevation,
        surfaceTintColor: surfaceTintColor,
        shadowColor: shadowColor,
        color: backgroundColor,
        child: SafeArea(
          child: CountryCodeSelector(
            shape: shape,
            backgroundColor: backgroundColor,
            countryNameLocale: countryNameLocale,
            customizationBuilders: customizationBuilders,
            onCountryCodeTap: onCountryCodeTap,
          ),
        ),
      ),
    ),
  );
}