mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
m3 expressive theme
This commit is contained in:
@@ -236,4 +236,5 @@ dependencies {
|
||||
implementation(libs.google.android.material)
|
||||
implementation(libs.androidx.navigation.compose)
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.compose.material3.adaptive)
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,11 +5,11 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.izzy2lost.weeu.common.ui.theme.CemuTheme
|
||||
import com.izzy2lost.weeu.common.ui.theme.WeeUTheme
|
||||
|
||||
@Composable
|
||||
fun ActivityContent(content: @Composable () -> Unit) {
|
||||
CemuTheme {
|
||||
WeeUTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
|
||||
@@ -1,36 +1,154 @@
|
||||
package com.izzy2lost.weeu.common.ui.theme
|
||||
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Shapes
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
private val DarkColorScheme = darkColorScheme()
|
||||
|
||||
private val LightColorScheme = lightColorScheme()
|
||||
|
||||
/**
|
||||
* Material 3 Expressive theme for Wee U
|
||||
* Features dynamic color support and expressive typography/shapes
|
||||
*/
|
||||
@Composable
|
||||
fun CemuTheme(
|
||||
fun WeeUTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val colorScheme = when {
|
||||
dynamicColor -> {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
val context = LocalContext.current
|
||||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||
}
|
||||
|
||||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = ExpressiveTypography,
|
||||
shapes = ExpressiveShapes,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Material 3 Expressive Typography
|
||||
private val ExpressiveTypography = androidx.compose.material3.Typography(
|
||||
displayLarge = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = 64.sp,
|
||||
letterSpacing = (-0.25).sp,
|
||||
),
|
||||
displayMedium = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 45.sp,
|
||||
lineHeight = 52.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
displaySmall = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 44.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineLarge = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineMedium = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 36.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineSmall = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 32.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleLarge = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleMedium = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.15.sp,
|
||||
),
|
||||
titleSmall = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
bodyLarge = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
bodyMedium = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.25.sp,
|
||||
),
|
||||
bodySmall = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.4.sp,
|
||||
),
|
||||
labelLarge = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
labelMedium = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
labelSmall = androidx.compose.ui.text.TextStyle(
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
)
|
||||
|
||||
// Material 3 Expressive Shapes with more rounded, playful corners
|
||||
// Expressive design uses larger corner radii for a more friendly, modern feel
|
||||
private val ExpressiveShapes = androidx.compose.material3.Shapes(
|
||||
extraSmall = androidx.compose.foundation.shape.RoundedCornerShape(12.dp),
|
||||
small = androidx.compose.foundation.shape.RoundedCornerShape(16.dp),
|
||||
medium = androidx.compose.foundation.shape.RoundedCornerShape(20.dp),
|
||||
large = androidx.compose.foundation.shape.RoundedCornerShape(28.dp),
|
||||
extraLarge = androidx.compose.foundation.shape.RoundedCornerShape(36.dp),
|
||||
)
|
||||
|
||||
@@ -7,7 +7,8 @@ kotlin = "2.2.10"
|
||||
androidx-core-ktx = "1.17.0"
|
||||
androidx-activity-compose = "1.10.1"
|
||||
androidx-compose-bom = "2025.08.00"
|
||||
androidx-compose-material3 = "1.3.2"
|
||||
androidx-compose-material3 = "1.4.0-beta01"
|
||||
androidx-compose-material3-adaptive = "1.1.0"
|
||||
google-android-material = "1.12.0"
|
||||
androidx-navigation-compose = "2.9.3"
|
||||
junit = "4.13.2"
|
||||
@@ -34,6 +35,7 @@ androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidx-compose-material3" }
|
||||
androidx-compose-material3-adaptive = { group = "androidx.compose.material3.adaptive", name = "adaptive", version.ref = "androidx-compose-material3-adaptive" }
|
||||
google-android-material = { module = "com.google.android.material:material", version.ref = "google-android-material" }
|
||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||
okhttp-coroutines = { module = "com.squareup.okhttp3:okhttp-coroutines", version.ref = "okhttp" }
|
||||
|
||||
Reference in New Issue
Block a user