typography
This commit is contained in:
parent
ec06da9e34
commit
21b23fe02c
@ -1,14 +1,13 @@
|
|||||||
package com.example.libary.theme
|
package com.example.libary.theme
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.dynamicDarkColorScheme
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
import androidx.compose.material3.dynamicLightColorScheme
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
private val DarkColorScheme = darkColorScheme(
|
private val DarkColorScheme = darkColorScheme(
|
||||||
@ -25,8 +24,8 @@ private val LightColorScheme = lightColorScheme(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UikitTheme(
|
fun UikitTheme(
|
||||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
darkTheme: Boolean = false,
|
||||||
dynamicColor: Boolean = true,
|
dynamicColor: Boolean = false,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val colorScheme = when {
|
val colorScheme = when {
|
||||||
@ -39,9 +38,13 @@ fun UikitTheme(
|
|||||||
else -> LightColorScheme
|
else -> LightColorScheme
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialTheme(
|
CompositionLocalProvider(
|
||||||
colorScheme = colorScheme,
|
LocalUiKitTypography provides UiKitTypography()
|
||||||
typography = Typography,
|
) {
|
||||||
content = content
|
MaterialTheme(
|
||||||
)
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
113
libary/src/main/java/com/example/libary/theme/UiKitTypography.kt
Normal file
113
libary/src/main/java/com/example/libary/theme/UiKitTypography.kt
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package com.example.libary.theme
|
||||||
|
|
||||||
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.Font
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.example.libary.R
|
||||||
|
|
||||||
|
data class UiKitTypography(
|
||||||
|
val title1Semibold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
),
|
||||||
|
val title1ExtraBold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.W800
|
||||||
|
),
|
||||||
|
val title2Regular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val title2Semibold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
),
|
||||||
|
val title2ExtraBold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.W800
|
||||||
|
),
|
||||||
|
val title3Regular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val title3Medium: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.W500
|
||||||
|
),
|
||||||
|
val title3Semibold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
),
|
||||||
|
val headlineRegular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val headlineMedium: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W500
|
||||||
|
),
|
||||||
|
val textRegular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 15.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val textMedium: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 15.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val captionRegular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val captionSemibold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
),
|
||||||
|
val caption2Regular: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
),
|
||||||
|
val caption2Bold: TextStyle = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontFamily = FontFamily(Font(R.font.main)),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.W700
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val LocalUiKitTypography = staticCompositionLocalOf<UiKitTypography> {
|
||||||
|
error("UiKitTypography not found")
|
||||||
|
}
|
BIN
libary/src/main/res/font/main.ttf
Normal file
BIN
libary/src/main/res/font/main.ttf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user