Skip to content

Commit ed27dbf

Browse files
authored
Merge pull request #219 from dekoster-IT-Consulting-GmbH/master
feat(intro_page): allow skipButton and backButton to be used at the same time
2 parents 75d4d14 + a889e46 commit ed27dbf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/src/introduction_screen.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,6 @@ class IntroductionScreen extends StatefulWidget {
366366
!showBackButton || back != null || overrideBack != null,
367367
"You must set 'back' or 'overrideBack' parameter, or set 'showBackButton' to false",
368368
),
369-
assert(
370-
!(showBackButton && showSkipButton),
371-
"You cannot set 'showBackButton' and 'showSkipButton' to true. Only one, or both false.",
372-
),
373369
assert(
374370
skipOrBackFlex >= 0 && dotsFlex >= 0 && nextFlex >= 0,
375371
'Flex parameters must be >= 0',
@@ -550,7 +546,9 @@ class IntroductionScreenState extends State<IntroductionScreen> {
550546
final isLastPage = (getCurrentPage() == getPagesLength() - 1);
551547

552548
Widget? leftBtn;
553-
if (widget.showSkipButton) {
549+
// show skip button when skip is enabled and back is disabled,
550+
// or show it on the first page when back is enabled.
551+
if (widget.showSkipButton && ((getCurrentPage() == 0 && widget.showBackButton) || !widget.showBackButton)) {
554552
leftBtn = Visibility(
555553
visible: !isLastPage && !_isSkipPressed,
556554
maintainState: true,

0 commit comments

Comments
 (0)