Chaintech-Network / compose_multiplatform_date_time_picker

Apache License 2.0
102 stars 8 forks source link

Maven Central Kotlin Compose Multiplatform License

badge-android badge-ios badge-desktop

Easy Date Picker

Easy Date Picker is a Kotlin Multiplatform library for selecting date and time in your Android or iOS App. It offers a customizable UI to use in your multiplatform projects.

Hero-image 2 2

Installation

Add the dependency to your build.gradle.kts file:

commonMain.dependencies {
    implementation("network.chaintech:kmp-date-time-picker:1.0.6")
}

Usage

WheelDatePickerView

A composable for selecting dates using a wheel picker.

Screenshots

Image 3     Image 2     Image 1
WheelDatePickerView( 
     modifier: Modifier = Modifier, 
     showDatePicker: Boolean = false, 
     title: String = "Due Date", 
     doneLabel: String = "Done", 
     titleStyle: TextStyle = LocalTextStyle.current, 
     doneLabelStyle: TextStyle = LocalTextStyle.current, 
     startDate: LocalDate = LocalDate.now(), 
     minDate: LocalDate = LocalDate.MIN(), 
     maxDate: LocalDate = LocalDate.MAX(), 
     yearsRange: IntRange? = IntRange(1922, 2122), 
     height: Dp, 
     rowCount: Int = 3, 
     showShortMonths: Boolean = false,
     showMonthAsNumber: Boolean = false,
     dateTextStyle: TextStyle = MaterialTheme.typography.titleMedium, 
     dateTextColor: Color = LocalContentColor.current, 
     hideHeader: Boolean = false, 
     containerColor: Color = Color.White, 
     shape: Shape = RoundedCornerShape(10.dp), 
     dateTimePickerView: DateTimePickerView = DateTimePickerView.BOTTOM_SHEET_VIEW, 
     selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(), 
     dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() }, 
     onDoneClick: (snappedDate: LocalDate) -> Unit = {}, 
     onDateChangeListener: (snappedDate: LocalDate) -> Unit = {}, 
     onDismiss: () -> Unit = {}, 
) 
WheelDatePicker( 
     modifier: Modifier = Modifier, 
     title: String = "Due Date", 
     doneLabel: String = "Done", 
     titleStyle: TextStyle = LocalTextStyle.current, 
     doneLabelStyle: TextStyle = LocalTextStyle.current, 
     startDate: LocalDate = LocalDate.now(), 
     minDate: LocalDate = LocalDate.MIN(), 
     maxDate: LocalDate = LocalDate.MAX(), 
     yearsRange: IntRange? = IntRange(1922, 2122), 
     height: Dp = 128.dp, 
     rowCount: Int = 3, 
     showShortMonths: Boolean = false,
     showMonthAsNumber: Boolean = false,
     dateTextStyle: TextStyle = MaterialTheme.typography.titleMedium, 
     dateTextColor: Color = LocalContentColor.current, 
     hideHeader: Boolean = false, 
     selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(), 
     onDoneClick: (snappedDate: LocalDate) -> Unit = {}, 
     onDateChangeListener: (snappedDate: LocalDate) -> Unit = {}, 
) 

WheelDateTimePickerView

A composable for selecting date & time using a wheel picker.

Screenshots

