OudsRadioButtonItem<T> class
OUDS Radio Button Design Guidelines
The Radio button item variant can function as a simple input with a label, or it can be combined with optional elements such as helper text, additional a divider, an outlined, or an icon, allowing it to suit various use cases.
The OUDS Radio button item layout contains an OudsRadioButton. By clicking on a radiobutton item, the user changes the checked state of its radio button.
If you want to use a standalone radio button please use OudsRadioButton.
Parameters:
- value The value represented by this radio button. Used to determine selection.
- groupValue The currently selected value in the radio button group. This radio button is considered selected if value == groupValue.
- onChanged Callback triggered when the user selects this radio button. If
null
, the radio button is disabled and non-interactive. - isError Indicates whether the radio button is in an error state.
- title: The main label of the radio button item.
- additionalLabel: Optional strong accompanying text for the main label.
- helperTitle: Optional text displayed below the label.
- icon: Optional icon displayed in the item. By default, it has a trailing position. If reversed is set to
true
, it is displayed as a leading element. - outlined: Outlined is designed to stand out and draw the user’s attention.
- reversed: When
false
, the checkbox has a leading position and the optional icon has a trailing position. Otherwise, it is reversed. - readOnly: Controls the read only state of the radio button item. When
true
the item's radio button is disabled but the texts, the icon and the outlined remain in enabled color. Note that if it is set totrue
and enabled is set tofalse
, the checkbox item will be displayed in disabled state. - enabled: Controls the enabled state of the checkbox item. When
false
, the checkbox, the texts and the optional icon are disabled, and the item will not be clickable - divider: Controls the display of a divider at the bottom of the checkbox item.
You can use OudsRadioButtonItem like this :
State enabled :
The default active state where the radio button is functional and selectable. It may show an unselected or selected style, with a label and helper text visible.
OudsRadioButtonItem<RadioOption>(
value: true,
groupValue: true,
onChanged: (RadioOption? value) {
// Handle radio button change state.
},
title: 'Label',
additionalLabel: 'Additional label',
helperTitle: 'Helper text',
reversed: false,
readOnly: false,
icon: 'assets/ic_heart.svg',
isError: false,
divider: true,
outlined: false
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- OudsRadioButtonItem
Constructors
-
OudsRadioButtonItem.new({Key? key, required T value, required T groupValue, required ValueChanged<
T?> ? onChanged, required String title, String? additionalLabel, String? helperTitle, String? icon, bool outlined = false, bool reversed = false, bool readOnly = false, bool isError = false, bool enabled = true, bool divider = false}) -
const
Properties
- additionalLabel → String?
-
final
- divider → bool
-
final
- enabled → bool
-
final
- groupValue → T
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperTitle → String?
-
final
- icon → String?
-
final
- isError → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onChanged
→ ValueChanged<
T?> ? -
final
- outlined → bool
-
final
- readOnly → bool
-
final
- reversed → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String
-
final
- value → T
-
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