ShadTab<T> class

Represents a single tab item within a ShadTabs widget.

Includes properties for styling, content, and interaction handling.

Inheritance
Implemented types
Available extensions

Constructors

ShadTab({Key? key, required T value, required Widget child, Widget? content, Widget? leading, Widget? trailing, bool enabled = true, int flex = 1, double? height, double? width, Color? backgroundColor, Color? selectedBackgroundColor, Color? hoverBackgroundColor, Color? selectedHoverBackgroundColor, EdgeInsetsGeometry? padding, ShadDecoration? decoration, ShadDecoration? selectedDecoration, Color? foregroundColor, Color? selectedForegroundColor, TextStyle? textStyle, List<BoxShadow>? shadows, List<BoxShadow>? selectedShadows, FocusNode? focusNode, VoidCallback? onPressed, VoidCallback? onLongPress, ShadButtonSize? size, MouseCursor? cursor, Color? hoverForegroundColor, bool autofocus = false, Color? pressedBackgroundColor, Color? pressedForegroundColor, Gradient? gradient, TextDecoration? textDecoration, TextDecoration? hoverTextDecoration, ShadStatesController? statesController, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, ShadHoverStrategies? hoverStrategies, ValueChanged<bool>? onHoverChange, ValueChanged<TapDownDetails>? onTapDown, ValueChanged<TapUpDetails>? onTapUp, VoidCallback? onTapCancel, ValueChanged<LongPressStartDetails>? onLongPressStart, VoidCallback? onLongPressCancel, VoidCallback? onLongPressUp, ValueChanged<LongPressDownDetails>? onLongPressDown, ValueChanged<LongPressEndDetails>? onLongPressEnd, VoidCallback? onDoubleTap, ValueChanged<TapDownDetails>? onDoubleTapDown, VoidCallback? onDoubleTapCancel, Duration? longPressDuration, bool? expandContent, bool? maintainState})
Represents a single tab item within a ShadTabs widget.
const

Properties

autofocus bool
Whether the tab should automatically focus on build.
final
backgroundColor Color?
Background color of the tab when unselected.
final
child Widget
The widget to display as the tab's label, typically a Text widget.
final
content Widget?
The widget to display as the content associated with this tab.
final
crossAxisAlignment CrossAxisAlignment?
The cross axis alignment of the button's content within its Row. Defaults to CrossAxisAlignment.center if not specified.
final
cursor MouseCursor?
Mouse cursor when hovering over the tab.
final
decoration ShadDecoration?
Decoration for the tab when unselected.
final
enabled bool
Whether the tab is enabled and can be selected.
final
expandContent bool?
Whether the tab content should be expanded, defaults to false.
final
flex int
Flex factor for the tab when it's part of a Row in a non-scrollable ShadTabs.
final
focusNode FocusNode?
Focus node to control the focus state of the tab.
final
foregroundColor Color?
Foreground color (text/icon color) when unselected.
final
gradient Gradient?
Background gradient for the tab.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Height of the tab.
final
hoverBackgroundColor Color?
Background color when hovered.
final
hoverForegroundColor Color?
Foreground color when hovered.
final
hoverStrategies ShadHoverStrategies?
The strategies for handling hover behavior, overriding the theme default if provided. Controls how hover states are detected and applied.
final
hoverTextDecoration TextDecoration?
Text decoration when hovered.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading Widget?
A widget to display at the start of the tab, often an Icon.
final
longPressDuration Duration?
The duration required to trigger a long press, overriding the theme default if provided. Controls the timing of onLongPress and related callbacks.
final
mainAxisAlignment MainAxisAlignment?
The main axis alignment of the button's content within its Row. Defaults to MainAxisAlignment.center if not specified.
final
maintainState bool?
Whether to maintain the state of this tab when switching away from it.
final
onDoubleTap VoidCallback?
Callback invoked when a double tap occurs. For advanced gesture handling.
final
onDoubleTapCancel VoidCallback?
Callback invoked when a double tap is canceled. For advanced gesture handling.
final
onDoubleTapDown ValueChanged<TapDownDetails>?
Callback invoked when a double tap begins, providing details. For advanced gesture handling.
final
onHoverChange ValueChanged<bool>?
Callback invoked when the hover state changes, providing the new hover value. Complements internal hover state management.
final
onLongPress VoidCallback?
Callback for long-press events on the tab.
final
onLongPressCancel VoidCallback?
Callback invoked when a long press is canceled. Part of long-press gesture handling.
final
onLongPressDown ValueChanged<LongPressDownDetails>?
Callback invoked when a long press is detected, providing details. Part of long-press gesture handling.
final
onLongPressEnd ValueChanged<LongPressEndDetails>?
Callback invoked when a long press ends, providing details. Part of long-press gesture handling.
final
onLongPressStart ValueChanged<LongPressStartDetails>?
Callback invoked when a long press begins, providing details. Part of long-press gesture handling.
final
onLongPressUp VoidCallback?
Callback invoked when a long press ends by lifting. Part of long-press gesture handling.
final
onPressed VoidCallback?
Callback for tap events on the tab.
final
onTapCancel VoidCallback?
Callback invoked when a tap is canceled. Resets the pressed state.
final
onTapDown ValueChanged<TapDownDetails>?
Callback invoked when a tap begins, providing tap details. Triggers the pressed state visually.
final
onTapUp ValueChanged<TapUpDetails>?
Callback invoked when a tap ends, providing tap details. Ends the pressed state visually.
final
padding EdgeInsetsGeometry?
Padding within the tab.
final
preferredSize Size
The size this widget would prefer if it were otherwise unconstrained.
no setteroverride
pressedBackgroundColor Color?
Background color when pressed.
final
pressedForegroundColor Color?
Foreground color when pressed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedBackgroundColor Color?
Background color of the tab when selected.
final
selectedDecoration ShadDecoration?
Decoration for the tab when selected.
final
selectedForegroundColor Color?
Foreground color when selected.
final
selectedHoverBackgroundColor Color?
Background color when selected and hovered.
final
selectedShadows List<BoxShadow>?
Shadows for the tab when selected.
final
shadows List<BoxShadow>?
Shadows for the tab when unselected.
final
size ShadButtonSize?
Size configuration for the tab, uses ShadButtonSize.
final
statesController ShadStatesController?
Custom states controller for managing tab states.
final
textDecoration TextDecoration?
Text decoration for the tab label.
final
textStyle TextStyle?
Text style for the tab label.
final
trailing Widget?
A widget to display at the end of the tab.
final
value → T
The value associated with this tab, used for selection and identification.
final
width double?
Width of the tab.
final

Methods

animate({Key? key, List<Effect>? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) Animate

Available on Widget, provided by the AnimateWidgetExtensions extension

Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex. myWidget.animate() is equivalent to Animate(child: myWidget).
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ShadTab<T>>
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
positionedWith(ShadPosition position) Widget

Available on Widget, provided by the PositionedExt extension

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