Form

Radio

A radio button that typically allows the user to choose only one of a predefined set of options.

We recommend using a select group to create a group of radio buttons instead of using FRadio directly.

class RadioPage extends StatefulWidget {
  @override
  State<RadioPage> createState() => _RadioPageState();
}

class _RadioPageState extends State<RadioPage> {
  bool _value = true;

  @override
  Widget build(BuildContext context) => FRadio(
    label: const Text('Default'),
    description: const Text('The description of the default option.'),
    value: _value,
    onChange: (value) => setState(() => _value = value),
  );
}

CLI

To generate and customize this style:

dart run forui style create radio

Usage

FRadio(...)

FRadio(
  style: (style) => style.copyWith(...),
  label: const Text('Default'),
  description: const Text('The description of the default option.'),
  error: const Text('Please select the default option.'),
  semanticsLabel: 'Default',
  value: true,
  onChange: (value) {},
  enabled: true,
  autofocus: true,
  focusNode: FocusNode(),
  onFocusChange: (focused) {},
);

On this page