what is the correct way to achive it using functional widget - is this correct:
@hwidget
Widget app(int value) {
final index = useState(0);
PageController _pageController = PageController(initialPage: 0);
void _onItemTapped(int i) {
index.value = i;
_pageController.animateToPage(i,
duration: Duration(milliseconds: 500), curve: Curves.easeOut);
}
return Scaffold(); // some widet uses this pageController
}
I know there is usePageController but for the sake of it - what if i need to initialize something ? or write a callback inside the functional widget - is this cause performance issues when build trigger ?
Cause in class functions and properties are separate from the build funciton - what is the best practice to do it in functional widget ?
lets say in some class i need to init something in the constructor:
what is the correct way to achive it using functional widget - is this correct:
I know there is
usePageController
but for the sake of it - what if i need to initialize something ? or write a callback inside the functional widget - is this cause performance issues when build trigger ? Cause in class functions and properties are separate from the build funciton - what is the best practice to do it in functional widget ?