Skip to content
Get started
Menu
Get started

Radio

PaymentRadio is one option of a single choice. Use radios for two to about five options that all fit on screen.

Receipt delivery radio options in default, invalid and disabled states.Receipt delivery radio options in default, invalid and disabled states.
Radio
Receipt delivery radio options in default, invalid and disabled states at 200 percent text.
200% text
example/lib/screens/gallery_selection.dart
// A group error shows once, under the last option (#65).
PaymentRadio(
value: method,
groupValue: null,
onChanged: (_) {},
label: method,
errorText: method == 'SMS'
? 'Choose how to get your receipt'
: null,
);

Variants: selected, unselected.

The selected option is a 6 px ring in the accent color; the others are a 1.5 px ring in textSecondary. The difference is in the shape, so it does not rely on color. Choosing the selected option again does nothing.

Pass onChanged: null to one option. Its ring uses the disabled color and its label turns muted. Pass disabledReason so people know why; it replaces description while the option is disabled.

The payment method picker shares the same radio mark. An unavailable method has a thin 1.5 dp disabled ring, a muted label and an explicit unavailable reason. The selected mark has a 6 dp accent ring. There is no block glyph.

errorText shows an icon, danger caption and unchecked danger ring. Required is semantics-only; hosts own validation and progression. HiddenElements keeps hidden label, description and error text spoken. Keep a group’s labels visible when they distinguish choices, and use specific recovery copy. A group error goes on the last option only, so it shows once under the group instead of under every option (#65).

Situation Variant / composition Payment example
Default payment method selected Use one groupValue for mutually exclusive options; choosing the selected row is a no-op.

Use Checkbox for independent options.

The host supplies the selected value. A null onChanged disables the option; keep an unavailable option’s reason visible.

Do: Use one groupValue for mutually exclusive options; choosing the selected row is a no-op.

Don’t: Allow multiple default methods in one radio group.

  • Title the group with the question or the setting: “Send receipt by”.
  • Keep option labels short and parallel: “Email”, “SMS”, “Don’t send”.
  • Preselect the safest or most common option, and offer an explicit “none” option rather than leaving the group empty.
  • For more options than fit on screen, use a list on its own screen or sheet.
  • Payment methods have their own picker with unavailable reasons: use PaymentMethodPicker from Checkout.
  • Each option is one row of at least 48 dp and one screen-reader node, announced as checked or not checked in a group of mutually exclusive options.
  • The selected option stays in the focus order, so Tab reaches every option. Keyboard focus draws the kit’s focus ring.
Example account settings screen with synthetic dataExample account settings screen with synthetic data
Example: account settings

PaymentRadio

class PaymentRadio extends StatelessWidget · lib/src/controls/controls.dart

One option of a single choice. Give every option in the group the same groupValue and onChanged; the option whose value equals groupValue is selected.

Selection shows as a filled ring, not only a color: the selected mark is a thick accent ring, the others a thin muted one. Use radios for two to about five options that all fit on screen.

ParameterTypeDefaultDescription
value:requiredT——
groupValue:requiredT?——
onChanged:requiredValueChanged<T>?—Called with value when this option is chosen. Null disables it.
label:requiredString——
description:String?——
disabledReason:String?—Replaces description while the option is disabled.
errorText:String?—Validation message, with a danger icon and edge. A group's error ("Choose how to get your receipt") goes on the last option only, so it shows once under the group instead of under every option (#65).
required:boolfalseSpoken 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.

ValueDescription
labelLabel field part.
descriptionDescription field part.
errorError field part.
  • Checkbox for independent yes-or-no choices.
  • Tabs to switch between views rather than save a choice.