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
def compose_version = '1.0.1' | |
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version") | |
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version") |
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
@Composable | |
fun MainScreen() { | |
Box( | |
contentAlignment = Alignment.Center, | |
modifier = Modifier | |
.fillMaxWidth() | |
.fillMaxHeight() | |
.background(Color.White) | |
) { | |
Button( |
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
class ExampleInstrumentedTest { | |
@get:Rule | |
val composeTestRule = createAndroidTestRule(MainActivity::class.java) | |
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
@Test | |
fun testButtonClick() { | |
val button = composeTestRule.onNode(hasTestTag("yourTestTag"), useUnmergedTree = true) | |
button.assertIsDisplayed() | |
button.performClick() | |
} |
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
object MaterialTheme { | |
val colors: Colors | |
@Composable | |
@ReadOnlyComposable | |
get() = LocalColors.current | |
val typography: Typography | |
@Composable | |
@ReadOnlyComposable | |
get() = LocalTypography.current | |
val shapes: Shapes |
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
@Composable | |
fun MaterialTheme( | |
colors: Colors = MaterialTheme.colors, | |
typography: Typography = MaterialTheme.typography, | |
shapes: Shapes = MaterialTheme.shapes, | |
content: @Composable () -> Unit | |
) |
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
object AppTheme { | |
val colors: AppColors | |
@Composable | |
@ReadOnlyComposable | |
get() = LocalColors.current | |
val typography: AppTypography | |
@Composable | |
@ReadOnlyComposable | |
get() = LocalTypography.current | |
val dimensions: AppDimensions |
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
class AppColors( | |
primary: Color, | |
secondary: Color, | |
textPrimary: Color, | |
error: Color, | |
isLight: Boolean | |
) { | |
var primary by mutableStateOf(primary) | |
private set | |
var secondary by mutableStateOf(secondary) |
OlderNewer