-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple test for LazyColumn screen, due to potential issues with C…
…ompose 1.6.0
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
tests/application/src/main/java/dev/enro/tests/application/compose/LazyColumn.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dev.enro.tests.application.compose | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material.Card | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import dev.enro.annotations.NavigationDestination | ||
import dev.enro.core.NavigationKey | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
object LazyColumn : NavigationKey.SupportsPush | ||
|
||
@Composable | ||
@NavigationDestination(LazyColumn::class) | ||
fun LazyColumnScreen() { | ||
LazyColumn( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(MaterialTheme.colors.background) | ||
.padding(16.dp) | ||
) { | ||
item { | ||
Text( | ||
text = "Lazy Column", | ||
style = MaterialTheme.typography.h6 | ||
) | ||
} | ||
items(1000) { number -> | ||
Card( | ||
modifier = Modifier.fillMaxWidth().padding(vertical = 2.dp) | ||
) { | ||
Text( | ||
text = "$number", | ||
modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp) | ||
) | ||
} | ||
} | ||
} | ||
} |