Просмотр исходного кода

Align Meal Note to right.
Add hide text keyboard button.

Jon Mårtensson 2 лет назад
Родитель
Сommit
2bd6751785
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

+ 7 - 3
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -10,7 +10,7 @@ extension AddCarbs {
         @State var isPromtPresented = false
         @State var saved = false
         @State private var showAlert = false
-        @State var displayNote = false
+        @FocusState private var isFocused: Bool
 
         @FetchRequest(
             entity: Presets.entity(),
@@ -56,8 +56,12 @@ extension AddCarbs {
                     }
                     HStack {
                         Text("Note").foregroundColor(.secondary)
-                        TextField("", text: $state.note).frame(maxWidth: .infinity, alignment: .trailing)
-                    }
+                        TextField("", text: $state.note).multilineTextAlignment(.trailing)
+                        if state.note != "", isFocused {
+                            Button { isFocused = false } label: { Image(systemName: "keyboard.chevron.compact.down") }
+                                .controlSize(.mini)
+                        }
+                    }.focused($isFocused)
                     HStack {
                         Button {
                             state.useFPUconversion.toggle()