From d672a2356444081ed32967be25be80904d34118c Mon Sep 17 00:00:00 2001 From: Dian Bayu Nugroho Date: Wed, 7 Feb 2024 17:17:32 +0700 Subject: [PATCH] fix: stepper submission data --- android/app/src/main/AndroidManifest.xml | 3 ++- .../take_picture_screen/DisplayPictureScreen.dart | 4 +++- .../view/submission_data/submission_parent.dart | 6 +++--- .../viewmodel/submission_data_viewmodel.dart | 11 ++++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index c536cf0..1c0330d 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ + { provider.stepAmount, (index) => _stepItem( isCurrentStep: - provider.currentStep == index + 1, + provider.getCurrentStep == index + 1, ), ), ), @@ -110,10 +110,10 @@ class _SubmissionParentState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: _content(provider.currentStep), + child: _content(provider.getCurrentStep), ), ), - provider.currentStep == 3 + provider.getCurrentStep == 3 ? const SizedBox() : Align( alignment: Alignment.bottomCenter, diff --git a/lib/features/auth/registration/viewmodel/submission_data_viewmodel.dart b/lib/features/auth/registration/viewmodel/submission_data_viewmodel.dart index dd5cf62..045cc61 100644 --- a/lib/features/auth/registration/viewmodel/submission_data_viewmodel.dart +++ b/lib/features/auth/registration/viewmodel/submission_data_viewmodel.dart @@ -2,7 +2,8 @@ import 'package:camera/camera.dart'; import 'package:flutter/material.dart'; class SubmissionDataViewModel extends ChangeNotifier { - int currentStep = 1; + static int _currentStep = 1; + int get getCurrentStep => _currentStep; int stepAmount = 9; bool _isEmailVerify = false; bool get isEmailVerify => _isEmailVerify; @@ -19,8 +20,8 @@ class SubmissionDataViewModel extends ChangeNotifier { } onWillPopSubmission(BuildContext context) { - if (currentStep != 1) { - currentStep--; + if (getCurrentStep != 1) { + _currentStep--; notifyListeners(); } else { Navigator.of(context).pop(true); @@ -28,8 +29,8 @@ class SubmissionDataViewModel extends ChangeNotifier { } nextSubmission(BuildContext context) { - if (currentStep < stepAmount) { - currentStep++; + if (getCurrentStep < stepAmount) { + _currentStep++; } else { //ToDo : Go To next step after completing the submission }