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.

1class RadioExample extends StatefulWidget {
2 @override
3 State<RadioExample> createState() => _RadioExampleState();
4}
5
6class _RadioExampleState extends State<RadioExample> {
7 bool _value = true;
8
9 @override
10 Widget build(BuildContext _) => FRadio(
11 label: const Text('Default'),
12 description: const Text('The description of the default option.'),
13 value: _value,
14 onChange: (value) => setState(() => _value = value),
15 );
16}
17

CLI

To generate and customize this style:

dart run forui style create radio

Usage

FRadio(...)

1FRadio(
2 style: const .delta(motion: .delta()),
3 enabled: true,
4 value: false,
5 onChange: (value) {},
6 label: const Text('Option'),
7 description: const Text('Description'),
8 error: null,
9)

On this page