Skip to content

Commit

Permalink
Merge pull request #34 from utamori/feat/m3
Browse files Browse the repository at this point in the history
migrate to material3
  • Loading branch information
zsmb13 authored Nov 12, 2024
2 parents 370f64d + debcdc8 commit 5bdd7c5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions composeApp/src/commonMain/kotlin/com/jetbrains/kmpapp/App.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 5bdd7c5

Please sign in to comment.