@@ -85,8 +85,6 @@ class GFCarousel extends StatefulWidget {
8585 /// Called whenever the page in the center of the viewport changes.
8686 final Function (int index) onPageChanged;
8787
88- // int onPageIndex;
89-
9088 /// How the carousel should respond to user input.
9189 ///
9290 /// For example, determines how the items continues to animate after the
@@ -98,45 +96,6 @@ class GFCarousel extends StatefulWidget {
9896 /// Defaults to matching platform conventions.
9997 final ScrollPhysics scrollPhysics;
10098
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-
14099 List <T > map <T >(List list, Function handler) {
141100 List <T > result;
142101 result = [];
@@ -152,7 +111,6 @@ class GFCarousel extends StatefulWidget {
152111
153112class _GFCarouselState extends State <GFCarousel > with TickerProviderStateMixin {
154113 Timer timer;
155- // int _current = 0;
156114
157115 /// Size of cell
158116 double size = 0 ;
@@ -249,9 +207,7 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
249207 }
250208 if (widget.pagination == true && widget.onPageChanged == null ) {
251209 onPageSlide (currentPage);
252- // _current = currentPage;
253210 }
254- // _current = currentPage;
255211 },
256212 itemBuilder: (BuildContext context, int i) {
257213 final int index = _getRealIndex (
@@ -265,21 +221,11 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
265221 animation: pageController,
266222 child: widget.items[index],
267223 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-
277224 double value;
278225 try {
279226 value = pageController.page - i;
280227 // ignore: avoid_catches_without_on_clauses
281228 } catch (e) {
282- // value = 1;
283229 final BuildContext storageContext =
284230 pageController.position.context.storageContext;
285231 final double previousSavedPosition =
0 commit comments