Skip to content

Commit 4ebaffa

Browse files
committed
README.md updated
1 parent 02a0c59 commit 4ebaffa

File tree

3 files changed

+53
-33
lines changed

3 files changed

+53
-33
lines changed

README.md

Lines changed: 50 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
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
3541
sourceSets {
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
5056
fun 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() {
6886
ComposePicker 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

countrypicker/src/commonMain/kotlin/io/androidpoet/countrypicker/CountryListBottomSheet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ internal fun CountryListBottomSheet(
5656
searchEnabled: Boolean,
5757
itemBackgroundColor: Color,
5858
textColor: Color,
59-
searchBarBorderColor: Color
59+
searchBarBorderColor: Color,
6060
) {
6161
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
6262
val coroutineScope = rememberCoroutineScope()
@@ -139,7 +139,7 @@ internal fun CountryListBottomSheet(
139139
}
140140
},
141141
itemBackgroundColor = itemBackgroundColor,
142-
textColor = textColor
142+
textColor = textColor,
143143
)
144144
}
145145
}

countrypicker/src/commonMain/kotlin/io/androidpoet/countrypicker/CountryPicker.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public fun CountryPicker(
3333
searchEnabled: Boolean = true,
3434
itemBackgroundColor: Color = Color.White,
3535
textColor: Color = Color.Black,
36-
searchBarColor: Color = Color.LightGray
36+
searchBarColor: Color = Color.LightGray,
3737
) {
3838
var state by rememberCountryPickerState()
3939
val coroutineScope = rememberCoroutineScope()
@@ -67,6 +67,3 @@ public fun CountryPicker(
6767
searchBarBorderColor = searchBarColor,
6868
)
6969
}
70-
71-
72-

0 commit comments

Comments
 (0)