Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Android - Country code bottomsheet picker in Jetpack Compose

License

NotificationsYou must be signed in to change notification settings

canopas/compose-country-picker

Repository files navigation

Country code bottom sheet picker in Jetpack Compose with Search functionality.

How to add in your project

Available onMaven Central.

Add the dependency

 implementation'com.canopas.jetcountrypicker:jetcountrypicker:1.0.9'

How to use ?

var openBottomSheet by rememberSaveable { mutableStateOf(false) }var selectedCountry by remember { mutableStateOf<Country?>(null) }Box {CountryTextField(            label= stringResource(R.string.select_country_text),            modifier=Modifier                .fillMaxWidth()                .padding(top=50.dp, start=40.dp, end=40.dp),            selectedCountry= selectedCountry,            defaultCountry= countryList(LocalContext.current).firstOrNull { it.code=="IN" },            onShowCountryPicker= {                openBottomSheet=true            }, isPickerVisible= openBottomSheet        )    }if (openBottomSheet) {CountryPickerBottomSheet(            bottomSheetTitle= {Text(                    modifier=Modifier                        .fillMaxWidth()                        .padding(16.dp),                    text= stringResource(R.string.select_country_text),                    textAlign=TextAlign.Center,                    fontWeight=FontWeight.Bold,                    fontSize=20.sp                )            },            containerColor=Color.White,            onItemSelected= {                selectedCountry= it                openBottomSheet=false            }, onDismissRequest= {                openBottomSheet=false            }        )    }

Demo

Sample app demonstrates how simple the usage of the library actually is.

Bugs and Feedback

For bugs, questions and discussions please use theGithub Issues.

Credits

JetCountryPicker is owned and maintained by theCanopas team. You can follow them on X at@canopassoftware for project updates and releases.

Licence

Copyright 2022 Canopas Software LLPLicensed 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.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.

Packages

No packages published

Contributors6

Languages


[8]ページ先頭

©2009-2025 Movatter.jp