flutter
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
],
)
Was this helpful?