From 393a308a02233e033069cf6b636610a334f2f598 Mon Sep 17 00:00:00 2001 From: takahirom Date: Fri, 13 Dec 2024 18:47:20 +0900 Subject: [PATCH 1/2] Add elevation for PreviewNormal preview test --- .../takahirom/preview/tests/Previews.kt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt b/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt index ac29760a..1b8c89fb 100644 --- a/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt +++ b/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt @@ -6,7 +6,9 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.Card +import androidx.compose.material3.ElevatedCard import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme @@ -21,14 +23,18 @@ import androidx.compose.ui.unit.dp @Composable fun PreviewNormal() { MaterialTheme { - Card( - Modifier - .width(180.dp) + Surface( ) { - Text( - modifier = Modifier.padding(8.dp), - text = "Generate Preview Test Sample" - ) + ElevatedCard( + Modifier + .padding(8.dp) + .width(180.dp) + ) { + Text( + modifier = Modifier.padding(8.dp), + text = "Generate Preview Test Sample" + ) + } } } } From ff9a8df0cfb1066f725c3decc12afbdf0fb57156 Mon Sep 17 00:00:00 2001 From: takahirom Date: Fri, 13 Dec 2024 19:02:17 +0900 Subject: [PATCH 2/2] Add elevation --- .../java/com/github/takahirom/preview/tests/Previews.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt b/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt index 1b8c89fb..ff42f6e1 100644 --- a/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt +++ b/sample-generate-preview-tests/src/main/java/com/github/takahirom/preview/tests/Previews.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults import androidx.compose.material3.ElevatedCard import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -28,7 +29,10 @@ fun PreviewNormal() { ElevatedCard( Modifier .padding(8.dp) - .width(180.dp) + .width(180.dp), + elevation = CardDefaults.elevatedCardElevation( + defaultElevation = 12.dp + ) ) { Text( modifier = Modifier.padding(8.dp),