diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index fd41ef4..d77bb73 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -40,7 +40,7 @@ kotlin { commonMain.dependencies { implementation(compose.runtime) implementation(compose.foundation) - implementation(compose.material) + implementation(compose.material3) implementation(compose.ui) implementation(compose.components.resources) implementation(compose.components.uiToolingPreview) diff --git a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/App.kt b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/App.kt index 288ff74..2734e92 100644 --- a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/App.kt +++ b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/App.kt @@ -1,10 +1,10 @@ package com.jetbrains.kmpapp import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.darkColors -import androidx.compose.material.lightColors +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost @@ -24,7 +24,7 @@ data class DetailDestination(val objectId: Int) @Composable fun App() { MaterialTheme( - colors = if (isSystemInDarkTheme()) darkColors() else lightColors() + colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme() ) { Surface { val navController: NavHostController = rememberNavController() diff --git a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/EmptyScreenContent.kt b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/EmptyScreenContent.kt index 2382f66..ae7def6 100644 --- a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/EmptyScreenContent.kt +++ b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/EmptyScreenContent.kt @@ -1,7 +1,7 @@ package com.jetbrains.kmpapp.screens import androidx.compose.foundation.layout.Box -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/detail/DetailScreen.kt b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/detail/DetailScreen.kt index 35fafc7..3ba9a1d 100644 --- a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/detail/DetailScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/detail/DetailScreen.kt @@ -14,14 +14,15 @@ import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.foundation.verticalScroll -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Scaffold -import androidx.compose.material.Text -import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -74,11 +75,15 @@ private fun ObjectDetails( ) { Scaffold( topBar = { - TopAppBar(backgroundColor = MaterialTheme.colors.background) { - IconButton(onClick = onBackClick) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(Res.string.back)) + @OptIn(ExperimentalMaterial3Api::class) + TopAppBar( + title = {}, + navigationIcon = { + IconButton(onClick = onBackClick) { + Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(Res.string.back)) + } } - } + ) }, modifier = modifier.windowInsetsPadding(WindowInsets.systemBars), ) { paddingValues -> @@ -98,7 +103,7 @@ private fun ObjectDetails( SelectionContainer { Column(Modifier.padding(12.dp)) { - Text(obj.title, style = MaterialTheme.typography.h6.copy(fontWeight = FontWeight.Bold)) + Text(obj.title, style = MaterialTheme.typography.headlineMedium) Spacer(Modifier.height(6.dp)) LabeledInfo(stringResource(Res.string.label_title), obj.title) LabeledInfo(stringResource(Res.string.label_artist), obj.artistDisplayName) diff --git a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/list/ListScreen.kt b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/list/ListScreen.kt index 1b9d633..ef2d6e3 100644 --- a/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/list/ListScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/screens/list/ListScreen.kt @@ -18,15 +18,14 @@ import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import coil3.compose.AsyncImage import com.jetbrains.kmpapp.data.MuseumObject @@ -99,11 +98,8 @@ private fun ObjectFrame( Spacer(Modifier.height(2.dp)) - Text( - obj.title, - style = MaterialTheme.typography.subtitle1.copy(fontWeight = FontWeight.Bold) - ) - Text(obj.artistDisplayName, style = MaterialTheme.typography.body2) - Text(obj.objectDate, style = MaterialTheme.typography.caption) + Text(obj.title, style = MaterialTheme.typography.titleMedium) + Text(obj.artistDisplayName, style = MaterialTheme.typography.bodyMedium) + Text(obj.objectDate, style = MaterialTheme.typography.bodySmall) } }