Skip to content

Commit e0efdab

Browse files
committed
style(fc): show scroll gradient at top of conversation always
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent df83b01 commit e0efdab

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/chat/conversation/ConversationMessages.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ internal fun ConversationMessages(
8787
modifier = Modifier
8888
.fillMaxSize()
8989
.verticalScrollStateGradient(
90-
lazyListState,
91-
color = CodeTheme.colors.background
90+
scrollState = lazyListState,
91+
color = CodeTheme.colors.background,
92+
showAtStartAlways = true
9293
),
9394
messages = messages,
9495
listState = lazyListState,

ui/components/src/main/kotlin/com/getcode/ui/utils/Modifier.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,21 +262,23 @@ fun Modifier.verticalScrollStateGradient(
262262
scrollState: LazyListState,
263263
color: Color = Color.Unspecified,
264264
showAtStart: Boolean = true,
265+
showAtStartAlways: Boolean = false,
265266
showAtEnd: Boolean = true,
267+
showAtEndAlways: Boolean = false,
266268
isLongGradient: Boolean = false,
267269
): Modifier = composed {
268270
val backgroundColor = color.takeOrElse { CodeTheme.colors.background }
269271
val gradientSizePx =
270272
with(LocalDensity.current) { gradientSize.toPx() } * if (isLongGradient) 1.5f else 1f
271273
this
272-
.addIf(showAtStart && !scrollState.isScrolledToStart()) {
274+
.addIf((showAtStart && !scrollState.isScrolledToStart()) || showAtStartAlways) {
273275
Modifier.drawWithGradient(
274276
color = backgroundColor,
275277
startY = { gradientSizePx },
276278
endY = { 0f },
277279
)
278280
}
279-
.addIf(showAtEnd && !scrollState.isScrolledToEnd()) {
281+
.addIf((showAtEnd && !scrollState.isScrolledToEnd()) || showAtEndAlways) {
280282
Modifier.drawWithGradient(
281283
color = backgroundColor,
282284
startY = { size.height - gradientSizePx },

0 commit comments

Comments
 (0)