From 8ca19d849a69f4faebdf475e9c9aa9c3442de9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8A=9B=E7=91=9E?= Date: Wed, 27 Jan 2021 16:51:48 +0800 Subject: [PATCH] fix initial index invalid in layout.custom --- lib/src/custom_layout.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/custom_layout.dart b/lib/src/custom_layout.dart index 8ce77f2..55fd6a6 100644 --- a/lib/src/custom_layout.dart +++ b/lib/src/custom_layout.dart @@ -408,12 +408,14 @@ class _CustomLayoutState extends _CustomLayoutStateBase<_CustomLayoutSwiper> { super.didChangeDependencies(); _startIndex = widget.option.startIndex; _animationCount = widget.option.stateCount; + _currentIndex = widget.index; } @override void didUpdateWidget(_CustomLayoutSwiper oldWidget) { _startIndex = widget.option.startIndex; _animationCount = widget.option.stateCount; + _currentIndex = widget.index; super.didUpdateWidget(oldWidget); }