Fix add-task sheet expanding to full screen on keyboard

iOS auto-snaps to the next larger detent when keyboard appears over a
text field. Removing .large locks the sheet to .height(150) so it
stays compact and hugs the keyboard like the reference app.
Also removed the Description label and reduced input maxHeight to 72pt
so all content fits within the 150pt detent.
This commit is contained in:
kutesir
2026-05-29 11:18:56 +03:00
parent b6c90a4177
commit 90d0a03eab
3 changed files with 13 additions and 19 deletions

View File

@@ -186,7 +186,7 @@ struct CalendarView: View {
.sheet(isPresented: $showAddTask) { .sheet(isPresented: $showAddTask) {
AddTaskSheet(prefilledDate: selectedDate) AddTaskSheet(prefilledDate: selectedDate)
.environmentObject(taskVM) .environmentObject(taskVM)
.presentationDetents([.height(150), .large]) .presentationDetents([.height(150)])
.presentationDragIndicator(.visible) .presentationDragIndicator(.visible)
} }
.sheet(isPresented: $showCalendarConnect) { .sheet(isPresented: $showCalendarConnect) {

View File

@@ -67,7 +67,7 @@ struct MatrixView: View {
.sheet(isPresented: $showAddTask) { .sheet(isPresented: $showAddTask) {
AddTaskSheet() AddTaskSheet()
.environmentObject(taskVM) .environmentObject(taskVM)
.presentationDetents([.height(150), .large]) .presentationDetents([.height(150)])
.presentationDragIndicator(.visible) .presentationDragIndicator(.visible)
} }
} }

View File

@@ -188,7 +188,7 @@ struct TodayView: View {
.sheet(isPresented: $showAddTask) { .sheet(isPresented: $showAddTask) {
AddTaskSheet() AddTaskSheet()
.environmentObject(taskVM) .environmentObject(taskVM)
.presentationDetents([.height(150), .large]) .presentationDetents([.height(150)])
.presentationDragIndicator(.visible) .presentationDragIndicator(.visible)
} }
.sheet(isPresented: $showWorkoutSession) { .sheet(isPresented: $showWorkoutSession) {
@@ -982,24 +982,18 @@ struct AddTaskSheet: View {
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
// Text input // Text input
VStack(alignment: .leading, spacing: 8) {
NLTaskField( NLTaskField(
text: $rawText, text: $rawText,
placeholder: "What would you like to do?", placeholder: "What would you like to do?",
highlightRanges: parsed.tokenRanges highlightRanges: parsed.tokenRanges
) )
.frame(minHeight: 32, maxHeight: 120) .frame(minHeight: 36, maxHeight: 72)
.onChange(of: rawText) { _ in .onChange(of: rawText) { _ in
withAnimation(KisaniSpring.micro) { parsed = NLTaskParser.parse(rawText) } withAnimation(KisaniSpring.micro) { parsed = NLTaskParser.parse(rawText) }
} }
Text("Description")
.font(AppFonts.sans(15))
.foregroundColor(AppColors.text3(cs))
}
.padding(.horizontal, 16) .padding(.horizontal, 16)
.padding(.top, 16) .padding(.top, 14)
.padding(.bottom, 12) .padding(.bottom, 10)
// Toolbar // Toolbar
Divider().background(AppColors.border(cs)) Divider().background(AppColors.border(cs))