buildStaticPageView method

  1. @protected
Widget buildStaticPageView(
  1. BuildParameters params
)

Implementation

@protected
Widget buildStaticPageView(BuildParameters params) {
  final spec = params.spec;
  final props = spec.props;
  final onPageChanged = events.getValueFunction<int?>(params.context,
      params.actions["onPageChanged"], params.state, params.parentContext);

  final children = <Widget>[];
  if (params.widgets["children"] != null) {
    for (Map childSpec in params.widgets["children"] as List<Map>) {
      children.add(builder.buildWidget(
          params.context, childSpec, params.state, params.parentContext));
    }
  }

  return PageView(
    key: properties.getKey(params.id),
    reverse: parseBool(props["reverse"]),
    pageSnapping: parseBool(props["pageSnapping"], defaultValue: true),
    padEnds: parseBool(props["padEnds"], defaultValue: true),
    scrollDirection: spec.buildProp("scrollDirection") ?? Axis.horizontal,
    controller: PageController(
      initialPage: parseInt(props["initialPage"]),
      viewportFraction:
          parseDouble(props["viewportFraction"], defaultValue: 1.0),
      keepPage: parseBool(props["keepPage"], defaultValue: true),
    ),
    onPageChanged: onPageChanged,
    children: children,
  );
}