Skip to content

Instantly share code, notes, and snippets.

@shoaibmushtaq25
Created December 4, 2024 07:12
Show Gist options
  • Save shoaibmushtaq25/3f10bfaebdf40477a63b136e9a88f3be to your computer and use it in GitHub Desktop.
Save shoaibmushtaq25/3f10bfaebdf40477a63b136e9a88f3be to your computer and use it in GitHub Desktop.
...
private val contents: List<String> = (1..50).map { "Lazy Column Item $it" }
val connection = CollapsingAppBarNestedScrollConnection() //initialing nestedScrollConnection here
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
CollapsibleHeaderTheme {
CollapsibleThing()
}
}
}
}
@Composable
fun CollapsibleThing(modifier: Modifier = Modifier) {
Surface(
modifier = modifier.fillMaxSize(), color = MaterialTheme.colorScheme.tertiary
) {
Box(
modifier = Modifier
.fillMaxSize()
.nestedScroll(connection) //using nestedScrollConnection to the common parent of lazylist view and header
) {
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment