Skip to content

Commit 251f839

Browse files
committed
fix: Reduce icon button spacing in dialog text fields
1 parent 9a6fa0c commit 251f839

1 file changed

Lines changed: 38 additions & 16 deletions

File tree

app/src/main/java/app/morphe/manager/ui/screen/shared/MorpheDialogTextField.kt

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ package app.morphe.manager.ui.screen.shared
77

88
import androidx.compose.foundation.clickable
99
import androidx.compose.foundation.interaction.MutableInteractionSource
10-
import androidx.compose.foundation.layout.Arrangement
11-
import androidx.compose.foundation.layout.Box
12-
import androidx.compose.foundation.layout.Row
13-
import androidx.compose.foundation.layout.fillMaxWidth
10+
import androidx.compose.foundation.layout.*
1411
import androidx.compose.foundation.shape.RoundedCornerShape
1512
import androidx.compose.foundation.text.KeyboardActions
1613
import androidx.compose.foundation.text.KeyboardOptions
@@ -65,10 +62,16 @@ fun MorpheDialogTextField(
6562
leadingIcon = leadingIcon,
6663
trailingIcon = {
6764
if (isPassword || showClearButton || onFolderPickerClick != null || onFilePickerClick != null) {
68-
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
65+
Row(
66+
horizontalArrangement = Arrangement.spacedBy(4.dp),
67+
modifier = Modifier.padding(end = 4.dp)
68+
) {
6969
// Password visibility toggle
7070
if (isPassword) {
71-
IconButton(onClick = { passwordVisible = !passwordVisible }) {
71+
IconButton(
72+
onClick = { passwordVisible = !passwordVisible },
73+
modifier = Modifier.size(40.dp)
74+
) {
7275
Icon(
7376
imageVector = if (passwordVisible) {
7477
Icons.Outlined.VisibilityOff
@@ -87,7 +90,10 @@ fun MorpheDialogTextField(
8790

8891
// Clear button
8992
if (showClearButton && value.isNotBlank()) {
90-
IconButton(onClick = { onValueChange("") }) {
93+
IconButton(
94+
onClick = { onValueChange("") },
95+
modifier = Modifier.size(40.dp)
96+
) {
9197
Icon(
9298
imageVector = Icons.Outlined.Clear,
9399
contentDescription = stringResource(R.string.clear),
@@ -98,7 +104,10 @@ fun MorpheDialogTextField(
98104

99105
// Folder picker button
100106
if (onFolderPickerClick != null) {
101-
IconButton(onClick = onFolderPickerClick) {
107+
IconButton(
108+
onClick = onFolderPickerClick,
109+
modifier = Modifier.size(40.dp)
110+
) {
102111
Icon(
103112
imageVector = Icons.Outlined.FolderOpen,
104113
contentDescription = stringResource(R.string.patch_option_pick_folder),
@@ -109,7 +118,10 @@ fun MorpheDialogTextField(
109118

110119
// File picker button
111120
if (onFilePickerClick != null) {
112-
IconButton(onClick = onFilePickerClick) {
121+
IconButton(
122+
onClick = onFilePickerClick,
123+
modifier = Modifier.size(40.dp)
124+
) {
113125
Icon(
114126
imageVector = Icons.AutoMirrored.Outlined.InsertDriveFile,
115127
contentDescription = stringResource(R.string.patch_option_pick_file),
@@ -213,11 +225,15 @@ fun MorpheDialogDropdownTextField(
213225
trailingIcon = {
214226
Row(
215227
horizontalArrangement = Arrangement.spacedBy(4.dp),
216-
verticalAlignment = Alignment.CenterVertically
228+
verticalAlignment = Alignment.CenterVertically,
229+
modifier = Modifier.padding(end = 4.dp)
217230
) {
218231
// Folder picker button
219232
if (onFolderPickerClick != null) {
220-
IconButton(onClick = onFolderPickerClick) {
233+
IconButton(
234+
onClick = onFolderPickerClick,
235+
modifier = Modifier.size(40.dp)
236+
) {
221237
Icon(
222238
imageVector = Icons.Outlined.FolderOpen,
223239
contentDescription = stringResource(R.string.patch_option_pick_folder),
@@ -228,7 +244,10 @@ fun MorpheDialogDropdownTextField(
228244

229245
// Clear button
230246
if (showClearButton && value.isNotBlank()) {
231-
IconButton(onClick = { onValueChange("") }) {
247+
IconButton(
248+
onClick = { onValueChange("") },
249+
modifier = Modifier.size(40.dp)
250+
) {
232251
Icon(
233252
imageVector = Icons.Outlined.Clear,
234253
contentDescription = stringResource(R.string.clear),
@@ -238,10 +257,13 @@ fun MorpheDialogDropdownTextField(
238257
}
239258

240259
// Dropdown arrow
241-
IconButton(onClick = {
242-
dropdownExpanded = !dropdownExpanded
243-
if (!dropdownExpanded) readOnly = true
244-
}) {
260+
IconButton(
261+
onClick = {
262+
dropdownExpanded = !dropdownExpanded
263+
if (!dropdownExpanded) readOnly = true
264+
},
265+
modifier = Modifier.size(40.dp)
266+
) {
245267
Icon(
246268
imageVector = if (dropdownExpanded)
247269
Icons.Outlined.ExpandLess

0 commit comments

Comments
 (0)