Skip to content

CodandoTV/CraftD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android API kotlin License MIT


CraftD: A framework to implement Server-Driven UI quickly and easily to Android / iOS / Flutter / Kmp

Documentation

See the project website for documentation.

Features

🔗 Compatibility

Tech Support
View System - Android Supported
Jetpack Compose - Android Supported
Widget - Flutter Supported
SwiftUi - iOS Supported
Jetpack Compose - Multiplatform ⚒️ In Progress

Components that already exist in the library

Component Compose View System Widget SwiftUI
Button X X X -
Text X X X X
CheckBox X - - -

Create your custom component( android compose example )

@JsonIgnoreProperties(ignoreUnknown = true)
@Immutable
@Stable
data class CheckBoxProperties(
    @JsonProperty("text") val text: String? = null,
    ... rest of your properties
)

Add your Component json object in Dymanic.json

{
  "key": "CraftDCheckBox",
  "value": {
    ... place your properties
  }
}

Create your Component

@Composable
fun CraftDCheckBox(
    checkboxProperties: CheckBoxProperties,
    modifier: Modifier = Modifier,
    onChecked: (Boolean) -> Unit
) {
    ... place your code
}

Create your Component Builder

class CraftDCheckBoxBuilder(
    override val key: String = CraftDComponentKey.CHECK_BOX_COMPONENT.key
) :
    CraftDBuilder {
    @Composable
    override fun craft(model: SimpleProperties, listener: CraftDViewListener) {
        val checkBoxProperties = model.value.convertToVO<CheckBoxProperties>()
        CraftDCheckBox(checkBoxProperties) {
            checkBoxProperties.actionProperties?.let { listener.invoke(it) }
        }
    }
}

More details check our documentation

Samples

Android Compose Android View System iOS SwiftUI Flutter
android android iOS flutter

Credits

A Server Driven UI library for Android.

Inspired by the DynamicView.

This project exists thanks to all the people who contribute.