fix widget color bar: use left-border trick to match content height
This commit is contained in:
parent
2dddb6799a
commit
cf82b4b586
1 changed files with 32 additions and 29 deletions
|
|
@ -217,37 +217,40 @@ class AgendaWidget : GlanceAppWidget() {
|
|||
|
||||
Spacer(GlanceModifier.width(8.dp))
|
||||
|
||||
// color indicator
|
||||
val barHeight = if (event.location != null || !event.allDay) 32.dp else 18.dp
|
||||
// color bar as left border - stretches with content automatically
|
||||
Box(
|
||||
modifier = GlanceModifier
|
||||
.size(width = 3.dp, height = barHeight)
|
||||
.cornerRadius(2.dp)
|
||||
.background(GlanceTheme.colors.primary),
|
||||
) {}
|
||||
|
||||
Spacer(GlanceModifier.width(8.dp))
|
||||
|
||||
// event details
|
||||
Column(modifier = GlanceModifier.defaultWeight()) {
|
||||
Text(
|
||||
text = event.title,
|
||||
style = TextStyle(
|
||||
color = GlanceTheme.colors.onSurface,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
),
|
||||
maxLines = 2,
|
||||
)
|
||||
if (event.location != null) {
|
||||
Text(
|
||||
text = event.location,
|
||||
style = TextStyle(
|
||||
color = GlanceTheme.colors.onSurfaceVariant,
|
||||
fontSize = 11.sp,
|
||||
),
|
||||
maxLines = 1,
|
||||
)
|
||||
.defaultWeight()
|
||||
.background(GlanceTheme.colors.primary)
|
||||
.cornerRadius(4.dp),
|
||||
) {
|
||||
Column(
|
||||
modifier = GlanceModifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 3.dp)
|
||||
.background(GlanceTheme.colors.widgetBackground),
|
||||
) {
|
||||
Column(modifier = GlanceModifier.padding(start = 8.dp, top = 2.dp, bottom = 2.dp)) {
|
||||
Text(
|
||||
text = event.title,
|
||||
style = TextStyle(
|
||||
color = GlanceTheme.colors.onSurface,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
),
|
||||
maxLines = 2,
|
||||
)
|
||||
if (event.location != null) {
|
||||
Text(
|
||||
text = event.location,
|
||||
style = TextStyle(
|
||||
color = GlanceTheme.colors.onSurfaceVariant,
|
||||
fontSize = 11.sp,
|
||||
),
|
||||
maxLines = 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue