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) {