Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Customize ContentAlpha in Jetpack Compose like a theme

My Customer has very strict design guidelines, e.g. for alpha: Text should have no alpha.

However, I can't seem to customize MaterialDesign´s alpha in a theme like way.

Sure, I can customize each and every component, but this is tedious: Modifier.alpha(1.0f)

Sure, I can wrap my whole app in an alpha-Provider, but most material-components overwrite it, e.g. AppBar, so this doesn't work as expected either.

// my wrapper:
CompositionLocalProvider(LocalContentAlpha provides 1.0f) { /* my ui */ }

// will be overwritten by 
@Composable
private fun AppBar(...) {
    Surface(...) {
        CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
            Row(..., content)
        }
    }
}

So I guess what I should be doing is providing a custom ContentAlpha, since it is used in nearly every material component, but I don't know how to. Do you?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It seems to me like you don't really need material design and want to just go custom theme. It's fine, really, I'm currently working on production app that went in that direction and it's completely workable.

We are still wrapping our content with MaterialTheme to make SOME of material components available, but the material dependency is internal to base ui module. So if we want to use any material component in UI code (in feature for example) - we have to create our wrapper for it. This way we are using only our code in UI without loosing some of material components. And if material design will change in a way we cannot accept it - we can just reimplement the thin wrapper to something 100% custom (like we did with Button and text fields).

You can override any part of material component within those thin wrappers using Modifier.alpha(1.0f). You are doing it once and then forget about that :)

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda