CustomToggleButtons class

A custom implementation that expands on Flutter's ToggleButtons

The list of children are laid out as per the specified direction. The state of each button is controlled by isSelected, which is a list of bool that determine if a button is in an unselected or selected state.

The length of isSelected has to match the length of the children list as they are both correlated by their index in either list.

Inheritance

Constructors

CustomToggleButtons({Key key, @required List<Widget> children, @required List<bool> isSelected, void onPressed(int index), BoxConstraints constraints, Color color, Color selectedColor, Color disabledColor, Color fillColor, Color unselectedFillColor, Color disabledFillColor, Color highlightColor, Color splashColor, Color hoverColor, bool renderBorder = true, Color borderColor, Color selectedBorderColor, Color disabledBorderColor, double borderWidth, double borderRadius, double spacing = 0, double runSpacing = 0, Axis direction = Axis.horizontal, double elevation = 0})

Properties

borderColor Color
The border color to display when the toggle button is enabled and not selected. [...]
final
borderRadius double
The radii of the border's corners. [...]
final
borderWidth double
The width of the border surrounding each toggle button. [...]
final
children List<Widget>
The toggle button widgets. [...]
final
color Color
The color for descendant Text and Icon widgets if the button is enabled and not selected. [...]
final
constraints BoxConstraints
Defines the button's size. [...]
final
direction Axis
The direction in which the toggle buttons will be created. Must be of type Axis and can take the values Axis.horizontal or Axis.vertical. [...]
final
disabledBorderColor Color
The border color to display when the toggle button is disabled. [...]
final
disabledColor Color
The color for descendant Text and Icon widgets if the button is disabled. [...]
final
disabledFillColor Color
The fill color for disabled toggle buttons. [...]
final
elevation double
The elevation of each toggle button. [...]
final
fillColor Color
The fill color for selected toggle buttons. [...]
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
highlightColor Color
The highlight color for the button's InkWell. [...]
final
hoverColor Color
The color to use for filling the button when the button has a pointer hovering over it. [...]
final
isSelected List<bool>
The corresponding selection state of each toggle button. [...]
final
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
onPressed → void Function(int index)
The callback that is called when a button is tapped. [...]
final
renderBorder bool
Whether or not to render a border around each toggle button. [...]
final
runSpacing double
The space between two consecutive runs of toggle buttons. Runs are toggle button lines separated due to lack of space. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
selectedBorderColor Color
The border color to display when the toggle button is selected. [...]
final
selectedColor Color
The color for descendant Text and Icon widgets if the button is selected. [...]
final
spacing double
The space between two consecutive toggle buttons. [...]
final
splashColor Color
The splash color for the button's InkWell. [...]
final
unselectedFillColor Color
The fill color for unselected toggle buttons. [...]
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. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
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. [...]
@nonVirtual, inherited