import androidx.compose.foundation.text.BasicTextField

import androidx.compose.foundation.layout.Box

import androidx.compose.foundation.layout.fillMaxWidth

import androidx.compose.foundation.layout.padding

import androidx.compose.runtime.*

import androidx.compose.ui.Modifier

import androidx.compose.ui.geometry.Offset

import androidx.compose.ui.graphics.SolidColor

import androidx.compose.ui.text.TextStyle

import androidx.compose.ui.text.input.TextFieldValue

import androidx.compose.ui.text.style.TextAlign

import androidx.compose.ui.unit.dp

import androidx.compose.ui.unit.sp

import kotlinx.coroutines.delay

import java.text.DecimalFormat
val numberFormat = DecimalFormat("#,##0.###")
Box(

    modifier = Modifier

        .weight(2f)

        .padding(8.dp)

        .drawWithContent {

            drawContent()

            drawLine(

                color = holoOrangeLight,

                start = Offset(0f, size.height),

                end = Offset(size.width, size.height),

                strokeWidth = 3f

            )

        },

) {

    var inputValue by remember { mutableStateOf(item.price.value) }

    var isFormatting by remember { mutableStateOf(false) }
    BasicTextField(

        value = inputValue,

        onValueChange = { newValue ->

            // 숫자, 쉼표, 소수점만 허용val filteredValue = newValue.filter { it.isDigit() || it == ',' || it == '.' }

            inputValue = filteredValue

            item.price.value = filteredValue

            isFormatting = true

        },

        maxLines = 1,

        textStyle = TextStyle(

            color = textColor,

            fontSize = 16.sp,

            textAlign = TextAlign.End // 텍스트 오른쪽 정렬

        ),

        modifier = Modifier

            .fillMaxWidth()

            .padding(2.dp),

        cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),

    )
    // 포맷팅 작업을 1초 지연 후에 실행

    LaunchedEffect(inputValue) {

        if (isFormatting) {

            delay(1000) // 1초 지연val numericValue = inputValue.replace(",", "").toDoubleOrNull()

            if (numericValue != null) {

                inputValue = numberFormat.format(numericValue)

                item.price.value = inputValue

            }

            isFormatting = false

        }

    }

}



Y2k 코딩이다 ㅅㅂ 구글 compose팀 해고 안하냐?

Gpt도 포기한 언어인듯

저게 코드냐