Advertisement
Guest User

test collapsing

a guest
Jun 21st, 2021
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.18 KB | None | 0 0
  1. @Composable
  2. private fun TestCollapsing() {
  3.     val state = rememberCollapsingToolbarState()
  4.     val textSize = (18 + (30 - 18) * state.progress).sp
  5.  
  6.     AppBarContainer(
  7.         scrollStrategy = ScrollStrategy.ExitUntilCollapsed,
  8.         collapsingToolbarState = state,
  9.     ) {
  10.         CollapsingToolbar(collapsingToolbarState = state) {
  11.             Box(
  12.                 modifier = Modifier
  13.                     .background(MaterialTheme.colors.primary)
  14.                     .fillMaxWidth()
  15.                     .height(150.dp)
  16.                     .pin()
  17.             )
  18.  
  19.             Text(
  20.                 text = "Title",
  21.                 modifier = Modifier
  22.                     .road(Alignment.CenterStart, Alignment.BottomEnd)
  23.                     .padding(60.dp, 16.dp, 16.dp, 16.dp),
  24.                 color = Color.White,
  25.                 fontSize = textSize
  26.             )
  27.         }
  28.         LazyColumn(modifier = Modifier.appBarBody()) {
  29.             items(50) { index ->
  30.                 Text(
  31.                     "I'm item $index", modifier = Modifier
  32.                         .fillMaxWidth()
  33.                         .padding(16.dp)
  34.                 )
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement