-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
비밀번호 초기화 로직 변경 #375
비밀번호 초기화 로직 변경 #375
Changes from 27 commits
91826cb
70515b3
f875bb9
fc0f385
bd97c07
0eb4bca
9079d58
b653b8e
2a5633f
e000eb6
6bcfd73
cd0378f
ae33c2d
db75146
9f229d1
9344573
ffa3f52
d709082
2a4dab0
bae4b71
f84ea20
b36691d
664c385
30466c8
58e632d
b26a307
889b285
6e09073
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.wafflestudio.snutt2.components.compose | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.text.BasicTextField | ||
import androidx.compose.foundation.text.KeyboardActions | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.foundation.text.selection.LocalTextSelectionColors | ||
import androidx.compose.foundation.text.selection.TextSelectionColors | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.focus.onFocusChanged | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.platform.LocalFocusManager | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.input.TextFieldValue | ||
import androidx.compose.ui.text.input.VisualTransformation | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.wafflestudio.snutt2.ui.SNUTTColors | ||
import com.wafflestudio.snutt2.ui.SNUTTTypography | ||
|
||
@Composable | ||
fun EditTextFieldValue( | ||
modifier: Modifier = Modifier, | ||
leadingIcon: @Composable (() -> Unit) = {}, | ||
trailingIcon: @Composable (() -> Unit) = {}, | ||
keyboardOptions: KeyboardOptions = KeyboardOptions(), | ||
keyboardActions: KeyboardActions = KeyboardActions(), | ||
singleLine: Boolean = false, | ||
enabled: Boolean = true, | ||
visualTransformation: VisualTransformation = VisualTransformation.None, | ||
value: TextFieldValue, | ||
onValueChange: (TextFieldValue) -> Unit, | ||
hint: String? = null, | ||
hintTextColor: Color = SNUTTColors.EditTextHint, | ||
hintTextStyle: TextStyle = SNUTTTypography.body1.copy(fontSize = 15.sp), | ||
underlineEnabled: Boolean = true, | ||
underlineColor: Color = SNUTTColors.Gray200, | ||
underlineColorFocused: Color = SNUTTColors.Black900, | ||
underlineWidth: Dp = 1.dp, | ||
clearFocusFlag: Boolean = false, | ||
textStyle: TextStyle = SNUTTTypography.subtitle1.copy(color = SNUTTColors.Black900), | ||
) { | ||
val focusManager = LocalFocusManager.current | ||
LaunchedEffect(clearFocusFlag) { | ||
if (clearFocusFlag) focusManager.clearFocus() | ||
} | ||
|
||
var isFocused by remember { mutableStateOf(false) } | ||
val customTextSelectionColors = TextSelectionColors( | ||
handleColor = SNUTTColors.Black900, | ||
backgroundColor = SNUTTColors.Black300, | ||
) | ||
CompositionLocalProvider( | ||
LocalTextSelectionColors provides customTextSelectionColors, | ||
) { | ||
BasicTextField( | ||
modifier = modifier | ||
.onFocusChanged { isFocused = it.isFocused }, | ||
keyboardOptions = keyboardOptions, | ||
keyboardActions = keyboardActions, | ||
value = value, | ||
textStyle = textStyle, | ||
enabled = enabled, | ||
onValueChange = onValueChange, | ||
singleLine = singleLine, | ||
visualTransformation = visualTransformation, | ||
cursorBrush = SolidColor(SNUTTColors.Black900), | ||
decorationBox = { | ||
Column { | ||
Row(modifier = Modifier.fillMaxWidth()) { | ||
leadingIcon() | ||
Box( | ||
modifier = Modifier.weight(1f), | ||
) { | ||
it() | ||
if (value.text.isEmpty()) { | ||
hint?.let { | ||
Text( | ||
text = it, | ||
style = hintTextStyle.copy(color = hintTextColor), | ||
) | ||
} | ||
} | ||
} | ||
trailingIcon() | ||
} | ||
|
||
if (underlineEnabled) { | ||
Box( | ||
modifier = Modifier | ||
.padding(top = 8.dp) | ||
.background(if (isFocused) underlineColorFocused else underlineColor) | ||
.fillMaxWidth() | ||
.height(underlineWidth), | ||
) | ||
} | ||
} | ||
}, | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.wafflestudio.snutt2.components.compose | ||
|
||
import androidx.compose.animation.AnimatedContent | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.drawWithCache | ||
import androidx.compose.ui.geometry.Offset | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.wafflestudio.snutt2.ui.SNUTTColors | ||
import com.wafflestudio.snutt2.ui.SNUTTTypography | ||
|
||
@Composable | ||
fun IOSStyleTopBar( | ||
modifier: Modifier = Modifier, | ||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅋㅋㅋㅋㅋ 이름도 이렇게 지은 김에 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 머터리얼 쓰기 싫어 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅋㅋㅋㅋㅋㅋ |
||
title: String, | ||
backButtonText: String, | ||
onBack: () -> Unit, | ||
) { | ||
Box( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background(color = SNUTTColors.White900) | ||
.height(40.dp) | ||
.drawWithCache { | ||
onDrawWithContent { | ||
drawLine( | ||
color = SNUTTColors.EditTextHint, | ||
start = Offset(0f, this.size.height), end = Offset(this.size.width, this.size.height), | ||
strokeWidth = 0.5.dp.toPx(), | ||
) | ||
drawContent() | ||
} | ||
} | ||
.padding(horizontal = 5.dp), | ||
contentAlignment = Alignment.CenterStart, | ||
) { | ||
Row( | ||
modifier = Modifier.clicks(1000L) { onBack() }, | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
ArrowBackIcon( | ||
colorFilter = ColorFilter.tint(SNUTTColors.Black900), | ||
) | ||
AnimatedContent(backButtonText, label = "") { | ||
Text( | ||
text = it, | ||
style = SNUTTTypography.button, | ||
) | ||
} | ||
} | ||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { | ||
Text( | ||
text = title, | ||
style = SNUTTTypography.h3, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun IOSStyleTopBarPreview() { | ||
IOSStyleTopBar( | ||
title = "비밀번호 재설정", | ||
backButtonText = "로그인", | ||
) { } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 얘는 무슨 용도로 있는거야?
clearFocusFlag 값이 바뀌는 부분을 못찾았어...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그거 EditText 에는 있을걸? 그 SearchPage 상단 EditText에서 x표시 누를때 포커스 해제 용도