Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alorma/Compose-Settings
Compose Multiplatform #Compose Settings library
https://github.com/alorma/Compose-Settings
android android-library compose compose-multiplatform settings
Last synced: about 1 month ago
JSON representation
Compose Multiplatform #Compose Settings library
- Host: GitHub
- URL: https://github.com/alorma/Compose-Settings
- Owner: alorma
- License: mit
- Created: 2021-04-22T15:33:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T15:02:31.000Z (about 2 months ago)
- Last Synced: 2024-10-19T21:55:33.830Z (about 2 months ago)
- Topics: android, android-library, compose, compose-multiplatform, settings
- Language: Kotlin
- Homepage: https://alorma.github.io/Compose-Settings/
- Size: 5.98 MB
- Stars: 428
- Watchers: 6
- Forks: 27
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-list - alorma/Compose-Settings - Compose Multiplatform #Compose Settings library (Kotlin)
- awesome - Compose Settings
README
# Compose Settings - Multiplatform
[![Build](https://github.com/alorma/Compose-Settings/actions/workflows/main.yml/badge.svg)](https://github.com/alorma/Compose-Settings/actions/workflows/main.yml)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.alorma.compose-settings/ui-tiles.svg)](https://central.sonatype.com/namespace/com.github.alorma.compose-settings)### Preview
This library provides a set of **Settings** like composable items to help android *Jetpack Compose*
developers build complex settings screens without all the boilerplate.**Ui tiles**
| Component | Screenshot |
|-------------------------------------------------------|----------------------------------------------------------------------------------|
| [SettingsMenuLink](#SettingsMenuLink) | |
| [SettingsCheckbox](#SettingsCheckbox) | |
| [SettingsTriStateCheckbox](#SettingsTriStateCheckbox) | |
| [SettingsRadioButton](#SettingsRadioButton) | |
| [SettingsSwitch](#SettingsSwitch) | |
| [SettingsGroup](#SettingsGroup) | |**Ui tiles expanded**
| Component | Screenshot |
|-----------------------------------|----------------------------------------------------------------|
| [SettingsSlider](#SettingsSlider) | |## Install
```
##// groovy
implementation 'com.github.alorma.compose-settings:ui-tiles:$version'
implementation 'com.github.alorma.compose-settings:ui-tiles-extended:$version'[...]
// kotlin DSL
implementation("com.github.alorma.compose-settings:ui-tiles:$version")
implementation("com.github.alorma.compose-settings:ui-tiles-extended:$version")[...]
// Catalog versions:
[versions]
compose-settings = "{{libVersion}}"[libraries]
composeSettings-ui = { group = "com.github.alorma.compose-settings", name = "ui-tiles", version.ref = "compose-settings" }
composeSettings-ui-extended = { group = "com.github.alorma.compose-settings", name = "ui-tiles-extended", version.ref = "compose-settings" }
```## Usage
##### SettingsMenuLink:
```kotlin
SettingsMenuLink(
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
action = { IconButton() },
onClick = { ... },
)
```##### SettingsCheckbox:
```kotlin
SettingsCheckbox(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```##### SettingsTriStateCheckbox:
```kotlin
SettingsTriStateCheckbox(
state = false / true / null,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```##### SettingsRadioButton:
```kotlin
SettingsRadioButton(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onClick = { },
)
```##### SettingsSwitch:
```kotlin
SettingsSwitch(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```##### SettingsSlider:
```kotlin
SettingsSlider(
value = x.xf,
valueRange = X.f..Y.f,
steps = X,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onValueChange = { newValue: Float -> },
)
```##### SettingsGroup
> Updates on `enabled` will be reflected on it's internal components unless you change their `enabled` state manually.
```kotlin
SettingsGroup(
modifier = Modifier,
enabled = false / true,
title = { Text(text = "SettingsGroup") },
contentPadding = PaddingValues(16.dp),
) {
SettingsMenuLink(...)
SettingsCheckbox(...)
SettingsSwitch(...)
...
}
```