Skip to content

Commit d9a4688

Browse files
authored
style: Add shadow to text on image preview page (#1296)
1 parent 877714d commit d9a4688

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

app/src/main/kotlin/li/songe/gkd/ui/ImagePreviewPage.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ import androidx.compose.runtime.getValue
2828
import androidx.compose.runtime.remember
2929
import androidx.compose.ui.Alignment
3030
import androidx.compose.ui.Modifier
31+
import androidx.compose.ui.geometry.Offset
32+
import androidx.compose.ui.graphics.Color
33+
import androidx.compose.ui.graphics.Shadow
3134
import androidx.compose.ui.layout.ContentScale
3235
import androidx.compose.ui.platform.LocalContext
36+
import androidx.compose.ui.platform.LocalDensity
3337
import androidx.compose.ui.text.style.TextOverflow
3438
import androidx.compose.ui.unit.dp
3539
import androidx.compose.ui.zIndex
@@ -105,6 +109,16 @@ fun ImagePreviewPage(route: ImagePreviewRoute) {
105109
maxLines = 1,
106110
softWrap = false,
107111
overflow = TextOverflow.MiddleEllipsis,
112+
style = MaterialTheme.typography.titleLarge.copy(
113+
color = MaterialTheme.colorScheme.onBackground,
114+
shadow = Shadow(
115+
color = Color.Black.copy(alpha = 0.7f),
116+
blurRadius = with(LocalDensity.current) { 2.dp.toPx() },
117+
offset = with(LocalDensity.current) {
118+
Offset( 1.dp.toPx(), 1.dp.toPx() )
119+
}
120+
)
121+
)
108122
)
109123
}
110124
},
@@ -142,7 +156,13 @@ fun ImagePreviewPage(route: ImagePreviewRoute) {
142156
) {
143157
Text(
144158
text = "${state.currentPage + 1}/${uris.size}",
145-
style = MaterialTheme.typography.titleLarge
159+
style = MaterialTheme.typography.titleLarge.copy(
160+
color = MaterialTheme.colorScheme.onPrimary,
161+
shadow = Shadow(
162+
color = Color.Black.copy(alpha = 0.8f),
163+
blurRadius = with(LocalDensity.current) { 3.dp.toPx() }
164+
)
165+
)
146166
)
147167
}
148168
}

0 commit comments

Comments
 (0)