tgyuuAn / BaekyoungE

자연어 처리 기반 진로 상담 chat bot 어플리케이션
5 stars 0 forks source link

[FEATURE]: 빠른 MVP 배포를 위해 일단 계정 설정 페이지부터 챱챱 #37

Closed tgyuuAn closed 2 months ago

tgyuuAn commented 2 months ago

작업 사항

이거만 구현해놓고 먼저 스토어 심사 넣어 놔야지,,,,

image

Todo

기타사항

오우 너무 너무 귀찮은 것...!

tgyuuAn commented 2 months ago

StateFlow를 사용할 때, Emit vs Value

https://stackoverflow.com/questions/66669612/mutablestateflow-difference-between-value-and-emit

(아직 확실하지 않아서,,, 추가 공부 필요...!)

tgyuuAn commented 2 months ago

Compose Modal BottomSheet

공식문서

tgyuuAn commented 2 months ago

Button 내부에 있는 Text 가운데 정렬을 하고 싶다구요?

레퍼런스

 textAlign = TextAlign.Center,  // horizontal center of the text
                modifier = Modifier.align(Alignment.CenterVertically) //vertical center of the Text composable

textAlign과 rowScopeAlignment의 align을 사용하면 해결할 수 있습니다욧

tgyuuAn commented 2 months ago

rememberCoroutineScope() 를 어디까지 호이스팅 할 수 있을까...?

처음 사고

Composable 함수 안에서 Coroutine 을 사용하기 위해서는, rememberCoroutineScope()와 같이 코루틴 스코프를 따로 열어줘야하는데,

이거 그냥 사용하는 컴포저블 함수 내부가 아니라 Route 단위의 가장 최상위 Composable까지 호이스팅해서 올려버리면,

하나의 코루틴 스코프로 모든 중단 함수를 실행할 수 있으니까 더 좋은거 아니야 ...? 라고 생각했다.







깨달음..

근데,, 만약 그렇게 하게 될 경우 해당 Composable의 생명 주기가 끝났음에도 해당 중단함수는 게속해서 실행되게 된다...

해당 Composable 함수가 죽으면 해당 중단 함수도 취소되어야지...!

즉, 해당 Composable에만 종속되어야 할 경우 해당 Composable 내부에 rememberCoroutineScope()를 하는 것이 맞고,

뭐 그럴 경우는 좀 드물겠지만 해당 Composable 외부의 영역까지 퍼지는 sideEffect가 있어야 한다면 외부에 생성해서 넘겨주는....? (아직 잘 생각은 안난다.)

레퍼런스

tgyuuAn commented 2 months ago

remember() 과 rememberUpdateState()의 차이점.

핵심 : rememberUpdateState() 를 사용하면, 상위 Composable에서 주어진 데이터하위 Composable에서 또 저장해야 하는 경우를 손쉽게 핸들링 할 수 있음.




아래는 rememberUpdateState()의 원형...!

@Composable
fun <T> rememberUpdatedState(newValue: T): State<T> = remember {
    mutableStateOf(newValue)
}.apply { value = newValue }

아직까지 근데 상위 Composable에서 주어진 데이터하위 Composable에서 또 저장해야 하는 경우 가 있나..? 라는 생각이 들어서,,, Keep...!

레퍼런스

tgyuuAn commented 2 months ago

wheelPicker

git 사용법

이건 .... 아직 내 레벨이..

일단 라이브러리 사용하고 추후에 뜯어보고 공부해서 직접 만들어보자 ..

android-jinho commented 2 months ago

tgyuu it's little bit simple yeah.

when you finish feature develop

you just make "label" (No github Repo, you can make virtual label yeah)

and signed in jitpack

and enter your github repeository

and click getit button yeah and,

you can get custom lib from jitpack yeah

tgyuuAn commented 2 months ago

tgyuu it's little bit simple yeah.

when you finish feature develop

you just make "label" (No github Repo, you can make virtual label yeah)

and signed in jitpack

and enter your github repeository

and click getit button yeah and,

you can get custom lib from jitpack yeah

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ이곤 무옄ㅋㅋㅋㅋ😊😊

tgyuuAn commented 2 months ago

Android Compose Modal BottomSheet 드래그로 사라지는 것 막기

대안 1. verticalScrollDisabled() Modifier 사용.

레퍼런스

fun Modifier.verticalScrollDisabled() =
    pointerInput(Unit) {
        awaitPointerEventScope {
            while (true) {
                awaitPointerEvent(pass = PointerEventPass.Initial).changes.forEach {
                    val offset = it.positionChange()
                    if (abs(offset.y) > 0f) {
                        it.consume()
                    }
                }
            }
        }
    }

결과




대안 2. rememberModalBottomSheetState에서 confirmStateChanged를 false로 바꿈

val state = rememberModalBottomSheetState(
    initialValue= ModalBottomSheetValue.Hidden, 
    confirmStateChange = {false})

결과




image

image

image

추천 레퍼런스1

추천 레퍼런스2

일단 마이그레이션 비용 좀 있으니 Keep...

tgyuuAn commented 2 months ago

EditTextField에 바로 Focus 줘서 Keyboard 올라가게 하는 법!!

레퍼런스

val focusRequester = remember { FocusRequester() }

LaunchedEffect(true) {
    focusRequester.requestFocus()
}

SettingTextField(
    text = newMajor,
    onTextChanged = onNewMajorChanged,
    onConfirm = { },
    hint = stringResource(id = R.string.hint_nickname),
    modifier = Modifier
        .padding(horizontal = 20.dp)
        .focusRequester(focusRequester),     // <- 포커스 주고싶은 곳에다가 modifier 달아부려
)