From 654d34adb8747d5b495c2ec8733b4c3ca533dc08 Mon Sep 17 00:00:00 2001 From: Dan Reynolds Date: Thu, 16 Jul 2020 01:53:42 -0400 Subject: [PATCH] fix starting index for custom layouts --- lib/src/custom_layout.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/custom_layout.dart b/lib/src/custom_layout.dart index f826735..d88bf97 100644 --- a/lib/src/custom_layout.dart +++ b/lib/src/custom_layout.dart @@ -8,9 +8,11 @@ abstract class _CustomLayoutStateBase extends State AnimationController? _animationController; late int _startIndex; int? _animationCount; + int _currentIndex = 0; @override void initState() { + _currentIndex = widget.index ?? 0; if (widget.itemWidth == null) { throw Exception( '==============\n\nwidget.itemWidth must not be null when use stack layout.\n========\n', @@ -245,8 +247,6 @@ abstract class _CustomLayoutStateBase extends State _animationController!.value = value; } - - int _currentIndex = 0; } double? _getValue(List values, double animationValue, int index) {