Skip to main content

PageViewCommand

A group of commands for controlling the PageView widget and its PageController. All commands extend from the base class _PageViewCommand, which in turn extends RemoteCommand.

Supported Actions​

ActionClassDescription
nextPagePageViewNextPageCommandNavigate to the next page
previousPagePageViewPreviousPageCommandNavigate to the previous page
animateToPageViewAnimateToCommandAnimated scroll to a specified offset
animateToPagePageViewAnimateToPageCommandAnimated navigation to a specified page
jumpToPageViewJumpToCommandInstant scroll to a specified offset
jumpToPagePageViewJumpToPageCommandInstant navigation to a specified page

Animated Commands​

Commands nextPage, previousPage, animateTo, and animateToPage support animation parameters:

PropertyTypeDescription
durationintAnimation duration in milliseconds
curveStringAnimation curve (default linear)

Available Animation Curves​

linear, ease, easeIn, easeOut, easeInOut, bounceIn, bounceOut, bounceInOut, elasticIn, elasticOut, elasticInOut, and other standard Flutter curves.

JSON Examples​

{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "nextPage",
"duration": 300,
"curve": "easeInOut"
}
}
{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "previousPage",
"duration": 300,
"curve": "easeInOut"
}
}

Animate to Page​

{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "animateToPage",
"page": 3,
"duration": 500,
"curve": "bounceOut"
}
}

Animate to Offset​

{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "animateTo",
"offset": 150.0,
"duration": 300,
"curve": "ease"
}
}

Jump to Page​

{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "jumpToPage",
"page": 2
}
}

Jump to Offset​

{
"type": "command",
"controllerId": "page_view_id",
"commandData": {
"type": "pageView",
"action": "jumpTo",
"value": 100.0
}
}

Command Classes​

PageViewNextPageCommand​

final class PageViewNextPageCommand extends _PageViewAnimatedCommand {
const PageViewNextPageCommand({
required super.duration,
required super.curve,
...
});
}

PageViewPreviousPageCommand​

final class PageViewPreviousPageCommand extends _PageViewAnimatedCommand {
const PageViewPreviousPageCommand({
required super.duration,
required super.curve,
...
});
}

PageViewAnimateToPageCommand​

final class PageViewAnimateToPageCommand extends _PageViewAnimatedCommand {
final int page;

const PageViewAnimateToPageCommand({
required this.page,
required super.duration,
required super.curve,
...
});
}

PageViewAnimateToCommand​

final class PageViewAnimateToCommand extends _PageViewAnimatedCommand {
final double offset;

const PageViewAnimateToCommand({
required this.offset,
required super.duration,
required super.curve,
...
});
}

PageViewJumpToPageCommand​

final class PageViewJumpToPageCommand extends _PageViewCommand {
final int page;

const PageViewJumpToPageCommand({
required this.page,
...
});
}

PageViewJumpToCommand​

final class PageViewJumpToCommand extends _PageViewCommand {
final double value;

const PageViewJumpToCommand({
required this.value,
...
});
}