Search code examples
glance-appwidget

Refusing your app's TextStyle in a Glance widget


In a glance Text(), there's a style attribute, and this takes a glance TextStyle.

This TextStyle is different to the TextStyle you use in your MaterialTheme. So you can't reuse your app's TextStyles.

Is it possible to reuse your app's TextStyles in a glance app widget?


Solution

  • Note that MaterialTheme is designed for Jetpack Compose UI elements not for Glance. Given the limitations of AppWidgets (i.e no custom fonts) I would avoid reusing the theme.

    We are working on a "theming" API for Glance, in the meantime you can keep the TextStyle as top-level variable and reuse it when needed.