Move FixedScaleImage previews to debug

This commit is contained in:
Wolf-Martell Montwé 2024-03-20 15:59:47 +01:00
parent 1d6406d48e
commit c03be8a124
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
2 changed files with 76 additions and 72 deletions

View file

@ -0,0 +1,76 @@
package app.k9mail.core.ui.compose.designsystem.atom.image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.core.ui.compose.theme2.MainTheme
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageBottomCenterPreview() {
PreviewWithTheme {
Box(
modifier = Modifier
.width(MainTheme.sizes.huge)
.height(MainTheme.sizes.huge),
) {
FixedScaleImage(
id = MainTheme.images.logo,
alignment = Alignment.BottomCenter,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageCroppedPreview() {
PreviewWithTheme {
Box(
modifier = Modifier
.width(MainTheme.sizes.medium)
.height(MainTheme.sizes.medium),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageHorizontallyCroppedPreview() {
PreviewWithTheme {
Box(
modifier = Modifier
.width(MainTheme.sizes.huge)
.height(MainTheme.sizes.medium),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageVerticallyCroppedPreview() {
PreviewWithTheme {
Box(
modifier = Modifier
.width(MainTheme.sizes.medium)
.height(MainTheme.sizes.huge),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}

View file

@ -2,20 +2,13 @@ package app.k9mail.core.ui.compose.designsystem.atom.image
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.FixedScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
/**
* An image that has a fixed size and does not scale with the available space. It could be cropped, if the size of the
@ -41,68 +34,3 @@ fun FixedScaleImage(
contentScale = FixedScale(scale),
)
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageBottomCenterPreview() {
ThunderbirdTheme {
Box(
modifier = Modifier
.width(200.dp)
.height(200.dp),
) {
FixedScaleImage(
id = MainTheme.images.logo,
alignment = Alignment.BottomCenter,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageCroppedPreview() {
ThunderbirdTheme {
Box(
modifier = Modifier
.width(40.dp)
.height(40.dp),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageHorizontallyCroppedPreview() {
ThunderbirdTheme {
Box(
modifier = Modifier
.width(200.dp)
.height(20.dp),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}
@Composable
@Preview(showBackground = true)
internal fun FixedScaleImageVerticallyCroppedPreview() {
ThunderbirdTheme {
Box(
modifier = Modifier
.width(20.dp)
.height(200.dp),
) {
FixedScaleImage(
id = MainTheme.images.logo,
)
}
}
}