룰렛 설정 입력 가시성과 프로필 메뉴 레이아웃 개선
룰렛 설정에서 입력 필드 포커스 시 항목을 중앙으로 이동한다. 키보드에 가려지지 않도록 입력 가시성을 높인다. 프로필 메뉴 오버레이의 하단 안전영역 패딩을 제거한다.
This commit is contained in:
@@ -12,6 +12,7 @@ struct RouletteSettingsOptionView: View {
|
||||
@ObservedObject var option: RouletteOption
|
||||
|
||||
let index: Int
|
||||
var focusedField: FocusState<RouletteSettingsFocusField?>.Binding
|
||||
let onClickDelete: () -> Void
|
||||
let calculateTotalPercentage: () -> Void
|
||||
|
||||
@@ -39,6 +40,7 @@ struct RouletteSettingsOptionView: View {
|
||||
.appFont(size: 13.3, weight: .medium)
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
.keyboardType(.default)
|
||||
.focused(focusedField, equals: .optionTitle(option.id))
|
||||
.padding(.horizontal, 13.3)
|
||||
.padding(.vertical, 16.7)
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -52,6 +54,7 @@ struct RouletteSettingsOptionView: View {
|
||||
.appFont(size: 13.3, weight: .medium)
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
.keyboardType(.decimalPad)
|
||||
.focused(focusedField, equals: .optionPercentage(option.id))
|
||||
.onChange(of: option.percentage) { newValue in
|
||||
if newValue.count > 5 {
|
||||
option.percentage = String(newValue.prefix(5))
|
||||
@@ -76,9 +79,18 @@ struct RouletteSettingsOptionView: View {
|
||||
|
||||
struct RouletteSettingsOptionView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
PreviewContainer()
|
||||
}
|
||||
}
|
||||
|
||||
private struct PreviewContainer: View {
|
||||
@FocusState private var focusedField: RouletteSettingsFocusField?
|
||||
|
||||
var body: some View {
|
||||
RouletteSettingsOptionView(
|
||||
option: RouletteOption(title: "옵션1", percentage: ""),
|
||||
index: 2,
|
||||
focusedField: $focusedField,
|
||||
onClickDelete: {},
|
||||
calculateTotalPercentage: {}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user