33<p align =" center " >
44 <a href =" https://opensource.org/licenses/Apache-2.0 " ><img alt =" License " src =" https://img.shields.io/badge/License-Apache%202.0-blue.svg " /></a >
55 <a href =" https://android-arsenal.com/api?level=21 " ><img alt =" API " src =" https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat " /></a >
6- <a href =" https://github.com/yourusername/ComposePicker /actions/workflows/android.yml " ><img alt="Build Status"
7- src="https://github.com/yourusername/ComposePicker /actions/workflows/android.yml/badge.svg"/> </a >
6+ <a href =" https://github.com/androidpoet/CountryPicker /actions/workflows/android.yml " ><img alt="Build Status"
7+ src="https://github.com/androidpoet/CountryPicker /actions/workflows/android.yml/badge.svg"/> </a >
88</p >
99
1010<p align =" center " >
11- 🌍 Compose Country Picker is a lightweight country picker library for Compose Multiplatform. It provides an easy-to-use and customizable component for selecting countries in your Compose Multiplatform applications.
11+ 🌍A lightweight, customizable country selection component for Compose Multiplatform applications
1212</p >
1313
14+ <p align =" center " >
15+ <img src =" https://github.com/user-attachments/assets/be09bde9-f9eb-4033-92ba-2ee4419807bc " alt =" Country Picker Demo " width =" 300 " />
16+ </p >
17+
18+
19+
1420## Features
1521
1622- 🌐 Supports multiple platforms (Android, iOS, Desktop)
@@ -33,11 +39,11 @@ For Kotlin Multiplatform, add the dependency below to your **module**'s `build.g
3339
3440``` kotlin
3541sourceSets {
36- val commonMain by getting {
37- dependencies {
38- implementation(" io.github.androidpoet.countrypicker:0.1.1" )
39- }
42+ val commonMain by getting {
43+ dependencies {
44+ implementation(" io.github.androidpoet.countrypicker:0.1.1" )
4045 }
46+ }
4147}
4248```
4349
@@ -48,18 +54,30 @@ Here's a basic example of how to use the ComposePicker in your Compose Multiplat
4854``` kotlin
4955@Composable
5056fun CountryPickerExample () {
51- var selectedCountry by remember { mutableStateOf<Country ?>(null ) }
52-
53- ComposePicker (
54- onCountrySelected = { country ->
55- selectedCountry = country
56- }
57- )
58-
59- // Display selected country
60- selectedCountry?.let {
61- Text (" Selected: ${it.name} (${it.code} )" )
57+ var showBottomSheet by remember { mutableStateOf(false ) }
58+ var currantCountry by remember { mutableStateOf(" " ) }
59+
60+ CountryPicker (
61+ onCountryChanged = {
62+ currantCountry = it.name + " " + it.flag + " " + it.alpha2
63+ },
64+ onDismiss = {
65+ showBottomSheet = false
66+ },
67+ showBottomSheet = showBottomSheet,
68+ )
69+
70+ Box (modifier = Modifier .fillMaxSize(), contentAlignment = Alignment .Center ) {
71+ Column {
72+ Text (currantCountry, fontSize = 20 .sp)
73+
74+ Button (onClick = {
75+ showBottomSheet = ! showBottomSheet
76+ }) {
77+ Text (" open Country Picker" , fontSize = 15 .sp)
78+ }
6279 }
80+ }
6381}
6482```
6583
@@ -68,16 +86,21 @@ fun CountryPickerExample() {
6886ComposePicker offers various customization options:
6987
7088``` kotlin
71- ComposePicker (
72- onCountrySelected = { country ->
73- // Handle selection
74- },
75- searchEnabled = true ,
76- showFlags = true ,
77- itemBackgroundColor = Color .White ,
78- textColor = Color .Black ,
79- searchBarColor = Color .LightGray
89+
90+ CountryPicker (
91+ onCountryChanged = {
92+ currantCountry = it.name + " " + it.flag + " " + it.alpha2
93+ },
94+ onDismiss = {
95+ showBottomSheet = false
96+ },
97+ showBottomSheet = showBottomSheet,
98+ searchEnabled = false ,
99+ itemBackgroundColor = Color .White ,
100+ textColor = Color .Black ,
101+ searchBarColor = Color .LightGray
80102)
103+
81104```
82105
83106## Contributing
0 commit comments