Site icon Android Tutorial Online

Country code chooser in Jetpack compose

Country code chooser in Jetpack compose

Country Code Chooser (Jetpack Compose)

The Android library is designed to provide a user-friendly interface for selecting country codes from various countries. The library is specifically built to work seamlessly with Android Jetpack Compose, allowing developers to quickly and easily integrate it into their projects.

One of the standout features of this library is its built-in support for displaying a flag for each country. This is especially useful when building international apps where users may not be familiar with the country codes of other regions.

The library offers a range of customization options, allowing developers to tailor the user interface to match their app’s design. For example, developers can customize the TextFiled, font styles, and sizes of the text.

Example Code:-

 CountryCodeChooser(
    modifier = Modifier
        .weight(1.5f)
        .height(55.dp)
        .border(
           width = 1.dp,
           shape = RoundedCornerShape(5.dp),
           color = Color.Gray
        ),
    defaultCountryCode = "1",
    countryCodeType = CountryCodeType.FLAG,
    onCountyCodeSelected = { code, codeWithPrefix ->
         Log.d("SelectedCountry","$code, $codeWithPrefix")
    }
)

Preview:-

Features:-

Other laguages coming soon

How to use:-

To get a Git project into your build: Step 1. Add the JitPack repository to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.ParveshSandila:CountryCodeChooser:1.0'
}

Click here to check on jitpack.io

GitHub

View Github

Exit mobile version