OudsSwitchButtonItem class
The Switch 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 Switch item layout contains an OudsSwitch. By clicking on a Switch item, the user changes the selected state of its switch.
If you want to use a standalone switch please use OudsSwitch.
Parameters:
- value The value represented by this switch. Used to determine selection.
- onChanged Callback triggered when the user selects this switch. If
null
, the switch is disabled and non-interactive. - isError Indicates whether the switch is in an error state.
- title: The main label of the switch item.
- 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. - reversed: When
false
, the switch has a leading position and the optional icon has a trailing position. Otherwise, it is reversed. - readOnly: Controls the read only state of the switch item. When
true
the item's switch 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 switch item will be displayed in disabled state. - enabled: Controls the enabled state of the switch item. When
false
, the switch, 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 switch item.
You can use OudsSwitchItem
like this :
State enabled :
The default active state where the switch is functional and selectable. It may show an unselected or selected style, with a label and helper text visible.
OudsSwitchButtonItem(
value: true,
onChanged: (bool? value) {
/// Handle switch change state.
},
title: 'Label',
helperTitle: null,
reversed: false,
readOnly: false,
icon: null,
isError: false,
divider: true,
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- OudsSwitchButtonItem
Constructors
Properties
- divider → bool
-
final
- enabled → bool
-
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<
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 → bool
-
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