From 0c82bdc810b46c2db44538be45f1d350c40847d8 Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Fri, 8 Nov 2024 14:43:48 +0700 Subject: [PATCH] Show first back button option --- lib/src/introduction_screen.dart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 692b062..909fd83 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -3,10 +3,9 @@ library introduction_screen; import 'dart:async'; import 'dart:math'; -import 'package:flutter/material.dart'; - import 'package:collection/collection.dart'; import 'package:dots_indicator/dots_indicator.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import '/src/helper.dart'; @@ -96,6 +95,11 @@ class IntroductionScreen extends StatefulWidget { /// @Default `false` final bool showBackButton; + /// If the Back button should be display for the first page + /// + /// @Default `false` + final bool showFirstBackButton; + /// If a custom Widget should be used instead of the default progress indicator /// /// @Default `null` @@ -299,6 +303,7 @@ class IntroductionScreen extends StatefulWidget { this.showDoneButton = true, this.showBottomPart = true, this.showBackButton = false, + this.showFirstBackButton = false, this.customProgress, this.isProgress = true, this.hideBottomOnKeyboard = false, @@ -567,9 +572,10 @@ class IntroductionScreenState extends State { onPressed: _onSkip, ), ); - } else if (widget.showBackButton && - getCurrentPage() > 0 && - widget.canProgress(getCurrentPage())) { + } else if ((widget.showFirstBackButton && getCurrentPage() == 0) || + (widget.showBackButton && + getCurrentPage() > 0 && + widget.canProgress(getCurrentPage()))) { leftBtn = widget.overrideBack ?? IntroButton( child: widget.back!,