Checkbox
PaymentCheckbox lets people agree to something or opt in, such as saving a card. The box, the label and the description form one row that toggles on a tap anywhere.




PaymentCheckbox( value: _sms, onChanged: (v) => setState(() => _sms = v), label: 'SMS receipt', );Variants
Section titled “Variants”Variants: unchecked, checked, indeterminate.
Checked and unchecked
Section titled “Checked and unchecked”A checked box is filled with the accent and shows a check mark in onAccent. An unchecked box has a 2 px edge in the 3:1 border color, so it stays visible on any surface.
Disabled
Section titled “Disabled”Pass onChanged: null. The label turns muted, the box uses the disabled color, and taps do nothing. Pass disabledReason; it replaces description while the row is disabled.
const PaymentCheckbox( value: false, onChanged: null, label: 'Use as default card', disabledReason: 'Save the card first',);Pattern adoption
Section titled “Pattern adoption”VerificationIntro uses a checkbox for consent and PaymentConfirmation uses one for changed-total approval. Both use the same 48 dp row and 20 dp mark slot, aligned with the section gutter. The consent sentence uses the label role and wraps at large text.
Behavior, states and migration
Section titled “Behavior, states and migration”Indeterminate paints a dash and announces mixed. It ignores value and reports true when tapped, supporting select-all controls. Error text adds a danger icon, text and an unchecked danger edge. Required is spoken; the host still gates submission. HiddenElements hides label, description or error visually while retaining them in semantics. Do not rely on color alone or hide the only visible recovery instruction.
Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| Select all statement rows | indeterminate | Use mixed state when some page rows are selected; consent starts unchecked. |
Use Radio for one mutually exclusive choice.
States
Section titled “States”The host supplies unchecked, checked or indeterminate state. A null onChanged disables interaction while keeping the label and description readable.
Do and don’t
Section titled “Do and don’t”Do: Use mixed state when some page rows are selected; consent starts unchecked.
Don’t: Hide the phone select-all label.
Content guidelines
Section titled “Content guidelines”- Write the label as the full thing people agree to: “Save this card for next time”, not “Save”.
- Write it so checking means yes. Avoid negatives such as “Don’t send receipts”.
- Use the description for a consequence or a detail, not for terms that must be read; link those separately.
- For a setting that takes effect at once, use a switch instead.
Accessibility
Section titled “Accessibility”- The whole row is one target of at least 48 dp and one screen-reader node that reads the label, the description and the checked state together.
- The painted box takes no focus of its own, so one Tab reaches the row and Space toggles it. Keyboard focus draws the kit’s focus ring.
- The box centers on the label’s first line, so it stays beside the label when the label wraps at large text.
PaymentCheckbox
class PaymentCheckbox extends StatelessWidget · lib/src/controls/controls.dart
A checkbox with its label, for consent and opt-in choices.
The whole row is one 48 dp target and one screen-reader node ("Save this card, checkbox, checked"). Controlled: the host owns value and gets onChanged. A null onChanged disables the row; pass disabledReason so people know why.
| Parameter | Type | Default | Description |
|---|---|---|---|
value:required | bool | — | — |
onChanged:required | ValueChanged<bool>? | — | — |
indeterminate: | bool | false | A select-all dash. Value is ignored while mixed; tapping reports true. |
label:required | String | — | — |
description: | String? | — | A muted line under the label. |
disabledReason: | String? | — | Replaces description while the row is disabled. |
errorText: | String? | — | What checking the box agrees to, as a full phrase: "Save this card for next time", not "Save". Validation message, with a danger icon and edge. |
required: | bool | false | Spoken as required; the host gates the next step. |
hiddenElements: | Set<PaymentFieldPart> | const {} | Visually hidden parts remain in semantics. |
PaymentFieldPart
enum PaymentFieldPart · lib/src/foundation/payment_tokens.dart
A hidden field part stays in semantics; consumers arrive in later phases.
| Value | Description |
|---|---|
label | Label field part. |
description | Description field part. |
error | Error field part. |