Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrture committed Jul 14, 2023
2 parents 73acb1b + 90edd09 commit 85e5c8a
Showing 1 changed file with 202 additions and 1 deletion.
203 changes: 202 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,205 @@
# PickerSheet
# PickerSheet [![](https://jitpack.io/v/cnrture/PickerSheet.svg)](https://jitpack.io/#cnrture/PickerSheet)

## Implementation
```kotlin
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}

dependencies {
implementation 'com.github.cnrture:PickerSheet:Tag'
}
```

## Usage
### TextPickerSheet
```kotlin
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val sheetState = rememberModalBottomSheetState()

var textPickerShowState by rememberSaveable { mutableStateOf(false) }

Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Button(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
onClick = { textPickerShowState = true }
) {
Text(text = "Show Text Picker Sheet")
}
}

TextPickerSheet(
modifier = Modifier.padding(16.dp),
sheetState = sheetState,
showState = textPickerShowState,
list = listOf("A", "B", "C", "D"),
title = "C",
selectedItem = "Second",
isDragIconEnabled = true,
rippleEffectEnabled = false,
fontFamily = FontFamily.Default,
dividerConfiguration = DividerConfiguration(
isEnabled = false,
color = Color.Black,
thickness = 1.dp
),
titleConfiguration = TitleConfiguration(
color = Color.Black,
size = 16.sp,
align = TextAlign.Start
),
itemConfiguration = ItemConfiguration(
color = Color.Black,
size = 14.sp,
padding = 16.dp
),
sheetColors = PickerSheetColors(
scrimColor = Color.Gray.copy(alpha = 0.6f),
backgroundColor = Color.White
),
selectedIconConfiguration = SelectedIconConfiguration(
icon = com.canerture.pickersheet.R.drawable.ic_check,
color = Color.Black,
size = 16.dp
),
onDismiss = { it: String ->
textPickerShowState = false
}
)
}
```

### CheckBoxPickerSheet
```kotlin
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val sheetState = rememberModalBottomSheetState()

var checkBoxPickerShowState by rememberSaveable { mutableStateOf(false) }

Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Button(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
onClick = { checkBoxPickerShowState = true }
) {
Text(text = "Show CheckBox Picker Sheet")
}
}

CheckBoxPickerSheet(
modifier = Modifier.padding(16.dp),
sheetState = sheetState,
showState = checkBoxPickerShowState,
list = listOf("A", "B", "C", "D"),
title = "Title",
selectedItems = listOf("C"),
isDragIconEnabled = true,
rippleEffectEnabled = false,
fontFamily = FontFamily.Default,
dividerConfiguration = DividerConfiguration(
isEnabled = false,
color = Color.Black,
thickness = 1.dp
),
titleConfiguration = TitleConfiguration(
color = Color.Black,
size = 16.sp,
align = TextAlign.Start
),
itemConfiguration = ItemConfiguration(
color = Color.Black,
size = 14.sp,
padding = 16.dp
),
sheetColors = PickerSheetColors(
scrimColor = Color.Gray.copy(alpha = 0.6f),
backgroundColor = Color.White
),
checkboxColors = CheckboxDefaults.colors(),
onDismiss = { it: List<String> ->
checkBoxPickerShowState = false
}
)
}
```

### RadioButtonPickerSheet
```kotlin
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val sheetState = rememberModalBottomSheetState()

var radioButtonPickerShowState by rememberSaveable { mutableStateOf(false) }

Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Button(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
onClick = { radioButtonPickerShowState = true }
) {
Text(text = "Show RadioButton Picker Sheet")
}
}

RadioButtonPickerSheet(
modifier = Modifier.padding(16.dp),
sheetState = sheetState,
showState = radioButtonPickerShowState,
list = listOf("A", "B", "C", "D"),
title = "Title",
selectedItem = "C",
isDragIconEnabled = true,
rippleEffectEnabled = false,
fontFamily = FontFamily.Default,
dividerConfiguration = DividerConfiguration(
isEnabled = false,
color = Color.Black,
thickness = 1.dp
),
titleConfiguration = TitleConfiguration(
color = Color.Black,
size = 16.sp,
align = TextAlign.Start
),
itemConfiguration = ItemConfiguration(
color = Color.Black,
size = 14.sp,
padding = 16.dp
),
sheetColors = PickerSheetColors(
scrimColor = Color.Gray.copy(alpha = 0.6f),
backgroundColor = Color.White
),
radioButtonColors = RadioButtonDefaults.colors(),
onDismiss = { it: String ->
radioButtonPickerShowState = false
}
)
}
```

## License

Expand Down

0 comments on commit 85e5c8a

Please sign in to comment.