useTabController function
TabController
useTabController({
- required int length,
- TickerProvider? vsync,
- int initialIndex = 0,
- Duration? animationDuration,
Creates a TabController.
The controller is automatically disposed when the widget is unmounted.
Implementation
TabController useTabController({
/// An optional [vsync] parameter to synchronize the tab animations.
/// If not provided, a ticker will be created automatically.
required int length,
TickerProvider? vsync,
int initialIndex = 0,
Duration? animationDuration,
}) {
vsync ??= useSingleTickerState();
final c = TabController(
length: length,
vsync: vsync,
initialIndex: initialIndex,
animationDuration: animationDuration,
);
onBeforeUnmount(c.dispose);
return c;
}