PageIndicatorText.kt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package eu.kanade.presentation.reader
  2. import androidx.compose.foundation.layout.Box
  3. import androidx.compose.material3.MaterialTheme
  4. import androidx.compose.material3.Text
  5. import androidx.compose.runtime.Composable
  6. import androidx.compose.ui.graphics.Color
  7. import androidx.compose.ui.graphics.drawscope.Stroke
  8. import androidx.compose.ui.text.ExperimentalTextApi
  9. import androidx.compose.ui.text.TextStyle
  10. import androidx.compose.ui.text.font.FontWeight
  11. import androidx.compose.ui.unit.sp
  12. @OptIn(ExperimentalTextApi::class)
  13. @Composable
  14. fun PageIndicatorText(
  15. currentPage: Int,
  16. totalPages: Int,
  17. ) {
  18. if (currentPage <= 0 || totalPages <= 0) return
  19. val text = "$currentPage / $totalPages"
  20. Box {
  21. Text(
  22. text = text,
  23. color = Color(45, 45, 45),
  24. fontSize = MaterialTheme.typography.bodySmall.fontSize,
  25. fontWeight = FontWeight.Bold,
  26. letterSpacing = 1.sp,
  27. style = TextStyle.Default.copy(
  28. drawStyle = Stroke(width = 4f),
  29. ),
  30. )
  31. Text(
  32. text = text,
  33. color = Color(235, 235, 235),
  34. fontSize = MaterialTheme.typography.bodySmall.fontSize,
  35. fontWeight = FontWeight.Bold,
  36. letterSpacing = 1.sp,
  37. )
  38. }
  39. }