@@ -78,7 +78,9 @@ import androidx.compose.ui.draw.clip
7878import androidx.compose.ui.graphics.Brush.Companion.linearGradient
7979import androidx.compose.ui.graphics.graphicsLayer
8080import androidx.compose.ui.input.nestedscroll.nestedScroll
81+ import androidx.compose.ui.platform.LocalConfiguration
8182import androidx.compose.ui.platform.LocalContext
83+ import androidx.compose.ui.platform.LocalDensity
8284import androidx.compose.ui.platform.LocalUriHandler
8385import androidx.compose.ui.res.stringResource
8486import androidx.compose.ui.text.LinkAnnotation
@@ -420,6 +422,9 @@ private fun AppTitle() {
420422 val firstLineText = stringResource(R .string.app_name_first_part)
421423 val secondLineText = stringResource(R .string.app_name_second_part)
422424 val titleColor = MaterialTheme .customColors.appTitleGradientColors[1 ]
425+ val screenWidthInDp = LocalConfiguration .current.screenWidthDp.dp
426+ val fontSize = with (LocalDensity .current) { (screenWidthInDp.toPx() * 0.12f ).toSp() }
427+ val titleStyle = homePageTitleStyle.copy(fontSize = fontSize, lineHeight = fontSize)
423428
424429 // First line text "Google AI" and its animation.
425430 //
@@ -433,15 +438,15 @@ private fun AppTitle() {
433438 var delay = ANIMATION_INIT_DELAY
434439 SwipingText (
435440 text = firstLineText,
436- style = homePageTitleStyle ,
441+ style = titleStyle ,
437442 color = titleColor,
438443 animationDelay = delay,
439444 animationDurationMs = TITLE_FIRST_LINE_ANIMATION_DURATION ,
440445 )
441446 delay + = (TITLE_FIRST_LINE_ANIMATION_DURATION * 0.3 ).toLong()
442447 SwipingText (
443448 text = firstLineText,
444- style = homePageTitleStyle ,
449+ style = titleStyle ,
445450 color = MaterialTheme .colorScheme.onSurface,
446451 animationDelay = delay,
447452 animationDurationMs = TITLE_FIRST_LINE_ANIMATION_DURATION ,
@@ -455,7 +460,7 @@ private fun AppTitle() {
455460 var delay = TITLE_SECOND_LINE_ANIMATION_START
456461 SwipingText (
457462 text = secondLineText,
458- style = homePageTitleStyle ,
463+ style = titleStyle ,
459464 color = titleColor,
460465 modifier = Modifier .offset(y = (- 16 ).dp),
461466 animationDelay = delay,
@@ -464,7 +469,7 @@ private fun AppTitle() {
464469 delay + = (TITLE_SECOND_LINE_ANIMATION_DURATION * 0.3 ).toInt()
465470 SwipingText (
466471 text = secondLineText,
467- style = homePageTitleStyle ,
472+ style = titleStyle ,
468473 color = MaterialTheme .colorScheme.onSurface,
469474 modifier = Modifier .offset(y = (- 16 ).dp),
470475 animationDelay = delay,
@@ -474,10 +479,10 @@ private fun AppTitle() {
474479 RevealingText (
475480 text = secondLineText,
476481 style =
477- homePageTitleStyle .copy(
482+ titleStyle .copy(
478483 brush = linearGradient(colors = MaterialTheme .customColors.appTitleGradientColors)
479484 ),
480- modifier = Modifier .offset(y = (- 8 ).dp, x = (- 8 ).dp),
485+ modifier = Modifier .offset(x = (- 16 ).dp, y = (- 16 ).dp),
481486 animationDelay = delay,
482487 animationDurationMs = TITLE_SECOND_LINE_ANIMATION_DURATION2 ,
483488 )
0 commit comments