PageController class

A controller for a PageView, enabling page-by-page navigation.

Inheritance

Constructors

PageController({int initialPage = 0, double viewportFraction = 1.0, ScrollDirection direction = ScrollDirection.horizontal})
Creates a new PageController.

Properties

direction → ScrollDirection
Direction of scrolling (horizontal or vertical).
finalinherited
hasClients → bool
Returns true if the controller is attached to an HTML DOM element.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
hasReachedEnd → bool
Returns true if the controller has reached the end of the scrollable component.
no setterinherited
initialPage → int
The page to show when first creating the scroll view.
final
isAtStart → bool
Returns true if the controller is at the start of the scrollable component.
no setterinherited
isScrollable → bool
Whether the attached element is a scrollable container.
no setterinherited
maxScrollExtent → double
Maximum scroll extent based on direction (scrollHeight/clientHeight or scrollWidth/clientWidth).
no setterinherited
minScrollExtent → double
Minimum scroll extent (usually 0.0).
no setterinherited
offset → double
The current scroll offset in pixels based on direction.
no setterinherited
page → double
Returns the current page index.
no setter
position → double
Alias for current scroll position based on direction.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
viewportFraction → double
The fraction of the viewport that each page should occupy (default 1.0).
final

Methods

addListener(VoidCallback listener) → void
Adds a scroll position listener callback.
inherited
animateTo(double value, {Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Animates the scroll position smoothly to value in pixels.
inherited
animateToIndex(int index, {required double itemExtent, Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Animates smoothly to a specific item index given a fixed itemExtent in pixels.
inherited
animateToPage(int page, {Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Animates smoothly to the specified page index.
attach(HTMLElement element) → void
Attaches the controller to a rendered HTML element.
override
detach() → void
Detaches the controller from the HTML element.
inherited
dispose() → void
Disposes resources used by the controller.
inherited
jumpTo(double value) → void
Jumps the scroll position immediately to value in pixels.
inherited
jumpToIndex(int index, {required double itemExtent}) → void
Jumps immediately to a specific item index given a fixed itemExtent in pixels.
inherited
jumpToPage(int page) → void
Jumps immediately to the specified page index.
nextPage({Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Navigates to the next page.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Notifies all registered listeners.
inherited
previousPage({Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Navigates to the previous page.
removeListener(VoidCallback listener) → void
Removes a scroll position listener callback.
inherited
scrollToComponent(String id, {Duration duration = const Duration(milliseconds: 300), Curves curve = Curves.easeInOut}) → void
Scrolls to a specific component inside the scrollable component.
inherited
scrollToEnd() → void
Jumps the scroll position to the end of the scrollable component.
inherited
scrollToTop() → void
Jumps the scroll position to the top of the scrollable component.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited