From dee44fd1167bb3da9dcd6cf69e8e3cfed754606c Mon Sep 17 00:00:00 2001 From: Carson Holzheimer Date: Thu, 3 Jun 2021 21:23:40 +1000 Subject: [PATCH] Update compose to 0.4.0. Fix end padding for dropdowns --- build.gradle.kts | 4 ++-- .../kotlin/io/chozzle/composemacostheme/MacDropdown.kt | 9 +++++++-- .../composemacostheme/modifiedofficial/MacDesktopMenu.kt | 2 +- .../composemacostheme/modifiedofficial/MacMenu.kt | 2 +- .../io/chozzle/composenativetheme/NativeExampleView.kt | 5 +---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0e20f47..57bf7f9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,9 +8,9 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.4.0-build182") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.4.0") classpath("com.android.tools.build:gradle:4.0.1") - classpath(kotlin("gradle-plugin", version = "1.4.32")) + classpath(kotlin("gradle-plugin", version = "1.5.10")) } } diff --git a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/MacDropdown.kt b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/MacDropdown.kt index a57947f..d39c175 100644 --- a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/MacDropdown.kt +++ b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/MacDropdown.kt @@ -92,7 +92,7 @@ private fun MenuItems( isPointerHovering = false false } - ).padding(horizontal = 6.dp) + ) .background( if (isPointerHovering) MacTheme.colors.primary.copy(alpha = 0.7f) else Color.Unspecified, shape = RoundedCornerShape(4.dp) @@ -100,7 +100,12 @@ private fun MenuItems( contentPadding = PaddingValues(0.dp) ) { Row( - Modifier.fillMaxHeight().padding(2.dp), + Modifier.fillMaxHeight().padding( + start = 2.dp, + top = 2.dp, + end = 12.dp, + bottom = 2.dp + ), verticalAlignment = Alignment.CenterVertically ) { val checkOrSpace = if (index == selectedIndex) "\uDBC0\uDD85" else " " diff --git a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacDesktopMenu.kt b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacDesktopMenu.kt index 757870c..0060445 100644 --- a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacDesktopMenu.kt +++ b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacDesktopMenu.kt @@ -89,7 +89,7 @@ internal fun MacDropdownMenu( } Popup( - isFocusable = true, // Required to allow dismissing dropdown by clicking outside + focusable = true, // Required to allow dismissing dropdown by clicking outside onDismissRequest = onDismissRequest, popupPositionProvider = popupPositionProvider ) { diff --git a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacMenu.kt b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacMenu.kt index ae1217d..1157aba 100644 --- a/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacMenu.kt +++ b/compose-macos-theme/src/desktopMain/kotlin/io/chozzle/composemacostheme/modifiedofficial/MacMenu.kt @@ -132,7 +132,7 @@ internal fun DropdownMenuContent( ) { Column( modifier = modifier - .padding(vertical = DropdownMenuItemVerticalPadding) + .padding(all = DropdownMenuItemVerticalPadding) .width(IntrinsicSize.Max) .verticalScroll(rememberScrollState()), content = content diff --git a/compose-native-theme/src/commonMain/kotlin/io/chozzle/composenativetheme/NativeExampleView.kt b/compose-native-theme/src/commonMain/kotlin/io/chozzle/composenativetheme/NativeExampleView.kt index 30e4ede..21c7234 100644 --- a/compose-native-theme/src/commonMain/kotlin/io/chozzle/composenativetheme/NativeExampleView.kt +++ b/compose-native-theme/src/commonMain/kotlin/io/chozzle/composenativetheme/NativeExampleView.kt @@ -6,14 +6,10 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.material.ButtonDefaults -import androidx.compose.material.ButtonElevation -import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.State import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -39,6 +35,7 @@ fun NativeExampleView() { } } } + Crossfade( targetState = currentDisplayingTheme, animationSpec = TweenSpec(2500)