TypeSelector<T> class Null safety

A TypeSelector widget to usage for select one in yours available options.

The type parameter T serves the same purpose as that of the TypeSelector class' type parameter. The TypeSelector requests a callback Function(T) named as onValueChanged which will be triggered after the value changed.

If the options list is absent, an assertion error will be throw.

assert(options != null);

If the onValueChanged function is absent, an assertion error will be throw.

assert(onValueChanged != null);
Inheritance

Constructors

TypeSelector({required List<T> options, bool multiple = false, dynamic value, dynamic onValueChanged, dynamic values, dynamic onValuesChanged, dynamic maxQuantityValues, dynamic onMaxQuantityValues, Duration transitionDuration = const Duration(milliseconds: 250), EdgeInsets contentPadding = const EdgeInsets.all(8.0), TextOverflow valueLabelOverflow = TextOverflow.clip, bool toggleOptionOnTap = false, double separatorWidth = 2.0, double height = 50.0, double? optionWidth, String setValueLabel(T value)?, TextStyle? valueLabelStyle, Color? activeColor, Color? disabledColor, dynamic comparingBy(T value)?})
The default TypeSelector constructor that render a rounded corner TypeSelector.
TypeSelector.rect({required List<T> options, bool multiple = false, dynamic value, dynamic onValueChanged, dynamic values, dynamic onValuesChanged, dynamic maxQuantityValues, dynamic onMaxQuantityValues, Duration transitionDuration = const Duration(milliseconds: 250), EdgeInsets contentPadding = const EdgeInsets.all(8.0), TextOverflow valueLabelOverflow = TextOverflow.clip, bool toggleOptionOnTap = false, double separatorWidth = 2.0, double height = 50.0, double? optionWidth, String setValueLabel(T value)?, TextStyle? valueLabelStyle, Color? activeColor, Color? disabledColor, dynamic comparingBy(T value)?})
The default TypeSelector constructor that render a rect corner TypeSelector.

Properties

activeColor Color?
The active Color of the TypeSelector. Is displayed when an option is selected. The default value is:
final
comparingBy → (dynamic Function?(T value)?)
The default comparation for obtain selected value uses the == operator. But when working with objects, this method don't will work properly. Using this function, it's possible set how the comparation supose to be. Example of usage:
final
contentPadding EdgeInsets
The padding for the TypeSelector. The default value is:
final
disabledColor Color?
The disabled Color of the TypeSelector. Is displayed when an option is not selected. The default value is:
final
hashCode int
The hash code for this object.
@nonVirtualread-onlyinherited
height double
The height for TypeSelector.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxQuantityValues int?
The maxQuantityValues for this TypeSelector (when multiple attribute is true).
final
multiple bool
Defines value of TypeSelector is a single or multiple objects. The default value is:
final
onMaxQuantityValues → (void Function?(int maxQuantityValues)?)
The Callback function called when values.length == maxQuantityValues.
final
onValueChanged ValueChanged<T?>?
The callback function reference that is called after the TypeSelector value changes. Triggered when the value is changed.
final
onValuesChanged ValueChanged<List<T>>?
The callback function reference that is called after the TypeSelector values changes. Triggered when the values is changed.
final
options List<T>
The available options for TypeSelector.
final
optionWidth double?
The width for the each option (from options).
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
separatorWidth double
The separator width for options.
final
setValueLabel → (String Function?(T value)?)
This function defines a label for every option (from options). The default value is value. Example of usage:
final
toggleOptionOnTap bool
If this value is set to true, on tap in the current selected option the value is set to null.
final
transitionDuration Duration
The transitionDuration of the TypeSelector animation on value changed. The default value is:
final
value → T?
The value for this TypeSelector.
final
valueLabelOverflow TextOverflow
The overflow mode when the label is overflowing the optionWidth. The default value is:
final
valueLabelStyle TextStyle?
The style for the value label. The default value is:
final
values List<T>?
The values for this TypeSelector (when multiple attribute is true).
read / write

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.
@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
equality(dynamic value, dynamic itemValue) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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}) 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.
@nonVirtualinherited