فهرست منبع

Improve recommended bolus to be visible as touch target

Deniz Cengiz 1 سال پیش
والد
کامیت
8994789d9c
1فایلهای تغییر یافته به همراه20 افزوده شده و 12 حذف شده
  1. 20 12
      Trio/Sources/Modules/Treatments/View/TreatmentsRootView.swift

+ 20 - 12
Trio/Sources/Modules/Treatments/View/TreatmentsRootView.swift

@@ -256,18 +256,26 @@ extension Treatments {
                                         .buttonStyle(PlainButtonStyle())
                                 }
                                 Spacer()
-                                Text(
-                                    formatter
-                                        .string(from: Double(state.insulinCalculated) as NSNumber) ?? ""
-                                )
-                                Text(
-                                    NSLocalizedString(
-                                        " U",
-                                        comment: "Unit in number of units delivered (keep the space character!)"
-                                    )
-                                ).foregroundColor(.secondary)
-                            }.contentShape(Rectangle())
-                                .onTapGesture { state.amount = state.insulinCalculated }
+                                Button {
+                                    state.amount = state.insulinCalculated
+                                } label: {
+                                    HStack {
+                                        Text(
+                                            formatter
+                                                .string(from: Double(state.insulinCalculated) as NSNumber) ?? ""
+                                        )
+
+                                        Text(
+                                            NSLocalizedString(
+                                                " U",
+                                                comment: "Unit in number of units delivered (keep the space character!)"
+                                            )
+                                        ).foregroundColor(.secondary)
+                                    }
+                                }
+                                .disabled(state.insulinCalculated == 0 || state.amount == state.insulinCalculated)
+                                .buttonStyle(.bordered).padding(.trailing, -10)
+                            }
 
                             HStack {
                                 Text("Bolus")