From 7c447fcab10a9e2fd9b199f35507a0c41a343f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=98=8E?= <2534290808@qq.com> Date: Thu, 30 May 2019 17:56:35 +0800 Subject: [PATCH] fixes positions.isNotEmpty errors --- lib/transformer_page_view.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/transformer_page_view.dart b/lib/transformer_page_view.dart index f4bc33f..7160c11 100644 --- a/lib/transformer_page_view.dart +++ b/lib/transformer_page_view.dart @@ -522,7 +522,7 @@ class _TransformerPageViewState extends State { if (_pageController.getRenderIndexFromRealIndex(_activeIndex) != index) { _fromIndex = _activeIndex = _pageController.initialPage; - if (!created) { + if (!created && _pageController.hasClients) { int initPage = _pageController.getRealIndexFromRenderIndex(index); _pageController.animateToPage(initPage, duration: widget.duration, curve: widget.curve); @@ -601,13 +601,13 @@ class _TransformerPageViewState extends State { //ignore this event return; } - if (widget.controller.animation) { + if (widget.controller.animation && _pageController.hasClients) { _pageController .animateToPage(index, duration: widget.duration, curve: widget.curve ?? Curves.ease) .whenComplete(widget.controller.complete); } else { - _pageController.jumpToPage(index); + if(_pageController.hasClients){_pageController.jumpToPage(index);}; widget.controller.complete(); } }