Skip to content

Latest commit

 

History

History
84 lines (70 loc) · 2.91 KB

README.md

File metadata and controls

84 lines (70 loc) · 2.91 KB

Materially

Materially

Reusable Material3 components for Mobile & Tv

Why?

Currently in order to use Material3 components for both mobile and tv you'll have to add checks for most of them. Materially merges mobile and tv Material3 components into one.

Example

Material3

  • dependencies

    Mobile Television
    androidx.compose.material3.Button androidx.tv.material3.Button
  • usage

    composable {
        ...
        val isTv = // add your check here
        if (isTv)
            androidx.tv.material3.Button(...)
        else
            androidx.compose.material3.Button(...)
        ...
    }

Materially

  • dependency

    Mobile & Television
    com.bizyback.materially.components.atoms.Button
  • usage

    composable {
        Button(...)
    }

Sample

mobile tablet telly
mobile tablet telly

Installation

  • Install jitpack

Find settings.gradle.kts in the root project folder and add :

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { setUrl("https://jitpack.io") } // add this line
    }
}
  • Add Materially Dependency

In your app module find build.gradle.kts and add :

  implementation("com.github.bizyback:materially:$version")
  • Sync gradle and proceed use the library

Usage

  • Change MaterialTheme to MateriallyTheme
    @Composable
    fun MateriallyTheme(
        shapes: MateriallyShapes = materiallyShapes(), // to customize shapes
        padding: MateriallyPadding = materiallyPadding(), // to customize padding sizes
        typography: MateriallyTypography = materiallyTypography(), // to customize typography
        colorScheme: MateriallyColorScheme = materiallyColorScheme(), // to customize color scheme
        content: @Composable () -> Unit // pass your content
    ): Unit