@@ -85,8 +85,6 @@ class GFCarousel extends StatefulWidget {
85
85
/// Called whenever the page in the center of the viewport changes.
86
86
final Function (int index) onPageChanged;
87
87
88
- // int onPageIndex;
89
-
90
88
/// How the carousel should respond to user input.
91
89
///
92
90
/// For example, determines how the items continues to animate after the
@@ -98,45 +96,6 @@ class GFCarousel extends StatefulWidget {
98
96
/// Defaults to matching platform conventions.
99
97
final ScrollPhysics scrollPhysics;
100
98
101
- /// Animates the controlled [GFCarousel] to the next page.
102
- ///
103
- /// The animation lasts for the given duration and follows the given curve.
104
- /// The returned [Future] resolves when the animation completes.
105
- // Future<void> nextPage({Duration duration, Curve curve}) =>
106
- // pageController.nextPage(duration: duration, curve: curve);
107
- //
108
- // /// Animates the controlled [GFCarousel] to the previous page.
109
- // ///
110
- // /// The animation lasts for the given duration and follows the given curve.
111
- // /// The returned [Future] resolves when the animation completes.
112
- // Future<void> previousPage({Duration duration, Curve curve}) =>
113
- // pageController.previousPage(duration: duration, curve: curve);
114
- //
115
- // /// Changes which page is displayed in the controlled [GFCarousel].
116
- // ///
117
- // /// Jumps the page position from its current value to the given value,
118
- // /// without animation, and without checking if the new value is in range.
119
- // void jumpToPage(int page) {
120
- // final index =
121
- // _getRealIndex(pageController.page.toInt(), realPage, items.length);
122
- // return pageController
123
- // .jumpToPage(pageController.page.toInt() + page - index);
124
- // }
125
- //
126
- // /// Animates the controlled [GFCarousel] from the current page to the given page.
127
- // ///
128
- // /// The animation lasts for the given duration and follows the given curve.
129
- // /// The returned [Future] resolves when the animation completes.
130
- // Future<void> animateToPage(int page, {Duration duration, Curve curve}) {
131
- // final index =
132
- // _getRealIndex(pageController.page.toInt(), realPage, items.length);
133
- // return pageController.animateToPage(
134
- // pageController.page.toInt() + page - index,
135
- // duration: duration,
136
- // curve: curve,
137
- // );
138
- // }
139
-
140
99
List <T > map <T >(List list, Function handler) {
141
100
List <T > result;
142
101
result = [];
@@ -152,7 +111,6 @@ class GFCarousel extends StatefulWidget {
152
111
153
112
class _GFCarouselState extends State <GFCarousel > with TickerProviderStateMixin {
154
113
Timer timer;
155
- // int _current = 0;
156
114
157
115
/// Size of cell
158
116
double size = 0 ;
@@ -249,9 +207,7 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
249
207
}
250
208
if (widget.pagination == true && widget.onPageChanged == null ) {
251
209
onPageSlide (currentPage);
252
- // _current = currentPage;
253
210
}
254
- // _current = currentPage;
255
211
},
256
212
itemBuilder: (BuildContext context, int i) {
257
213
final int index = _getRealIndex (
@@ -265,21 +221,11 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
265
221
animation: pageController,
266
222
child: widget.items[index],
267
223
builder: (BuildContext context, child) {
268
- // on the first render, the pageController.page is null,
269
- // this is a dirty hack
270
-
271
- // if (pageController.position.minScrollExtent == null ||
272
- // pageController.position.maxScrollExtent == null) {
273
- // Future.delayed(const Duration(microseconds: 1), () {});
274
- // return Container();
275
- // }
276
-
277
224
double value;
278
225
try {
279
226
value = pageController.page - i;
280
227
// ignore: avoid_catches_without_on_clauses
281
228
} catch (e) {
282
- // value = 1;
283
229
final BuildContext storageContext =
284
230
pageController.position.context.storageContext;
285
231
final double previousSavedPosition =
0 commit comments