This file contains hidden or 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
| LazyColumn { | |
| items(posts) { post -> | |
| PostCard(post) | |
| } | |
| } |
This file contains hidden or 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
| import android.content.Context | |
| import android.widget.Toast | |
| import androidx.compose.foundation.layout.fillMaxWidth | |
| import androidx.compose.foundation.layout.padding | |
| import androidx.compose.material3.Divider | |
| import androidx.compose.material3.MaterialTheme | |
| import androidx.compose.material3.Surface | |
| import androidx.compose.material3.surfaceColorAtElevation | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Modifier |
This file contains hidden or 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
| import androidx.compose.foundation.layout.fillMaxSize | |
| import androidx.compose.foundation.lazy.LazyColumn | |
| import androidx.compose.foundation.lazy.LazyListScope | |
| import androidx.compose.foundation.lazy.items | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Modifier | |
| data class ChildLayout( | |
| val contentType: String = "", | |
| val content: @Composable (item: Any?) -> Unit = {}, |
This file contains hidden or 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
| @Composable | |
| fun HomeScreen(modifier: Modifier = Modifier) { | |
| val scrollState = rememberScrollState() | |
| val context = LocalContext.current | |
| Surface(modifier = modifier.fillMaxWidth()) { | |
| LazyColumn(modifier = Modifier.verticalScroll(scrollState)) { | |
| // LazyRow still able to be use, since it has different orientation with parent LazyColumn | |
| item { |
This file contains hidden or 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
| @Composable | |
| fun HomeScreenWrong(modifier: Modifier = Modifier) { | |
| val scrollState = rememberScrollState() | |
| val context = LocalContext.current | |
| Surface(modifier = modifier.fillMaxWidth()) { | |
| Column(modifier = Modifier.verticalScroll(scrollState)) { | |
| LazyRow(modifier = modifier.fillMaxWidth()) { | |
| items(stories) { story -> |
This file contains hidden or 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
| @Composable | |
| fun PreviewScreen( | |
| screenName: String, | |
| modifier: Modifier = Modifier | |
| ) { | |
| Surface(modifier = modifier.fillMaxSize()) { | |
| Column(modifier = modifier.verticalScroll()) { | |
| PreviewAnimation() | |
| Text( |