FossRadioGroup<T> class Inputs

Lays out a set of FossRadio options as a single-choice group.

Holds the selected groupValue and the onChanged callback and shares them with its children through an inherited scope, so each FossRadio reads its own checked state and reports taps back to the group. Renders an optional label above the options and an optional errorText below.

A non-null errorText marks every option invalid; enabled: false or a null onChanged disables the whole group. Colors, type, and spacing come from context.fossTheme.

FossRadioGroup<String>(
  label: 'Billing plan',
  groupValue: plan,
  onChanged: (value) => setState(() => plan = value),
  children: const [
    FossRadio(value: 'monthly', label: 'Monthly'),
    FossRadio(value: 'yearly', label: 'Yearly', description: 'Save 16%'),
  ],
);
Inheritance

Constructors

FossRadioGroup({required List<Widget> children, T? groupValue, ValueChanged<T>? onChanged, String? label, String? errorText, FossRadioGroupVariant variant = FossRadioGroupVariant.plain, bool enabled = true, Key? key})
Creates a radio group. children are the FossRadio options, each of the same value type T.
const

Properties

children List<Widget>
The options, each a FossRadio of value type T.
final
enabled bool
Whether the group accepts input. When false it dims and stops responding.
final
errorText String?
Error caption below the options. A non-null value marks the group invalid.
final
groupValue → T?
The selected value, or null when none is selected.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
Optional label rendered above the options.
final
onChanged ValueChanged<T>?
Called with the tapped option's value. Null disables the group.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variant FossRadioGroupVariant
The visual treatment. Defaults to FossRadioGroupVariant.plain.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited