Adjust stats overview icons

Closes #9865
Still sort of weird, but the icons are now always aligned.
This commit is contained in:
arkon 2023-11-26 18:45:16 -05:00
parent bf524595e2
commit 9ce0bc6b5f
2 changed files with 17 additions and 7 deletions

View File

@ -1,8 +1,10 @@
package eu.kanade.presentation.more.stats
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
@ -12,6 +14,7 @@ import androidx.compose.material.icons.outlined.Schedule
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import eu.kanade.presentation.more.stats.components.StatsItem
import eu.kanade.presentation.more.stats.components.StatsOverviewItem
@ -63,22 +66,24 @@ private fun OverviewSection(
.toDurationString(context, fallback = none)
}
StatsSection(MR.strings.label_overview_section) {
Row {
Row(
modifier = Modifier.height(IntrinsicSize.Min),
) {
StatsOverviewItem(
title = data.libraryMangaCount.toString(),
subtitle = stringResource(MR.strings.in_library),
icon = Icons.Outlined.CollectionsBookmark,
)
StatsOverviewItem(
title = data.completedMangaCount.toString(),
subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary,
)
StatsOverviewItem(
title = readDurationString,
subtitle = stringResource(MR.strings.label_read_duration),
icon = Icons.Outlined.Schedule,
)
StatsOverviewItem(
title = data.completedMangaCount.toString(),
subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary,
)
}
}
}

View File

@ -3,6 +3,8 @@ package eu.kanade.presentation.more.stats.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -53,7 +55,9 @@ private fun RowScope.BaseStatsItem(
icon: ImageVector? = null,
) {
Column(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.fillMaxHeight(),
verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
horizontalAlignment = Alignment.CenterHorizontally,
) {
@ -74,6 +78,7 @@ private fun RowScope.BaseStatsItem(
textAlign = TextAlign.Center,
)
if (icon != null) {
Spacer(modifier = Modifier.weight(1f))
Icon(
imageVector = icon,
contentDescription = null,