dispatchFunction method
void
dispatchFunction(
- ViewPagerRenderViewModel? viewModel,
- String functionName,
- VoltronArray array, {
- Promise? promise,
override
Implementation
@override
void dispatchFunction(
ViewPagerRenderViewModel? viewModel,
String functionName,
VoltronArray array, {
Promise? promise,
}) {
if (viewModel == null) {
return;
}
if (functionName == kFuncSetPage) {
int? selected = array.get<int>(0);
if (selected != null && selected >= 0 && selected < viewModel.children.length) {
viewModel.pageController?.animateToPage(
selected,
duration: const Duration(milliseconds: 300),
curve: Curves.linearToEaseOut,
);
}
} else if (functionName == kFuncSetPageWidthOutAnim) {
int? selected = array.get<int>(0);
if (selected != null && selected >= 0 && selected < viewModel.children.length) {
viewModel.pageController?.jumpToPage(
selected,
);
}
}
}