From e297e7b644b715c70929c58384823c06177f0e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20M=C3=A5rtensson?= Date: Sun, 13 Aug 2023 23:50:40 +0200 Subject: [PATCH] Align Meal Note to right. Add hide text keyboard button. --- .../Modules/AddCarbs/View/AddCarbsRootView.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift b/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift index d3ac06dce4..976d1ef115 100644 --- a/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift +++ b/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()