PageIndicator class
A widget that provides a page indicator with navigation controls for a multi-page onboarding or tutorial experience.
The tabController, currentPageIndex, onUpdateCurrentPageIndex, indicatorSize, selectedColor, unselectedColor, btnBackgroundColor, onGetStarted, nextText, and getStartedText parameters must not be null.
The indicatorSize, selectedColor, unselectedColor, btnBackgroundColor, nextText, and getStartedText parameters control the appearance and behavior of the page indicator and navigation button.
Example usage:
PageIndicator(
tabController: _tabController,
currentPageIndex: _currentPageIndex,
onUpdateCurrentPageIndex: (index) => setState(() => _currentPageIndex = index),
indicatorSize: 8.0,
selectedColor: Colors.blue,
unselectedColor: Colors.grey,
btnBackgroundColor: Colors.blue,
onGetStarted: () => Navigator.pushNamed(context, '/home'),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PageIndicator
Constructors
- PageIndicator({Key? key, required TabController tabController, required int currentPageIndex, required void onUpdateCurrentPageIndex(int), required double indicatorSize, required Color selectedColor, required Color unselectedColor, required Color btnBackgroundColor, required void onGetStarted(), String nextText = "Next", String getStartedText = "Get Started"})
-
Creates a PageIndicator widget.
const
Properties
- btnBackgroundColor → Color
-
The background color of the navigation button.
final
- currentPageIndex → int
-
The current index of the page.
final
- getStartedText → String
-
The text to display on the button when the current page index is 2 or more.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorSize → double
-
The size of the page indicator.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- nextText → String
-
The text to display on the button when the current page index is less than 2.
final
- onGetStarted → void Function()
-
A callback function to be called when the "Get Started" button is pressed.
final
- onUpdateCurrentPageIndex → void Function(int)
-
A callback function to update the current page index.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedColor → Color
-
The color of the selected page indicator.
final
- tabController → TabController
-
The TabController that manages the tab index.
final
- unselectedColor → Color
-
The color of the unselected page indicators.
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