pageController method

PageController pageController({
  1. int initialPage = 0,
  2. bool keepPage = true,
  3. double viewportFraction = 1.0,
  4. void onAttach(
    1. ScrollPosition
    )?,
  5. void onDetach(
    1. ScrollPosition
    )?,
})

Provides a way to easily get a copy of a PageController.

Implementation

PageController pageController({
  int initialPage = 0,
  bool keepPage = true,
  double viewportFraction = 1.0,
  void Function(ScrollPosition)? onAttach,
  void Function(ScrollPosition)? onDetach,
}) {
  return use.disposable(
    () => PageController(
      initialPage: initialPage,
      keepPage: keepPage,
      viewportFraction: viewportFraction,
      onAttach: onAttach,
      onDetach: onDetach,
    ),
    (controller) => controller.dispose(),
    [initialPage, keepPage, viewportFraction, onAttach, onDetach],
  );
}