Merge branch 'frontend/material3-migration' into 'main'

other: migrated to material version 3 (originally version 2)

See merge request EmmaVandewalle/writand!33
This commit is contained in:
Emma Vandewalle 2024-07-25 18:11:15 +00:00
commit 72b63766d9
7 changed files with 27 additions and 27 deletions

View file

@ -59,16 +59,16 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
implementation 'androidx.activity:activity-compose:1.9.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
implementation 'androidx.activity:activity-compose:1.9.1'
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation 'androidx.compose.material:material:1.6.8'
implementation "androidx.compose.material3:material3:1.2.1"
implementation 'androidx.test:core-ktx:1.6.1'
implementation 'com.google.ar:core:1.44.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
// Testing
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
@ -79,7 +79,7 @@ dependencies {
// Mockito testing
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation "org.robolectric:robolectric:4.4"
testImplementation "androidx.test.ext:junit-ktx:1.1.5"
testImplementation "androidx.test.ext:junit-ktx:1.2.1"
testImplementation 'org.powermock:powermock-api-mockito:1.4.12'
testImplementation 'org.powermock:powermock-module-junit4:1.6.2'

View file

@ -4,9 +4,9 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@ -20,7 +20,7 @@ class MainActivity : ComponentActivity() {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.primary
color = MaterialTheme.colorScheme.primary
) {
Greeting("Android")
}

View file

@ -2,9 +2,9 @@ package be.re.writand.screens.components
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@ -25,7 +25,7 @@ fun WButton(
) {
Button(
onClick = onClick,
colors = ButtonDefaults.buttonColors(backgroundColor = MainGreen),
colors = ButtonDefaults.buttonColors(containerColor = MainGreen),
shape = RoundedCornerShape(10.dp),
enabled = enabled
) {

View file

@ -1,7 +1,7 @@
package be.re.writand.ui.theme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.material3.Shapes
import androidx.compose.ui.unit.dp
val Shapes = Shapes(

View file

@ -1,23 +1,23 @@
package be.re.writand.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
private val DarkColorPalette = darkColors(
private val DarkColorPalette = darkColorScheme(
primary = MainGrey,
primaryVariant = VariantDarkGrey,
secondary = MainGreen,
secondary = VariantDarkGrey,
tertiary = MainGreen,
onBackground = Color.White
)
private val LightColorPalette = lightColors(
private val LightColorPalette = lightColorScheme(
primary = Color.White,
primaryVariant = VariantLightGrey,
secondary = MainGreen,
secondary = VariantLightGrey,
tertiary = MainGreen,
onBackground = Color.Black
/* Other default colors to override
@ -39,7 +39,7 @@ fun WritandTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composabl
}
MaterialTheme(
colors = colors,
colorScheme = colors,
typography = Typography,
shapes = Shapes,
content = content,

View file

@ -1,6 +1,6 @@
package be.re.writand.ui.theme
import androidx.compose.material.Typography
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
@ -8,7 +8,7 @@ import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
body1 = TextStyle(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp