Created
December 4, 2024 07:12
-
-
Save shoaibmushtaq25/3f10bfaebdf40477a63b136e9a88f3be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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