feat(blender): add a line as a free amount or a priced gas fill - #2310
alpheios-one wants to merge 5 commits into
Conversation
The line form now switches between a free amount and a gas fill. A gas fill picks O2, helium or the topup gas, takes the cylinder volume, a start pressure and an end pressure seeded from the cylinder preset's working pressure, and prices the pressure filled at that gas's configured rate. The amount is shown as text and saved as a fixed value; a gas without a price is charged at 0. The fill is stored as a single itemised gas line carrying its role and start pressure, so it can be reopened with its values. The informational custom mix is retired. Refs submersion-app#2302
An untouched gas fill keeps the amount and gas name it was billed with when only its description changes, pressures reopen with two decimals, a cubic-foot preset bills its exact water volume, switching a gas fill to a free amount starts from its cost, and an empty pressure gets its own message. Refs submersion-app#2302
A label generated before the diver switched units is still regenerated when the fill changes, and switching a gas fill with a generated label to a free amount carries that label over. Refs submersion-app#2302
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Four moderate issues remain in pricing validation, free-amount initialization, decimal parsing, and cubic-foot preset preservation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds gas-fill and free-amount billing lines to the Trimix blender, including pricing, persistence, editing, localization, and tests.
Changes:
- Adds unit-aware manual gas-fill pricing and validation.
- Adds gas-line persistence, presets, and dedicated editing UI.
- Retires legacy custom-mix metadata and updates translations/tests.
| File | Summary |
|---|---|
test/features/gas_calculators/domain/blend_billing_test.dart |
Pricing and validation tests |
test/features/gas_calculators/blender_invoice_test.dart |
Widget, persistence, and editing tests |
lib/l10n/arb/app_zh.arb |
Chinese localization strings |
lib/l10n/arb/app_pt.arb |
Portuguese localization strings |
lib/l10n/arb/app_nl.arb |
Dutch localization strings |
lib/l10n/arb/app_localizations.dart |
Localization interface updates |
lib/l10n/arb/app_localizations_zh.dart |
Generated Chinese localization |
lib/l10n/arb/app_localizations_pt.dart |
Generated Portuguese localization |
lib/l10n/arb/app_localizations_nl.dart |
Generated Dutch localization |
lib/l10n/arb/app_localizations_it.dart |
Generated Italian localization |
lib/l10n/arb/app_localizations_hu.dart |
Generated Hungarian localization |
lib/l10n/arb/app_localizations_he.dart |
Generated Hebrew localization |
lib/l10n/arb/app_localizations_fr.dart |
Generated French localization |
lib/l10n/arb/app_localizations_es.dart |
Generated Spanish localization |
lib/l10n/arb/app_localizations_en.dart |
Generated English localization |
lib/l10n/arb/app_localizations_de.dart |
Generated German localization |
lib/l10n/arb/app_localizations_ar.dart |
Generated Arabic localization |
lib/l10n/arb/app_it.arb |
Italian localization strings |
lib/l10n/arb/app_hu.arb |
Hungarian localization strings |
lib/l10n/arb/app_he.arb |
Hebrew localization strings |
lib/l10n/arb/app_fr.arb |
French localization strings |
lib/l10n/arb/app_es.arb |
Spanish localization strings |
lib/l10n/arb/app_en.arb |
English localization strings |
lib/l10n/arb/app_de.arb |
German localization strings |
lib/l10n/arb/app_ar.arb |
Arabic localization strings |
lib/features/gas_calculators/presentation/widgets/blender/blender_line_edit_sheet.dart |
Gas-fill and free-amount editor |
lib/features/gas_calculators/presentation/widgets/blender/blender_invoice_card.dart |
Invoice integration |
lib/features/gas_calculators/presentation/pages/blender_invoice_archive_detail_page.dart |
Archived invoice display updates |
lib/features/gas_calculators/domain/blending/blend_billing.dart |
Manual gas-fill pricing |
lib/features/gas_calculators/domain/blending/billed_fill.dart |
Persisted gas-line metadata |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the Updated automatically on each push. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@ericgriffin This is ready for testing. All checks are green, and the only review point is fixed. The "How to Test" section in the description has the shortest path through the new line form. Let me know how you like it. |

Related Issue
Closes #2302
Summary
"Add a line" on the Trimix blender's running bill used to ask for a description, a cylinder, O2 %, He % and an amount typed by hand. The mix fields had no effect on the amount, so billing a single gas meant working the price out by hand even though the gas prices are already configured.
The line form now switches between two kinds and shows only the fields the chosen kind needs:
cylinder volume x (end - start) / 100 x price per 100 l, the same ideal-gas pricingcomputeBlendCostuses, and is shown as text only.Changes
manualGasFillCostinblend_billing.dartprices one hand-entered gas fill. It rejects a missing cylinder, a negative start, an end not above the start and non-finite input. A gas without a price is charged at 0, as agreed in the issue.BilledGasLinegets optionalroleandstartBarfields. A gas fill is stored as aBilledFillwith exactly one such line, so the running bill, the invoice archive and the Excel export itemise it like any computed fill.BilledFill.manualGasLinerecognises it andcopyWithcan now replacelines.BilledCustomMixis retired. Older blobs that still carrycustomMixdecode without it, and no migration is needed.blender_invoice_card.dartintoblender_line_edit_sheet.dart. The invoice card shrinks by about 320 lines.How to Test
Test Plan
flutter test test/features/gas_calculatorspasses (416 tests), including new unit tests for the pricing and the model and widget tests for:flutter analyzepasses