RASegmentedSwitch class

A TabBar-based segmented switch with a pill-style indicator.

This widget provides a tab interface similar to the standard TabBar but styled as a segmented switch with rounded pill indicators. The TabBar becomes scrollable when there are more than 4 items, otherwise it's fixed. Supports icons, different sizes, and all UISegmentedSwitchItem features.

Example usage:

RASegmentedSwitch(
  items: [
    RASegmentedSwitchItem(
      label: 'Table View',
      leftIcon: Icons.list_alt_rounded
    ),
    RASegmentedSwitchItem(
      label: 'Home View',
      leftIcon: Icons.home
    ),
  ],
  onTap: (index) {
    // Handle tab selection
  },
  initialIndex: 0,
  size: RASegmentedSwitchSize.medium,
)
Inheritance

Constructors

RASegmentedSwitch.new({required List<RASegmentedSwitchItem> items, required ValueChanged<int> onTap, int initialIndex = 0, RASegmentedSwitchSize size = RASegmentedSwitchSize.medium, TextStyle? selectedLabelStyle, TextStyle? unselectedLabelStyle, int? minScrollableItems, double? borderRadius, Color? backgroundColor, Color? indicatorColor, Color? shadowColor, Key? key})
const

Properties

backgroundColor Color?
A background color to customize the segmented switch background color.
final
borderRadius double?
A border radius to customize the segmented switch border radius.
final
hashCode int
The hash code for this object.
no setterinherited
indicatorColor Color?
A indicator color to customize the segmented switch indicator color.
final
initialIndex int
A current position for first initialization.
final
items List<RASegmentedSwitchItem>
A collections item of RASegmentedSwitchItem.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minScrollableItems int?
A minimum number of items to make the segmented switch scrollable.
final
onTap ValueChanged<int>
Signature for callbacks that report that an underlying value, when user pressed item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedLabelStyle TextStyle?
A style to customize the label style.
final
shadowColor Color?
A shadow color to customize the segmented switch shadow color.
final
size RASegmentedSwitchSize
A type to create padding content spacing.
final
unselectedLabelStyle TextStyle?
A style to customize the unselected label style.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RASegmentedSwitch>
Creates the mutable state for this widget at a given location in the tree.
override
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