Skip to content

ParveshSandila/CountryCodeChooser

Repository files navigation

Country Code Chooser (Jetpack Compose)

GitHub stars GitHub issues

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
        ),
    defaultCountry = "CA",
    countryCodeType = CountryCodeType.FLAG,
    onCountySelected = { countryCodeWithoutPrefix, iso2Code, iso3Code ->
        Log.d("SelectedCountry","$countryCodeWithoutPrefix, $iso2Code, $iso3Code")
    }
)

Preview:-

Jetpack compose Lazy column example Jetpack compose Lazy column example Jetpack compose Lazy column example Jetpack compose Lazy column example Jetpack compose Lazy column example

Like this? Spread ❤️ by adding a ⭐ on this project.

Features:-

  • Easy to use
  • Customizable
  • Three different view options : Text with prefix, Text without prefix, and Only Flag
  • Can search using country name or code
  • Support languages:
    • Arabic
    • Chinese
    • English
    • French
    • German
    • Hindi
    • Italian
    • Japanese
    • Korean
    • Portuguese
    • Punjabi
    • Spanish

Other languages 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.2'
}

Click here to check on jitpack.io

Language Contributions:-

Contributions

Contributions to the CountryCodeChooser library are highly appreciated! If you have any bug fixes, new features, or improvements to offer, please feel free to submit a pull request. Together, we can make this library even better.

Contact

For any inquiries or support regarding the library, you can reach out to the author, Parvesh Sandila, via email at [email protected].

Let the CountryCodeChooser Android Library enhance your app with seamless country code selection. Download it now and give your users a convenient and efficient experience.

#AndroidDevelopment #CountryCodeSelection #OpenSourceLibrary #CountryCodeChooser #JetpackCompose #ComposeLibraray

License

Apache Version 2.0

Copyright (C) 2023 Parvesh Sandila

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.