Languages
Compose Persian Date Picker
is an android library that allows developers to easily add a Jalali Date Picker to their apps.
- Easy integration with Jetpack Compose.
- scrollable
- Lightweight and efficient.
- Material Design 3
Here's a quick example of how to use the library:
- Add the JitPack repository to your project-level build.gradle or settings.gradle file:
settings.gradle.kts:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// add the following:
maven { url = uri("https://jitpack.io") }
}
}
- Add the library dependency to your app-level build.gradle file:
dependencies {
implementation("com.github.arzhangap:compose-persian-date-picker:1.0.0")
}
// remember state val datePickerState = rememberPersianDatePickerState()
// Consume the state to the composable PersianDatePicker(persianDatePickerState = datePickerState)
// Open/Close Dialog using toggleDialog() Button(onClick = { datePickerState.toggleDialog()}) { Text(text = "Open") }
// you can get chosenDate and formatted string of date using chosenDate and string() function
// chosenDate is nullable, you can set default string for null chosenDate as a parameter to string("message") function.
Text(text = calenderState.chosenDate.string())
Customize DatePicker using its parameters.
PersianDatePicker(
...
dialogColor = MaterialTheme.colorScheme.surfaceContainer,
headerBackgroundColor = Color.Unspecified,
textColor = MaterialTheme.colorScheme.onSurface,
dayIconColor = Color.Transparent,
selectedDayIconColor = MaterialTheme.colorScheme.primary,
textColorHighlight = Color.Unspecified,
actionBtnTextColor = MaterialTheme.colorScheme.primary,
dayOfWeekLabelColor = MaterialTheme.colorScheme.primary,
fontFamily = FontFamily.Default,
actionBtnFontSize = 16.sp
)
Contributions are welcome! To get started:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a clear description of your changes.
Please ensure your code follows our code style.
if you are using my project and like it, you can donate me a coffee or give me a star ⭐.
Copyright 2024 arzhangap (Arzhang Alvandi Pour)
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.