initializer method
Implementation
void initializer([TickerProvider? ticker]) {
_ticker ??= ticker;
if (_tabController != null) {
return;
}
assert(length > 0, 'The length must be defined and greater than one');
_tabController = TabController(
vsync: _ticker!,
length: length,
initialIndex: initialIndex,
);
snapValue = const SnapState<int>.none().copyToHasData(initialIndex);
_tabController!.addListener(() {
if (snapState.data == _tabController!.index) {
return;
}
snapValue =
const SnapState<int>.none().copyToHasData(_tabController!.index);
if (!_pageIndexIsChanging) {
if (duration == Duration.zero) {
_pageController?.jumpToPage(
_tabController!.index,
);
} else {
_pageController?.animateToPage(
_tabController!.index,
duration: duration,
curve: curve,
);
}
}
notify();
});
}