Search code snippets, questions, articles...

PageView with item builder

Widget getUIWidget() {
  return PageView.builder(
    itemBuilder: (context, position) {
      return Container(
        color: position % 2 == 0 ? Colors.pink : Colors.cyan,
      );
    },
  );
}

// Outside build method
PageController controller = PageController();
// Inside build method
PageView(
  controller: controller,
  children: <Widget>[
    // Add children
  ],
)
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.
Was this helpful?
0 Comments