From 9d46711edf57b302264e4f6f23e7814f68c4297c Mon Sep 17 00:00:00 2001 From: Naveen Kumar Kuppan Date: Tue, 30 May 2023 20:32:07 +0530 Subject: [PATCH] Update README.md --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 9eb668a..46462f2 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,8 @@ Simple steps to achieve. Call country search activity with result. Starting country selection as activity based +## XML Way + Calling as an activity: -------------- @@ -143,6 +145,35 @@ supportFragmentManager.openCountrySelectionBottomSheet { } ``` +## Compose Way + +Calling as a compose dialog: +-------------- + +Call the dialog inside compose like below. It will open the country selection as dialog with search option. Handle the dialog dismiss on the callback. + +```kotlin +import com.github.nkuppan.countrycompose.presentation.country.CountrySelectionDialog + +CountrySelectionDialog(onDismissRequest = {/*TODO Close dialog*/}) { country -> + message = "Selected Country ${country.name} & ${country.countryCode}" +} +``` + +Calling as a compose page: +-------------- + +Call the page inside compose like below. It will open the country selection as new page with search option. Handle the page backpress on the callback. +You can use this inside the composable using navigation-compose as well. + +```kotlin +import com.github.nkuppan.countrycompose.presentation.country.CountrySelectionPage + +CountrySelectionPage(onDismissRequest = {/*TODO Close page*/}) { country -> + message = "Selected Country ${country.name} & ${country.countryCode}" +} +``` + ## License [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)