flutter_input_library/lib/src/inputs/carousel/carousel_state.dart

50 lines
1.5 KiB
Dart
Raw Normal View History

2022-11-29 13:16:44 +01:00
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
import "package:flutter/material.dart";
import "package:flutter_input_library/src/inputs/carousel/carousel_slider.dart";
2022-11-29 13:16:44 +01:00
class CarouselState {
2024-02-02 11:48:45 +01:00
CarouselState(
this.options,
this.onResetTimer,
this.onResumeTimer,
this.changeMode,
);
2022-11-29 13:16:44 +01:00
/// The [CarouselOptions] to create this state
CarouselOptions options;
/// [pageController] is created using the properties passed to the constructor
/// and can be used to control the [PageView] it is passed to.
PageController? pageController;
/// The actual index of the [PageView].
///
/// This value can be ignored unless you know the carousel will be scrolled
/// backwards more then 10000 pages.
/// Defaults to 10000 to simulate infinite backwards scrolling.
int realPage = 10000;
/// The initial index of the [PageView] on [CarouselSlider] init.
///
int initialPage = 0;
/// The widgets count that should be shown at carousel
int? itemCount;
/// Will be called when using [pageController] to go to next page or
/// previous page. It will clear the autoPlay timer.
/// Internal use only
2024-02-02 11:48:45 +01:00
Function() onResetTimer;
2022-11-29 13:16:44 +01:00
/// Will be called when using pageController to go to next page or
/// previous page. It will restart the autoPlay timer.
/// Internal use only
2024-02-02 11:48:45 +01:00
Function() onResumeTimer;
2022-11-29 13:16:44 +01:00
/// The callback to set the Reason Carousel changed
Function(CarouselPageChangedReason) changeMode;
}