fix: submit data id card

This commit is contained in:
2024-02-19 19:41:36 +07:00
parent 9ba8b79112
commit 466d49312d
7 changed files with 152 additions and 48 deletions

View File

@@ -1,8 +1,13 @@
import 'package:camera/camera.dart';
import 'package:cims_apps/application/component/select_form/select_form_view.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class SubmissionDataViewModel extends ChangeNotifier {
SubmissionDataViewModel() {
_getData();
}
static int _currentStep = 1;
int get getCurrentStep => _currentStep;
int stepAmount = 9;
@@ -45,6 +50,11 @@ class SubmissionDataViewModel extends ChangeNotifier {
ItemSelectForm('key5', 'CIMB NIAGA'),
];
List<ItemSelectForm> listImg = [
ItemSelectForm('', 'ID Card', image: ''),
ItemSelectForm('', 'Selfie with ID Card', image: ''),
];
Future<List<CameraDescription>> initCamera() async {
final cameras = await availableCameras();
final camerasDesc = cameras;
@@ -83,4 +93,15 @@ class SubmissionDataViewModel extends ChangeNotifier {
}
return false;
}
Future<void> _getData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? imagePath = prefs.getString('imagePath');
String? imagePathSelfie = prefs.getString('imagePathSelfie');
if (imagePath != null && imagePathSelfie != null) {
listImg[0].image = imagePath;
listImg[1].image = imagePathSelfie;
}
notifyListeners();
}
}