fix widget color bar: use left-border trick to match content height

This commit is contained in:
Damocles 2026-04-22 21:18:41 +02:00
parent 2dddb6799a
commit cf82b4b586

View file

@ -217,37 +217,40 @@ class AgendaWidget : GlanceAppWidget() {
Spacer(GlanceModifier.width(8.dp)) Spacer(GlanceModifier.width(8.dp))
// color indicator // color bar as left border - stretches with content automatically
val barHeight = if (event.location != null || !event.allDay) 32.dp else 18.dp
Box( Box(
modifier = GlanceModifier modifier = GlanceModifier
.size(width = 3.dp, height = barHeight) .defaultWeight()
.cornerRadius(2.dp) .background(GlanceTheme.colors.primary)
.background(GlanceTheme.colors.primary), .cornerRadius(4.dp),
) {} ) {
Column(
Spacer(GlanceModifier.width(8.dp)) modifier = GlanceModifier
.fillMaxWidth()
// event details .padding(start = 3.dp)
Column(modifier = GlanceModifier.defaultWeight()) { .background(GlanceTheme.colors.widgetBackground),
Text( ) {
text = event.title, Column(modifier = GlanceModifier.padding(start = 8.dp, top = 2.dp, bottom = 2.dp)) {
style = TextStyle( Text(
color = GlanceTheme.colors.onSurface, text = event.title,
fontSize = 13.sp, style = TextStyle(
fontWeight = FontWeight.Medium, color = GlanceTheme.colors.onSurface,
), fontSize = 13.sp,
maxLines = 2, fontWeight = FontWeight.Medium,
) ),
if (event.location != null) { maxLines = 2,
Text( )
text = event.location, if (event.location != null) {
style = TextStyle( Text(
color = GlanceTheme.colors.onSurfaceVariant, text = event.location,
fontSize = 11.sp, style = TextStyle(
), color = GlanceTheme.colors.onSurfaceVariant,
maxLines = 1, fontSize = 11.sp,
) ),
maxLines = 1,
)
}
}
} }
} }
} }