TTabs<T> class
A tab navigation component with indicator.
TTabs provides tab navigation with:
- Icon and/or text tabs
- Active indicator line
- Disabled state support
- Inline or full-width layout
- Custom colors
Basic Usage
TTabs<int>(
tabs: [
TTab(value: 0, text: 'Home', icon: Icons.home),
TTab(value: 1, text: 'Profile', icon: Icons.person),
TTab(value: 2, text: 'Settings', icon: Icons.settings),
],
selectedValue: currentTab,
onTabChanged: (value) => setState(() => currentTab = value),
)
With Active Indicator
TTabs<String>(
tabs: [
TTab(value: 'active', text: 'Active', isActive: hasActiveItems),
TTab(value: 'archived', text: 'Archived'),
],
selectedValue: selectedTab,
onTabChanged: (value) => loadData(value),
)
Type parameter:
T: The type of tab values
See also:
- TTab for tab configuration
- Inheritance
Constructors
-
TTabs({Key? key, required List<
TTab< tabs, T? selectedValue, ValueChanged<T> >T> ? onTabChanged, Color? borderColor, Color? selectedColor, Color? unselectedColor, Color? disabledColor, Color? indicatorColor, EdgeInsets? tabPadding = const EdgeInsets.symmetric(vertical: 5, horizontal: 16), double? indicatorWidth = 1, bool inline = false}) -
Creates a tabs component.
const
Properties
- borderColor → Color?
-
Border color for the tab bar.
final
- disabledColor → Color?
-
Color for disabled tabs.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorColor → Color?
-
Color for the selection indicator.
final
- indicatorWidth → double?
-
Width of the selection indicator.
final
- inline → bool
-
Whether to use inline layout (wrap) instead of full-width.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onTabChanged
→ ValueChanged<
T> ? -
Callback fired when a tab is selected.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedColor → Color?
-
Color for the selected tab.
final
- selectedValue → T?
-
The currently selected tab value.
final
- tabPadding → EdgeInsets?
-
Padding for each tab.
final
-
tabs
→ List<
TTab< T> > -
The list of tabs to display.
final
- unselectedColor → Color?
-
Color for unselected tabs.
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