Skip to content

Commit

Permalink
Merge pull request #77 from PetJournal/refactor/change-to-the-new-bir…
Browse files Browse the repository at this point in the history
…th-date-screen-design

Refactor/change to the new birth date screen design
  • Loading branch information
N0stalgiaUltra authored Nov 12, 2024
2 parents 73952d4 + 2c952b2 commit 9768a7c
Show file tree
Hide file tree
Showing 14 changed files with 420 additions and 403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.soujunior.domain.model.request.PetRaceItemModel
import ir.kaaveh.sdpcompose.sdp

@Composable
fun AutoCompleteDropDown(
Expand All @@ -59,7 +60,7 @@ fun AutoCompleteDropDown(
onDropdownItemSelected: (String) -> Unit = {},
onFocusChange: (Boolean) -> Unit = {}
) {

val colorBorder = MaterialTheme.colorScheme.outline
var expanded by remember {
mutableStateOf(false)
}
Expand Down Expand Up @@ -99,24 +100,22 @@ fun AutoCompleteDropDown(
val stroke = Stroke(
width = 1.dp.toPx(),
pathEffect = PathEffect.dashPathEffect(
intervals = floatArrayOf(8.dp.toPx(), 8.dp.toPx(), 0f)
intervals = floatArrayOf(12.dp.toPx(), 12.dp.toPx(), 0f)
)
)
drawRoundRect(
color = if (isError) Color.Transparent else if (expanded) Color.Transparent else Color.Black,
color = if (isError) Color.Transparent else colorBorder,
style = stroke,
cornerRadius = CornerRadius(10.dp.toPx())
)

}
.border(
2.dp,
if (isError) MaterialTheme.colorScheme.error
else if (expanded) MaterialTheme.colorScheme.primary
else Color.Transparent,
shape = RoundedCornerShape(10.dp)
if (isError) MaterialTheme.colorScheme.error else Color.Transparent,
shape = RoundedCornerShape(10.sdp)
)
.clip(RoundedCornerShape(10.dp)),
.clip(RoundedCornerShape(10.sdp)),


value = textValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import ir.kaaveh.sdpcompose.ssp
@Composable
fun CreateTitleAndImageLogo(
title: String? = "",
titleSecundary: String,
titleSecundary: String? = "",
breadcrumbEnable: Boolean? = false,
breadcrumbIndex: Int? = 0,
modifierImage: Modifier = Modifier,
Expand Down Expand Up @@ -106,11 +106,11 @@ fun CreateTitleAndImageLogo(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.sdp, end = 10.sdp),
.padding(horizontal = 8.sdp),
) {
Text(
text = title,
style = MaterialTheme.typography.titleMedium,
style = MaterialTheme.typography.bodyLarge,
modifier = modifierTextTitle,
color = MaterialTheme.colorScheme.primary,
textAlign = textAlign,
Expand All @@ -119,22 +119,24 @@ fun CreateTitleAndImageLogo(
)
}
}
Spacer(modifier = Modifier.height(spaceBetween))
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.sdp, end = 10.sdp),
) {
Text(
text = titleSecundary,
style = styleTitle,
modifier = modifierTextTitle,
color = MaterialTheme.colorScheme.primary,
textAlign = textAlign,
fontWeight = FontWeight(10),
fontSize = 16.ssp
)
if (!titleSecundary.isNullOrEmpty()) {
Spacer(modifier = Modifier.height(spaceBetween))
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.sdp, end = 10.sdp),
) {
Text(
text = titleSecundary,
style = styleTitle,
modifier = modifierTextTitle,
color = MaterialTheme.colorScheme.primary,
textAlign = textAlign,
fontWeight = FontWeight(10),
fontSize = 16.ssp
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun DashedInputText(
textAlign = TextAlign.Start,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.bodyMedium,
fontSize = 12.ssp,
fontSize = 14.ssp,
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.sdp, bottom = 5.sdp, top = 15.sdp)
Expand Down Expand Up @@ -105,7 +105,7 @@ fun DashedInputText(
onValueChange = { text -> onEvent(text) },
singleLine = true,
textStyle = TextStyle(
fontSize = 15.ssp,
fontSize = 12.ssp,
color = if (isSystemInDarkTheme()) Color.Black else MaterialTheme.colorScheme.onSurface
),
maxLines = 1,
Expand All @@ -131,7 +131,7 @@ fun DashedInputText(
text = placeholderText,
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.outline,
fontSize = 15.ssp
fontSize = 14.ssp
)
}
it()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.soujunior.petjournal.ui.components

import android.util.Log
import androidx.compose.foundation.border
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -34,8 +35,9 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.soujunior.petjournal.R
import ir.kaaveh.sdpcompose.sdp
import ir.kaaveh.sdpcompose.ssp

@Composable
fun DateInputText(
Expand All @@ -51,18 +53,18 @@ fun DateInputText(
) {

var inFocus by remember { mutableStateOf(false) }

val colorBorder = MaterialTheme.colorScheme.outline
Column(modifier = modifier) {
Row {
Text(
text = titleText,
textAlign = TextAlign.Start,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.bodyMedium,
fontSize = 15.sp,
fontSize = 14.ssp,
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.dp, bottom = 5.dp)
.padding(start = 10.sdp, bottom = 5.sdp)
)
}
Row {
Expand All @@ -72,8 +74,8 @@ fun DateInputText(
OutlinedTextField(
modifier = textInputModifier
.fillMaxWidth()
.padding(5.dp)
.height(50.dp)
.padding(5.sdp)
.height(45.sdp)
.onFocusChanged {
inFocus = if (it.hasFocus)
it.hasFocus
Expand All @@ -85,23 +87,22 @@ fun DateInputText(
val stroke = Stroke(
width = 1.dp.toPx(),
pathEffect = PathEffect.dashPathEffect(
intervals = floatArrayOf(8.dp.toPx(), 8.dp.toPx(), 8.dp.toPx())
intervals = floatArrayOf(12.dp.toPx(), 12.dp.toPx(), 0f)
)
)
drawRoundRect(
color = if (isError) Color.Transparent else if (inFocus) Color.Transparent else Color.Black,
color = if (isError) Color.Transparent else colorBorder,
style = stroke,
cornerRadius = CornerRadius(10.dp.toPx())
)

}
.border(
2.dp,
if (isError) MaterialTheme.colorScheme.error
else if (inFocus) MaterialTheme.colorScheme.primary
else Color.Transparent,
shape = RoundedCornerShape(10.dp)
if (isError) MaterialTheme.colorScheme.error else Color.Transparent,
shape = RoundedCornerShape(10.sdp)
)
.clip(RoundedCornerShape(10.dp)),
.clip(RoundedCornerShape(10.sdp)),

value = textValue,
onValueChange = { newValue ->
Expand All @@ -112,7 +113,7 @@ fun DateInputText(
}
},
textStyle = TextStyle(
fontSize = 15.sp,
fontSize = 14.ssp,
color = MaterialTheme.colorScheme.onSurface
),
placeholder = { Text(text = placeholderText) },
Expand All @@ -135,7 +136,7 @@ fun DateInputText(
painter = painterResource(id = iconResource),
contentDescription = contentDescription,
tint = Color.Unspecified,
modifier = Modifier.padding(10.dp)
modifier = Modifier.padding(10.sdp)
)
} else if (textValue.length >= 7) {
val iconResource = R.drawable.icone_verificado_ok
Expand All @@ -145,7 +146,7 @@ fun DateInputText(
painter = painterResource(id = iconResource),
contentDescription = contentDescription,
tint = Color.Unspecified,
modifier = Modifier.padding(10.dp)
modifier = Modifier.padding(10.sdp)
)
}
}
Expand All @@ -158,14 +159,14 @@ fun DateInputText(
Row {
if (textError != null) {
textError.forEach {
AlertText(textMessage = it, modifier = Modifier.padding(10.dp))
AlertText(textMessage = it, modifier = Modifier.padding(10.sdp))
}
} else {
Text(
"*Campo Obrigatório.",
color = MaterialTheme.colorScheme.outline,
modifier = Modifier.padding(10.dp),
fontSize = 15.sp
color = if (isSystemInDarkTheme()) Color.White else MaterialTheme.colorScheme.outline,
modifier = Modifier.padding(10.sdp),
fontSize = 12.ssp
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.soujunior.domain.model.request.PetSizeItemModel
import ir.kaaveh.sdpcompose.sdp

@Composable
fun DropDown(
Expand All @@ -51,7 +52,7 @@ fun DropDown(
textValue: String
) {
var isDropdownExpanded by remember { mutableStateOf(false) }

val colorBorder = MaterialTheme.colorScheme.outline

Column(modifier = modifier) {
Row {
Expand All @@ -78,26 +79,22 @@ fun DropDown(
val stroke = Stroke(
width = 1.dp.toPx(),
pathEffect = PathEffect.dashPathEffect(
intervals = floatArrayOf(8.dp.toPx(), 8.dp.toPx(), 0f)
intervals = floatArrayOf(12.dp.toPx(), 12.dp.toPx(), 0f)
)
)


drawRoundRect(
color = if (isError) Color.Transparent else if (isDropdownExpanded) Color.Transparent else Color.Black,
color = if (isError) Color.Transparent else colorBorder,
style = stroke,
cornerRadius = CornerRadius(10.dp.toPx())
)

}
.border(
2.dp,
if (isError) MaterialTheme.colorScheme.error
else if (isDropdownExpanded) MaterialTheme.colorScheme.primary
else Color.Transparent,
shape = RoundedCornerShape(10.dp)
if (isError) MaterialTheme.colorScheme.error else Color.Transparent,
shape = RoundedCornerShape(10.sdp)
)
.clip(RoundedCornerShape(10.dp))
.clip(RoundedCornerShape(10.sdp))
.clickable { isDropdownExpanded = true }
) {
Text(
Expand Down
Loading

0 comments on commit 9768a7c

Please sign in to comment.