@@ -40,6 +40,7 @@ import com.example.platform.ui.appwidgets.glance.layout.collections.layout.NoDat
40
40
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutDimensions.contentSize
41
41
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutDimensions.contentSpacing
42
42
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutDimensions.pictureRadius
43
+ import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutDimensions.verticalTextsSpacing
43
44
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutDimensions.widgetPadding
44
45
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutSize.HorizontalLarge
45
46
import com.example.platform.ui.appwidgets.glance.layout.text.layout.TextWithImageLayoutSize.HorizontalSmall
@@ -178,7 +179,7 @@ private fun HorizontalContent(data: TextWithImageData, showImage: Boolean) {
178
179
// Use 40% of available width for text area if showing image on side.
179
180
width = (0.4 * contentWidth).takeIf { showImage } ? : contentWidth,
180
181
// Use 80% of vertical space for text area.
181
- height = 0.80 * (contentSize.height - contentSpacing )
182
+ height = 0.80 * (contentSize.height - ( 2 * verticalTextsSpacing) )
182
183
)
183
184
)
184
185
if (showImage) {
@@ -201,8 +202,8 @@ private fun VerticalContent(
201
202
verticalAlignment = Alignment .Vertical .Bottom ,
202
203
modifier = GlanceModifier .fillMaxHeight()
203
204
) {
204
- val contentWidth = contentSize.width - contentSpacing
205
- val contentHeight = contentSize.height - (2 * contentSpacing )
205
+ val contentWidth = contentSize.width
206
+ val contentHeight = contentSize.height - (2 * verticalTextsSpacing )
206
207
207
208
if (showImage) {
208
209
Image (
@@ -216,8 +217,8 @@ private fun VerticalContent(
216
217
showSecondaryText = showSecondaryText,
217
218
modifier = GlanceModifier .fillMaxWidth(),
218
219
availableSize = DpSize (
219
- // Use 90 % of available width to leave some offset for word break differences.
220
- width = 0.9 * contentWidth,
220
+ // Use 80 % of available width to leave some offset for word break differences.
221
+ width = 0.8 * contentWidth,
221
222
// Use 40% vertical space for text area if showing image
222
223
height = (0.4 * contentHeight).takeIf { showImage } ? : contentHeight
223
224
)
@@ -248,7 +249,7 @@ private fun TextStack(
248
249
style = TextWithImageLayoutTextStyles .caption,
249
250
modifier = GlanceModifier .fillMaxWidth()
250
251
)
251
- Spacer (modifier = GlanceModifier .height(contentSpacing / 2 ))
252
+ Spacer (modifier = GlanceModifier .height(verticalTextsSpacing ))
252
253
Text (
253
254
text = data.primary,
254
255
maxLines = primaryTextMaxLines,
@@ -260,7 +261,7 @@ private fun TextStack(
260
261
availableSize = availableSize
261
262
)
262
263
263
- Spacer (modifier = GlanceModifier .height(contentSpacing / 2 ))
264
+ Spacer (modifier = GlanceModifier .height(verticalTextsSpacing ))
264
265
Text (
265
266
text = data.secondary,
266
267
maxLines = secondaryTextMaxLines,
@@ -372,7 +373,8 @@ private enum class TextWithImageLayoutSize {
372
373
}
373
374
}
374
375
375
- fun showTitleBar () = this != HorizontalSmall && this != VerticalSmall
376
+ @Composable
377
+ fun showTitleBar () = LocalSize .current.height >= 180 .dp
376
378
}
377
379
378
380
@@ -436,11 +438,16 @@ private object TextWithImageLayoutDimensions {
436
438
/* * Corner radius to be applied to an image. */
437
439
val pictureRadius = 16 .dp
438
440
439
- /* *
440
- * Space between larger building blocks within the layout. e.g space between text stack and
441
- * the image.
442
- */
443
- val contentSpacing = 4 .dp
441
+ /* *
442
+ * Space between larger building blocks within the layout. e.g space between text stack and
443
+ * the image.
444
+ */
445
+ val contentSpacing = 12 .dp
446
+
447
+ /* *
448
+ * Vertical spacing between text items
449
+ */
450
+ val verticalTextsSpacing = 4 .dp
444
451
445
452
/* * Height of the title bar. */
446
453
private val titleBarHeight: Dp
0 commit comments