Skip to content

Commit

Permalink
Merge pull request #1019 from masah517/feature/profile-edit-screen-de…
Browse files Browse the repository at this point in the history
…sign-enhancement

[ProfileCardScreen] Design enhancement
  • Loading branch information
takahirom authored Sep 11, 2024
2 parents 39ac19d + 3f470de commit bc763b7
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.outlined.Cancel
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CircularProgressIndicator
Expand Down Expand Up @@ -415,6 +416,10 @@ internal fun EditScreen(
nickname = it
onChangeNickname(it)
},
onInputClear = {
nickname = ""
onChangeNickname("")
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
)
InputFieldWithError(
Expand All @@ -426,6 +431,10 @@ internal fun EditScreen(
occupation = it
onChangeOccupation(it)
},
onInputClear = {
occupation = ""
onChangeOccupation("")
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
)
val linkLabel = stringResource(ProfileCardRes.string.link)
Expand All @@ -439,6 +448,10 @@ internal fun EditScreen(
link = it
onChangeLink(it)
},
onInputClear = {
link = ""
onChangeLink("")
},
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Uri,
Expand Down Expand Up @@ -530,6 +543,7 @@ private fun InputFieldWithError(
errorMessage: String,
textFieldTestTag: String,
onValueChange: (String) -> Unit,
onInputClear: () -> Unit,
modifier: Modifier = Modifier,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
Expand All @@ -550,6 +564,25 @@ private fun InputFieldWithError(
value = value,
textStyle = MaterialTheme.typography.bodyLarge,
onValueChange = onValueChange,
trailingIcon = {
if (value.isNotEmpty()) {
IconButton(
onClick = onInputClear,
modifier = Modifier
.padding(
top = 8.dp,
bottom = 8.dp,
end = 4.dp,
),
) {
Icon(
modifier = Modifier.padding(8.dp),
imageVector = Icons.Outlined.Cancel,
contentDescription = stringResource(ProfileCardRes.string.delete),
)
}
}
},
isError = isError,
shape = RoundedCornerShape(4.dp),
keyboardOptions = keyboardOptions,
Expand Down

0 comments on commit bc763b7

Please sign in to comment.