From a889e46e3a0cc4356b11ecb2b8f28548c5c8b12c Mon Sep 17 00:00:00 2001 From: Thomas Obernosterer Date: Tue, 24 Oct 2023 15:17:56 +0200 Subject: [PATCH] feat(intro_page): allow skipButton and backButton to be used at the same time --- lib/src/introduction_screen.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 692b062..7026784 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -366,10 +366,6 @@ class IntroductionScreen extends StatefulWidget { !showBackButton || back != null || overrideBack != null, "You must set 'back' or 'overrideBack' parameter, or set 'showBackButton' to false", ), - assert( - !(showBackButton && showSkipButton), - "You cannot set 'showBackButton' and 'showSkipButton' to true. Only one, or both false.", - ), assert( skipOrBackFlex >= 0 && dotsFlex >= 0 && nextFlex >= 0, 'Flex parameters must be >= 0', @@ -550,7 +546,9 @@ class IntroductionScreenState extends State { final isLastPage = (getCurrentPage() == getPagesLength() - 1); Widget? leftBtn; - if (widget.showSkipButton) { + // show skip button when skip is enabled and back is disabled, + // or show it on the first page when back is enabled. + if (widget.showSkipButton && ((getCurrentPage() == 0 && widget.showBackButton) || !widget.showBackButton)) { leftBtn = Visibility( visible: !isLastPage && !_isSkipPressed, maintainState: true,