Fuel Savings: MPG and fill-up are sliders, not typed fields
The two Fuel Savings figures and the in-list fill-up control were text
fields. A typed figure could sit outside the slider's own bounds, so the
control and the number it claimed to show could disagree, and the decimal
pad needed a Done button to escape.
- Settings: "Average fuel economy" and "Typical fill-up" are now sliders
with a read-out ("45 MPG", "£40" / "40 L") in place of the field. The
warning copy reads "Set a realistic..." rather than "Enter...".
- FuelSavingsAdjustmentView (shared by the Stations Worth-the-Drive header
and the Favourites tab) drops its text field and gains the same read-out;
the typed-value machinery and the -focusFillAmount QA hook go with it.
- Slider bounds live in FuelSavingsCalculator (fillAmountSliderRange/Step,
mpgSliderRange/Step) so the Settings control and the in-list control can
never offer different ranges, and the fill-up slider range stays inside
the calculator's validity ceiling (asserted by test).
- Two tests pin those invariants: every slider position is a valid amount,
and both MPG bounds are valid MPG values. 155 tests, 0 failures.
- Comments that described the removed fields were updated; the keyboard
Done-bar plumbing is kept (no numeric field remains in the app, so it can
no longer fire) rather than deleted, so any field added later still has an
escape route.
Verified on the simulator: Settings shows "Average fuel economy / 45 MPG"
with no field, and the Worth-the-Drive fill-up control shows the unit picker
with a "£40" read-out and a slider. The Settings "Typical fill-up" row sits
below the fold on every simulator available here (and synthetic input cannot
scroll it), so those pixels are unverified.
This commit is contained in:
@@ -202,9 +202,10 @@ struct StationsView: View {
|
||||
// large title at rest, scrolls it away and fades the compact
|
||||
// inline title in. No custom toolbar needed — the native mechanism
|
||||
// only renders text, which is exactly what we want here.
|
||||
// The Worth the Drive fill-up box uses `.decimalPad`, which has no
|
||||
// Return key — give the keyboard a Done button and let a scroll
|
||||
// dismiss it too.
|
||||
// No numeric field is left on this screen — the Worth the Drive
|
||||
// fill-up control is a slider — so no keyboard should appear here.
|
||||
// The Done bar and interactive dismissal stay as the escape hatch
|
||||
// for any field that returns.
|
||||
.keyboardDoneButton()
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
.navigationTitle("FuelBoard")
|
||||
|
||||
Reference in New Issue
Block a user