Skip to content

Commit

Permalink
Added back button to intro page #189
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Nov 8, 2024
1 parent 61fed26 commit d31595c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
17 changes: 12 additions & 5 deletions lib/presentation/pages/intro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _IntroPageState extends State<IntroPage> {
IntroState state = IntroState.tips;
final Duration selectionTransitionDelay = const Duration(milliseconds: 200);

void onNextPressed() {
void onLastNextPressed() {
isFinish = true;
setState(() {
showBackButton = false;
Expand All @@ -52,9 +52,16 @@ class _IntroPageState extends State<IntroPage> {
void nextPage() => _introKey.currentState?.next();

void onDone() => Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => ActivityPage()));
.pushReplacement(MaterialPageRoute(builder: (context) => ActivityPage()));

void previousPage() {
bool isPop = false;

Future previousPage() async {
if (state.pageNumber == 0 && !isPop) {
isPop = true;
Navigator.of(context).maybePop();
return;
}
if (isFinish) {
return;
}
Expand Down Expand Up @@ -120,7 +127,6 @@ class _IntroPageState extends State<IntroPage> {
variant: ButtonVariant.lowEmphasisIcon,
onPressed: previousPage,
icon: FontAwesomeIcons.arrowLeft,
disabled: !showNextButton,
),
),
pages: [
Expand All @@ -136,10 +142,11 @@ class _IntroPageState extends State<IntroPage> {
customPageViewModel(
bodyWidget: ReadyForSessionPage(
onDone: onDone,
onNextPressed: onNextPressed,
onNextPressed: onLastNextPressed,
),
),
],
showFirstBackButton: true,
showBackButton: showBackButton,
back: const Icon(Icons.arrow_back),
next: const Icon(Icons.arrow_forward),
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ dependencies:
font_awesome_flutter: ^10.7.0
google_fonts: ^6.2.1
health: ^10.2.0
introduction_screen: ^3.1.14
introduction_screen:
git:
url: https://github.com/guyluz11/introduction_screen.git
ref: master
# Small, easy to use and extensible logger which prints beautiful logs.
liquid_progress_indicator_v2: ^0.5.0
logger: ^2.2.0
Expand Down

0 comments on commit d31595c

Please sign in to comment.