This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MaterialTheme( | |
colorScheme = colorScheme, | |
typography = Typography, | |
content = content | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val colorScheme = when { | |
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { | |
val context = LocalContext.current | |
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) | |
} | |
darkTheme -> DarkColorScheme | |
else -> LightColorScheme | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
MaterialTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colorScheme.background | |
) { | |
LazyColumn(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.layout.* | |
import androidx.compose.material3.* | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.tooling.preview.Preview | |
import androidx.compose.ui.unit.dp | |
@ExperimentalMaterial3Api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalMaterial3Api | |
@Composable | |
fun ItemView() { | |
Card( // Material 3'te Card şuan betada | |
modifier = Modifier.padding(8.dp), | |
colors = CardDefaults.cardColors( | |
containerColor = MaterialTheme.colorScheme.surface, // Burada kart kullandığımız için Material Design surface rengini kullanmamız gerektiğini söylüyor | |
), | |
shape = MaterialTheme.shapes.large, | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun MaterialTheme( | |
darkTheme: Boolean = isSystemInDarkTheme(), | |
// Dynamic color android 12 ve üstü için geçerli | |
dynamicColor: Boolean = true, | |
content: @Composable () -> Unit | |
) { | |
val colorScheme = when { | |
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { | |
val context = LocalContext.current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val LightColorScheme = lightColorScheme( | |
background = lightBackground, | |
primary = lightPrimary, | |
secondary = lightSecondary, | |
surface = lightSurface, | |
onSurface = lightOnSurface | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val DarkColorScheme = darkColorScheme( | |
background = darkBackground, | |
primary = darkPrimary, | |
secondary = darkSecondary, | |
surface = darkSurface, | |
onSurface = darkOnSurface | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val Typography = Typography( | |
bodyLarge = TextStyle( | |
fontFamily = FontFamily.Default, | |
fontWeight = FontWeight.Normal, | |
fontSize = 16.sp, | |
lineHeight = 24.sp, | |
letterSpacing = 0.5.sp | |
), | |
titleLarge = TextStyle( | |
fontFamily = FontFamily.Default, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val lightPrimary = Color(0xFFA784F7) | |
val lightSecondary = Color(0xFF9B75F3) | |
val lightBackground = Color(0xFFC2AEF0) | |
val lightSurface = Color(0xFFA27EF0) | |
val lightOnSurface = Color(0xFF564481) | |
val darkPrimary = Color(0xFF100035) | |
val darkSecondary = Color(0xFF1F0166) | |
val darkBackground = Color(0xFF1D005F) |
NewerOlder