From 19d7eabc7f92f19278f99090a96b41041a785256 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Mon, 2 Aug 2021 13:07:56 +0300 Subject: [PATCH] Use DesktopMaterialTheme instead of MaterialTheme --- templates/desktop-template/src/main/kotlin/main.kt | 3 ++- .../src/main/java/com/myapplication/MainActivity.kt | 5 ++++- .../common/src/commonMain/kotlin/App.kt | 10 ++++------ .../desktop/src/jvmMain/kotlin/main.kt | 5 ++++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/templates/desktop-template/src/main/kotlin/main.kt b/templates/desktop-template/src/main/kotlin/main.kt index 6a3bc61e7f..3a45be6db2 100644 --- a/templates/desktop-template/src/main/kotlin/main.kt +++ b/templates/desktop-template/src/main/kotlin/main.kt @@ -1,3 +1,4 @@ +import androidx.compose.desktop.DesktopMaterialTheme import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.material.Text import androidx.compose.material.Button @@ -11,7 +12,7 @@ import androidx.compose.ui.window.application fun Screen() { var text by remember { mutableStateOf("Hello, World!") } - MaterialTheme { + DesktopMaterialTheme { Button(onClick = { text = "Hello, Desktop!" }) { diff --git a/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt b/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt index 52cb3575e1..ea85703371 100644 --- a/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt +++ b/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt @@ -4,13 +4,16 @@ import App import android.os.Bundle import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity +import androidx.compose.material.MaterialTheme class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - App() + MaterialTheme { + App() + } } } } \ No newline at end of file diff --git a/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt b/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt index 71dba63610..fc5b36c595 100644 --- a/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt +++ b/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt @@ -7,12 +7,10 @@ import androidx.compose.runtime.* fun App() { var text by remember { mutableStateOf("Hello, World!") } - MaterialTheme { - Button(onClick = { - text = "Hello, ${getPlatformName()}" - }) { - Text(text) - } + Button(onClick = { + text = "Hello, ${getPlatformName()}" + }) { + Text(text) } } diff --git a/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt b/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt index 2543564b01..d60069e49a 100644 --- a/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt +++ b/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt @@ -1,8 +1,11 @@ +import androidx.compose.desktop.DesktopMaterialTheme import androidx.compose.ui.window.Window import androidx.compose.ui.window.application fun main() = application { Window(onCloseRequest = ::exitApplication) { - App() + DesktopMaterialTheme { + App() + } } } \ No newline at end of file