diff --git a/README.md b/README.md index 7c56d07..1233517 100644 --- a/README.md +++ b/README.md @@ -142,17 +142,27 @@ run configuration. ### Make your first changes -The common entry point for your Compose Multiplatform app is located in `shared/src/commonMain/kotlin/App.kt`. Here, you will see the code that is responsible for rendering the "Hello, World" button. If you make changes here, you will see them reflected on both Android and iOS: +The common entry point for your Compose Multiplatform app is located in `shared/src/commonMain/kotlin/App.kt`. Here, you will see the code that is responsible for rendering the "Hello, World" button and the animated Compose Multplatform logo. If you make changes here, you will see them reflected on both Android and iOS: ```kotlin +@OptIn(ExperimentalResourceApi::class) @Composable internal fun App() { MaterialTheme { - var text by remember { mutableStateOf("Hello, World!") } - - Button(onClick = { - text = "Hello, ${getPlatformName()}" - }) { - Text(text) + var greetingText by remember { mutableStateOf("Hello, World!") } + var showImage by remember { mutableStateOf(false) } + Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { + Button(onClick = { + greetingText = "Hello, ${getPlatformName()}" + showImage = !showImage + }) { + Text(greetingText) + } + AnimatedVisibility(showImage) { + Image( + painterResource("compose-multiplatform.xml"), + null + ) + } } } } @@ -160,18 +170,27 @@ internal fun App() { Update the shared code by adding a text field that will update the name displayed on the button: -```kotlin +```diff +@OptIn(ExperimentalResourceApi::class) @Composable internal fun App() { MaterialTheme { - var text by remember { mutableStateOf("Hello, World!") } - Column { + var greetingText by remember { mutableStateOf("Hello, World!") } + var showImage by remember { mutableStateOf(false) } + Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { Button(onClick = { - text = "Hello, ${getPlatformName()}" + greetingText = "Hello, ${getPlatformName()}" + showImage = !showImage }) { - Text(text) + Text(greetingText) + } ++ TextField(greetingText, onValueChange = { greetingText = it }) + AnimatedVisibility(showImage) { + Image( + painterResource("compose-multiplatform.xml"), + null + ) } - TextField(text, onValueChange = { text = it }) } } } diff --git a/readme_images/android_app_running.png b/readme_images/android_app_running.png index 786ba34..2c8f2d2 100644 Binary files a/readme_images/android_app_running.png and b/readme_images/android_app_running.png differ diff --git a/readme_images/banner.png b/readme_images/banner.png index 5acb5b8..e933639 100644 Binary files a/readme_images/banner.png and b/readme_images/banner.png differ diff --git a/readme_images/hello_world_ios.png b/readme_images/hello_world_ios.png index 943d40d..c7c969c 100644 Binary files a/readme_images/hello_world_ios.png and b/readme_images/hello_world_ios.png differ diff --git a/readme_images/text_field_added.png b/readme_images/text_field_added.png index 54b700b..50c197f 100644 Binary files a/readme_images/text_field_added.png and b/readme_images/text_field_added.png differ