fix: fixed card code image size

This commit is contained in:
2026-06-14 19:31:38 +03:00
parent b18e99156a
commit 7d6cf9dd7b
2 changed files with 12 additions and 3 deletions
@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@@ -42,6 +43,7 @@ fun Page(name: String, innerPadding: PaddingValues, content: @Composable () -> U
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize()
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.background)
) { ) {
@@ -12,15 +12,18 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import ru.omni_devel.cards.ui.theme.OmniCardsTheme import ru.omni_devel.cards.ui.theme.OmniCardsTheme
class ShowCardActivity : ComponentActivity() { class ShowCardActivity : ComponentActivity() {
@@ -82,14 +85,18 @@ fun ShowCardPage(innerPadding: PaddingValues, cardInfo: CardInfo) {
Page(cardInfo.name, innerPadding) { Page(cardInfo.name, innerPadding) {
Column( Column(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) { ) {
if (bitmap != null) { if (bitmap != null) {
Image( Image(
bitmap = bitmap, bitmap = bitmap,
contentDescription = cardInfo.codeValue, contentDescription = cardInfo.codeValue,
modifier = Modifier.fillMaxWidth(), modifier = Modifier
contentScale = ContentScale.FillWidth .padding(bottom = 8.dp)
.fillMaxWidth()
.weight(1f, fill = false),
contentScale = ContentScale.Fit
) )
Text( Text(
cardInfo.codeValue, cardInfo.codeValue,