Card done

This commit is contained in:
Nymos 2025-02-18 20:33:24 +03:00
parent 430eddf70f
commit 3743614b84
5 changed files with 52 additions and 14 deletions

View File

@ -2,7 +2,7 @@ package com.nto.data.models.cards
data class VisitCardDTO(
val name: String = "",
val id: String,
val dateString: String,
val isCode: Boolean
val id: String = "",
val dateString: String = "",
val isCode: Boolean = false
)

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@ -12,32 +13,64 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nto.data.models.cards.VisitCardDTO
import com.nto.presentation.R
import com.nto.presentation.theme.NTOTheme
@Composable
fun VisitCard(modifier: Modifier = Modifier) {
fun VisitCard(data: VisitCardDTO, modifier: Modifier = Modifier) {
Row(
modifier = modifier
.width(365.dp)
.height(70.dp)
.clip(RoundedCornerShape(10.dp))
.background(NTOTheme.colors.inputFieldBackground)
.background(NTOTheme.colors.inputFieldBackground),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.fillMaxSize()
.padding(start = 15.dp, end = 15.dp),
horizontalArrangement = Arrangement.SpaceBetween
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Column {
Text("")
Spacer(modifier = Modifier.height(15.dp))
Column(horizontalAlignment = Alignment.Start) {
Text(
text = data.name,
style = NTOTheme.typography.displaySmall,
fontSize = 12.sp,
fontWeight = FontWeight.Bold
)
Spacer(modifier = Modifier.height(10.dp))
Text(
text = data.id,
style = NTOTheme.typography.displaySmall,
fontSize = 12.sp,
fontWeight = FontWeight.Thin
)
}
Column(horizontalAlignment = Alignment.End) {
Text(
text = data.dateString,
style = NTOTheme.typography.displaySmall,
fontSize = 12.sp,
color = NTOTheme.colors.disabledText
)
Spacer(modifier = Modifier.height(10.dp))
Text(
text = stringResource(if (data.isCode) R.string.qr_login_label else R.string.card_login_label),
style = NTOTheme.typography.displaySmall,
fontSize = 12.sp,
color = NTOTheme.colors.disabledText
)
}
Column { }
}
}
}
@ -46,6 +79,6 @@ fun VisitCard(modifier: Modifier = Modifier) {
@Composable
private fun VisitCardPreview() {
NTOTheme {
VisitCard()
VisitCard(VisitCardDTO("Кабинет 207", "id: 129008", "24 января 20:01"))
}
}

View File

@ -146,7 +146,7 @@ fun ProfileScreen(
.fillMaxWidth()
.height(50.dp)
) {
viewModel.scan(navController)
}
}
}

View File

@ -1,10 +1,13 @@
package com.nto.presentation.screens.profileScreen
import androidx.lifecycle.ViewModel
import androidx.navigation.NavController
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class ProfileViewModel @Inject constructor() : ViewModel() {
fun scan(navController: NavController) {
//TODO
}
}

View File

@ -8,4 +8,6 @@
<string name="placholder_email" translatable="false">example@mail.com</string>
<string name="placeholder_password" translatable="false">**********</string>
<string name="title_profile">Профиль</string>
<string name="qr_login_label">Вход по коду</string>
<string name="card_login_label">Вход по карте</string>
</resources>