PageViewDotIndicator class

PageViewDotIndicator is a widget that shows dots that are usually used along with a PageView widget.

This widget automatically animates transitions by using AnimatedContainer for each individual dot.

It also handles having more dots than it could fit into the viewport by fading the edges and scrolling them as the currentItem is updated.

Inheritance

Constructors

PageViewDotIndicator({Key? key, required int currentItem, required int count, required Color unselectedColor, required Color selectedColor, Size size = const Size(12, 12), Size unselectedSize = const Size(12, 12), Duration duration = const Duration(milliseconds: 150), EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 4), EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 16), Alignment alignment = Alignment.center, bool fadeEdges = true, BoxShape boxShape = BoxShape.circle, BorderRadius? borderRadius, void onItemClicked(int index)?})
Creates a PageViewDotIndicator widget.
const

Properties

alignment Alignment
The alignment of the dots regarding the whole container.
final
borderRadius BorderRadius?
Border radius of the indicators.
final
boxShape BoxShape
The shape of the indicators.
final
count int
The total amount of dots. Usually it should be the same count of pages of the corresponding pageview).
final
currentItem int
The index of the currentItem. It is a 0-based index and cannot be neither greater or equal to count nor smaller than 0.
final
duration Duration
The duration of the animations used by the dots when the currentItem is changed
final
fadeEdges bool
If the edges should be faded or not.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsets
The margin between the dots.
final
onItemClicked → (void Function(int index)?)
Callback called when item is clicked.
final
padding EdgeInsets
The external padding.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedColor Color
The color applied to the dot when the dots' index is the same as currentItem.
final
size Size
The size of the dot corresponding to the currentItem or the default size of the dots when unselectedSize is null.
final
unselectedColor Color
The color applied to the dot when the dots' indexes are different from currentItem.
final
unselectedSize Size
The size of the dots when the currentItem is different from the dots' indexes.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PageViewDotIndicator>
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}) 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