Reusable Material3
components for Mobile & Tv
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.
-
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(...) ... }
-
dependency
Mobile & Television com.bizyback.materially.components.atoms.Button
-
usage
composable { Button(...) }
mobile | tablet | telly |
---|---|---|
- 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
- Change
MaterialTheme
toMateriallyTheme
@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