Skip to content

hikage-widget-material

Maven CentralMaven metadata URL

This is a Hikage declaration dependency for Google Material (MDC) components.

Configure Dependency

You can add this module to your project using the following method.

We recommend that you first refer to hikage-bom to use BOM for unified version management.

Add dependency in your project's gradle/libs.versions.toml.

toml
[versions]
hikage-widget-material = "<version>"

[libraries]
hikage-widget-material = { module = "com.highcapable.hikage:hikage-widget-material", version.ref = "hikage-widget-material" }

Configure dependency in your project's build.gradle.kts.

kotlin
implementation(libs.hikage.widget.material)

Please change <version> to the version displayed at the top of this document.

Traditional Method

Configure dependency in your project's build.gradle.kts.

kotlin
implementation("com.highcapable.hikage:hikage-widget-material:<version>")

Please change <version> to the version displayed at the top of this document.

Function Introduction

This dependency declares the available components from Google Material (MDC) that you can directly reference and use in Hikage.

You need to manually introduce the com.google.android.material:material dependency, this dependency does not provide automatic introduction of Material related dependencies.

Tips

This dependency needs to be used in conjunction with hikage-gradle-plugin, the plugin will automatically read the view declaration files in the dependency and generate corresponding Hikage layout component functions (Hikage Performer) in the current module through hikage-compiler.

The following example

kotlin
LinearLayout(
    lparams = LayoutParams(matchParent = true) {
        topMargin = 16.dp
    },
    init = {
        orientation = LinearLayout.VERTICAL
        gravity = Gravity.CENTER
    }
) {
    MaterialTextView {
        text = "Hello, World!"
        textSize = 16f
        gravity = Gravity.CENTER
    }
    MaterialButton {
        text = "Hello, World!"
        textSize = 16f
        gravity = Gravity.CENTER
    }
    TextInputLayout(
        lparams = LayoutParams {
            topMargin = 16.dp
        },
        init = {
            minWidth = 200.dp
            hint = "Enter your text"
        }
    ) {
        TextInputEditText()
    }
}

Released under the Apache-2.0 License