fix(#27): replace "Pick" TextButton with trailing calendar icon in DateField
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package dev.achmad.ledgerr.ui.components
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.CalendarMonth
|
||||
import androidx.compose.material3.DatePicker
|
||||
import androidx.compose.material3.DatePickerDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
@@ -36,10 +41,13 @@ fun DateField(
|
||||
onValueChange = {},
|
||||
label = { Text(label) },
|
||||
readOnly = true,
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
modifier = modifier.fillMaxWidth().clickable { showPicker = true },
|
||||
trailingIcon = {
|
||||
TextButton(onClick = { showPicker = true }) {
|
||||
Text(text = stringResource(R.string.action_pick))
|
||||
IconButton(onClick = { showPicker = true }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.CalendarMonth,
|
||||
contentDescription = stringResource(R.string.action_pick),
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -3,10 +3,12 @@ package dev.achmad.ledgerr.ui.components
|
||||
import android.net.Uri
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.CalendarMonth
|
||||
import androidx.compose.material.icons.outlined.IosShare
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.DatePicker
|
||||
@@ -176,10 +178,14 @@ private fun DateField(
|
||||
readOnly = true,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp),
|
||||
.padding(vertical = 4.dp)
|
||||
.clickable { showPicker = true },
|
||||
trailingIcon = {
|
||||
TextButton(onClick = { showPicker = true }) {
|
||||
Text(text = stringResource(R.string.action_pick))
|
||||
IconButton(onClick = { showPicker = true }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.CalendarMonth,
|
||||
contentDescription = stringResource(R.string.action_pick),
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user