diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3bd83..016c602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [1.1.7] - [2020/07/16] + + * Fix index for custom layouts ## [1.1.5] - [2019/03/10] @@ -81,4 +84,4 @@ * Pagination * Custom control buttons * Custom pagination - * Controler \ No newline at end of file + * Controler diff --git a/lib/src/custom_layout.dart b/lib/src/custom_layout.dart index 8ce77f2..6ebc4b4 100644 --- a/lib/src/custom_layout.dart +++ b/lib/src/custom_layout.dart @@ -8,9 +8,11 @@ abstract class _CustomLayoutStateBase extends State AnimationController _animationController; int _startIndex; int _animationCount; + int _currentIndex; @override void initState() { + _currentIndex = widget.index ?? 0; if (widget.itemWidth == null) { throw new Exception( "==============\n\nwidget.itemWith must not be null when use stack layout.\n========\n"); @@ -244,8 +246,6 @@ abstract class _CustomLayoutStateBase extends State _animationController.value = value; } - - int _currentIndex = 0; } double _getValue(List values, double animationValue, int index) { diff --git a/pubspec.yaml b/pubspec.yaml index 17ed711..93683a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_swiper description: The best swiper(carousel) for flutter, with multiple layouts, infinite loop. Compatible with Android & iOS. -version: 1.1.6 +version: 1.1.7 author: JZoom homepage: https://github.com/jzoom/flutter_swiper