Vertical Scrolling In Flutter.
Hello everyone...
Today we will go over how to make any card or container scroll vertically in Flutter.
First, create a PageController variable in Class that extends State.
PageController controller = PageController(initialPage: 0);
After obtaining the page controller, return as follows:
return Scaffold( body: Container( child: PageView( scrollDirection: Axis.vertical, children: List.generate(5,(index){ return Container( //Any View You Create. //this example create 5 loops. ), }, ), ), controller: controller, );
The Complete Source Code Is As Follows:
PageController controller = PageController(initialPage: 0); return Scaffold( body: Container( child: PageView( scrollDirection: Axis.vertical, children: List.generate(5,(index){ return Container( //Any View You Create. //this example create 5 loops. ), }, ), ), controller: controller, );
Thank you.
Tagged: