Milad-Akarie / smooth_page_indicator

Flutter Smooth PageView indicators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page index

mohammedX6 opened this issue · comments

How to get the current page index ?

Never-mind i managed to find a solution like this :

1.declare a variable int currentPageIndex=1;
2.PageView(
controller: controller,
pageSnapping: true,
onPageChanged: (x) {
// here you can get the current page index
setState(() {
currentPageIndex= x+1;
});
},
children: allPagesWidgets)