Image 3     Image 2     Image 1
WheelDateTimePickerView( 
     modifier: Modifier = Modifier, 
     showDatePicker: Boolean = false, 
     title: String = "DATE & TIME PICKER", 
     doneLabel: String = "Done", 
     timeFormat: TimeFormat = TimeFormat.HOUR_24, 
     titleStyle: TextStyle = LocalTextStyle.current, 
     doneLabelStyle: TextStyle = LocalTextStyle.current, 
     startDate: LocalDateTime = LocalDateTime.now(), 
     minDate: LocalDateTime = LocalDateTime.MIN(), 
     maxDate: LocalDateTime = LocalDateTime.MAX(), 
     yearsRange: IntRange? = IntRange(1922, 2122), 
     height: Dp, 
     rowCount: Int = 3, 
     dateTextStyle: TextStyle = MaterialTheme.typography.titleMedium, 
     dateTextColor: Color = LocalContentColor.current, 
     hideHeader: Boolean = false,
     showMonthAsNumber: Boolean = false,
     containerColor: Color = Color.White, 
     shape: Shape = RoundedCornerShape(10.dp), 
     dateTimePickerView: DateTimePickerView = DateTimePickerView.BOTTOM_SHEET_VIEW, 
     dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() }, 
     selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(), 
     onDoneClick: (snappedDate: LocalDateTime) -> Unit = {}, 
     onDateChangeListener: (snappedDate: LocalDateTime) -> Unit = {}, 
     onDismiss: () -> Unit = {}, 
)  
WheelDateTimePicker( 
     modifier: Modifier = Modifier, 
     title: String = "DATE & TIME PICKER", 
     doneLabel: String = "Done", 
     titleStyle: TextStyle = LocalTextStyle.current, 
     doneLabelStyle: TextStyle = LocalTextStyle.current, 
     startDateTime: LocalDateTime = LocalDateTime.now(), 
     minDateTime: LocalDateTime = LocalDateTime.MIN(), 
     maxDateTime: LocalDateTime = LocalDateTime.MAX(), 
     yearsRange: IntRange? = IntRange(1922, 2122), 
     timeFormat: TimeFormat = TimeFormat.HOUR_24, 
     height: Dp = 128.dp, 
     rowCount: Int = 3, 
     dateTextStyle: TextStyle = MaterialTheme.typography.titleMedium, 
     dateTextColor: Color = LocalContentColor.current, 
     hideHeader: Boolean = false,
     showMonthAsNumber: Boolean = false,
     selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(), 
     onDoneClick: (snappedDate: LocalDateTime) -> Unit = {}, 
     onDateChangeListener: (snappedDate: LocalDateTime) -> Unit = {}, 
) 

WheelTimePickerView

A composable for selecting time using a wheel picker.

Screenshots

Image 3     Image 2     Image 1
WheelTimePickerView(
    modifier: Modifier = Modifier,
showTimePicker: Boolean = false,
title: String = "TIME PICKER",
doneLabel: String = "Done",
titleStyle: TextStyle = LocalTextStyle.current,
doneLabelStyle: TextStyle = LocalTextStyle.current,
startTime: LocalTime = LocalTime.now(),
minTime: LocalTime = LocalTime.MIN(),
maxTime: LocalTime = LocalTime.MAX(),
timeFormat: TimeFormat = TimeFormat.HOUR_24,
height: Dp,
rowCount: Int = 3,
textStyle: TextStyle = MaterialTheme.typography.titleMedium,
textColor: Color = LocalContentColor.current,
hideHeader: Boolean = false,
containerColor: Color = Color.White,
shape: Shape = RoundedCornerShape(10.dp),
dateTimePickerView: DateTimePickerView = DateTimePickerView.BOTTOM_SHEET_VIEW,
dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() },
selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
onDoneClick: (snappedDate: LocalTime) -> Unit = {},
onTimeChangeListener: (snappedDate: LocalTime) -> Unit = {},
onDismiss: () -> Unit = {},
)   
WheelTimePicker(
    modifier: Modifier = Modifier,
title: String = "TIME PICKER",
doneLabel: String = "Done",
titleStyle: TextStyle = LocalTextStyle.current,
doneLabelStyle: TextStyle = LocalTextStyle.current,
startTime: LocalTime = LocalTime.now(),
minTime: LocalTime = LocalTime.MIN(),
maxTime: LocalTime = LocalTime.MAX(),
timeFormat: TimeFormat = TimeFormat.HOUR_24,
height: Dp,
rowCount: Int = 3,
textStyle: TextStyle = MaterialTheme.typography.titleMedium,
textColor: Color = LocalContentColor.current,
hideHeader: Boolean = false,
selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
onDoneClick: (snappedDate: LocalTime) -> Unit = {},
onTimeChangeListener: (snappedDate: LocalTime) -> Unit = {},
)  

🌐 Stay Connected with Us

Stay connected and keep up with our latest innovations! 💼 Let's innovate together!

LinkedIn Medium

📄 License

Copyright 2023 Mobile Innovation Network 
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.