JetTab class
A customizable tab widget with extensive styling options.
Supports both simple widget-based tabs and AutoRoute-based navigation.
For simple tabs with widgets:
JetTab.simple(
tabs: ['Home', 'Profile', 'Settings'],
children: [
HomeView(),
ProfileView(),
SettingsView(),
],
indicatorColor: Colors.blue,
labelColor: Colors.blue,
)
For AutoRoute integration:
JetTab.router(
routes: [
HomeRoute(),
ProfileRoute(),
SettingsRoute(),
],
tabs: ['Home', 'Profile', 'Settings'],
indicatorColor: Colors.blue,
labelColor: Colors.blue,
)
- Inheritance
Constructors
-
JetTab.router({Key? key, required List<
PageRouteInfo< routes, required List<Object?> >String> tabs, Widget builder(BuildContext context, Widget child)?, bool isScrollable = false, TabAlignment? tabAlignment, Color? indicatorColor, Color? labelColor, Color? unselectedLabelColor, TextStyle? labelStyle, TextStyle? unselectedLabelStyle, TabBarIndicatorSize? indicatorSize, EdgeInsetsGeometry? indicatorPadding, Color? dividerColor, double? dividerHeight, ValueChanged<int> ? onTap, double? tabBarHeight, ScrollPhysics? physics, Duration? animationDuration, List<Widget> ? customTabs}) -
Creates a tab widget integrated with AutoRoute.
const
-
JetTab.simple({Key? key, required List<
String> tabs, required List<Widget> children, int? initialLength, int initialIndex = 0, TabController? controller, bool isScrollable = false, TabAlignment? tabAlignment, Color? indicatorColor, Color? labelColor, Color? unselectedLabelColor, TextStyle? labelStyle, TextStyle? unselectedLabelStyle, TabBarIndicatorSize? indicatorSize, EdgeInsetsGeometry? indicatorPadding, Color? dividerColor, double? dividerHeight, ValueChanged<int> ? onTap, double? tabBarHeight, ScrollPhysics? physics, Duration? animationDuration, List<Widget> ? customTabs}) -
Creates a simple tab widget with widget children.
const
Properties
- animationDuration → Duration?
-
Animation duration for tab transitions.
final
- builder → Widget Function(BuildContext context, Widget child)?
-
Builder function that receives the context and active tab content (router mode only).
final
-
children
→ List<
Widget> ? -
List of widgets to display in each tab's content area (simple mode only).
final
- controller → TabController?
-
External tab controller (optional). If provided, will use this instead of creating a new one.
final
-
customTabs
→ List<
Widget> ? -
Custom tab widgets (overrides tabs parameter if provided).
final
- dividerColor → Color?
-
Color of the divider line below the tabs.
final
- dividerHeight → double?
-
Height of the divider line below the tabs.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorColor → Color?
-
Color of the tab indicator line.
final
- indicatorPadding → EdgeInsetsGeometry?
-
Padding around the tab indicator.
final
- indicatorSize → TabBarIndicatorSize?
-
Size of the tab indicator (tab or label width).
final
- initialIndex → int
-
Initial index of the selected tab (defaults to 0).
final
- initialLength → int?
-
Total number of tabs (should match tabs.length and children.length).
final
- isScrollable → bool
-
Whether tabs can be scrolled horizontally when they overflow.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelColor → Color?
-
Color of the selected tab label.
final
- labelStyle → TextStyle?
-
Text style for selected tab labels.
final
-
onTap
→ ValueChanged<
int> ? -
Callback when a tab is tapped.
final
- physics → ScrollPhysics?
-
Scroll physics for the tab view content.
final
-
routes
→ List<
PageRouteInfo< ?Object?> > -
List of tab routes to navigate between (router mode only).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tabAlignment → TabAlignment?
-
How tabs are aligned when isScrollable is true.
final
- tabBarHeight → double?
-
Fixed height for the tab bar area.
final
-
tabs
→ List<
String> -
List of tab titles (required if customTabs is not provided).
final
- unselectedLabelColor → Color?
-
Color of unselected tab labels.
final
- unselectedLabelStyle → TextStyle?
-
Text style for unselected tab labels.
final
- useAutoRoute → bool
-
Internal flag to determine if using AutoRoute or simple mode.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → _StatelessHookElement -
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