cims_apps/lib/features/auth/registration/viewmodel/submission_data_viewmodel.dart

87 lines
2.5 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:camera/camera.dart';
import 'package:cims_apps/application/component/select_form/select_form_view.dart';
import 'package:flutter/material.dart';
class SubmissionDataViewModel extends ChangeNotifier {
static int _currentStep = 1;
int get getCurrentStep => _currentStep;
int stepAmount = 9;
bool _isEmailVerify = false;
bool get isEmailVerify => _isEmailVerify;
var formKeyPersonalData = GlobalKey<FormState>();
TextEditingController ctrlOccupation = TextEditingController();
TextEditingController ctrlIncome = TextEditingController();
TextEditingController ctrlMarital = TextEditingController();
TextEditingController ctrlSourceFund = TextEditingController();
TextEditingController ctrlBankName = TextEditingController();
int step = 1;
List<ItemSelectForm> listOccupation = [
ItemSelectForm('key1', 'Student'),
ItemSelectForm('key2', 'Entrepreneur'),
ItemSelectForm('key3', 'Civil Servant'),
];
List<ItemSelectForm> listIncome = [
ItemSelectForm('key1', '< 10 million/year'),
ItemSelectForm('key2', '10 50 million/year'),
ItemSelectForm('key3', '50 100 million/year'),
];
List<ItemSelectForm> listMarital = [
ItemSelectForm('key1', 'Single'),
ItemSelectForm('key2', 'Married'),
ItemSelectForm('key3', 'Divorced'),
];
List<ItemSelectForm> listSourceFund = [
ItemSelectForm('key1', 'Revenue'),
ItemSelectForm('key2', 'Business Profit'),
ItemSelectForm('key3', 'Saving interest'),
];
List<ItemSelectForm> listBank = [
ItemSelectForm('key1', 'BCA'),
ItemSelectForm('key2', 'BRI'),
ItemSelectForm('key3', 'BNI'),
ItemSelectForm('key4', 'BANK MANDIRI'),
ItemSelectForm('key5', 'CIMB NIAGA'),
];
Future<List<CameraDescription>> initCamera() async {
final cameras = await availableCameras();
final camerasDesc = cameras;
return camerasDesc;
}
submitEmail() {
_isEmailVerify = !_isEmailVerify;
notifyListeners();
}
onWillPopSubmission(BuildContext context) {
if (getCurrentStep != 1) {
_currentStep--;
notifyListeners();
} else {
Navigator.of(context).pop(true);
}
}
nextSubmission(BuildContext context) {
if (getCurrentStep < stepAmount) {
_currentStep++;
} else {
//ToDo : Go To next step after completing the submission
}
notifyListeners();
}
Future<bool> next(BuildContext context) async {
if (getCurrentStep < stepAmount) {
_currentStep++;
notifyListeners();
return true;
}
return false;
}
}