refactor: Clean up code formatting and improve logging in liveness detection and registration form

This commit is contained in:
vergiLgood1 2025-05-24 15:09:35 +07:00
parent 64c9f233a1
commit 790eb4325d
3 changed files with 13 additions and 16 deletions

View File

@ -469,7 +469,7 @@ class FaceLivenessController extends GetxController {
// Capture image with retry logic
int retryCount = 0;
const maxRetries = 3;
while (retryCount < maxRetries) {
try {
capturedImage = await cameraController!.takePicture();
@ -480,11 +480,11 @@ class FaceLivenessController extends GetxController {
'Capture attempt $retryCount failed: $e',
name: 'LIVENESS_CONTROLLER',
);
if (retryCount >= maxRetries) {
rethrow;
}
// Wait before retry
await Future.delayed(Duration(milliseconds: 500));
}

View File

@ -13,7 +13,7 @@ class LivenessDetectionPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
dev.log('Building LivenessDetectionPage', name: 'LIVENESS_DEBUG');
// Ensure controllers are registered
final bool hasController = Get.isRegistered<FaceLivenessController>();
final bool hasSelfieController =
@ -73,7 +73,7 @@ class LivenessDetectionPage extends StatelessWidget {
dev.log(
'Controller state: '
'Camera initialized: ${controller.cameraController?.value.isInitialized}, '
'Is captured: ${controller.isCaptured.value}',
'Is captured: ${controller.isCaptured}',
name: 'LIVENESS_DEBUG',
);
@ -145,13 +145,13 @@ class LivenessDetectionPage extends StatelessWidget {
'Steps: ${controller.successfulSteps.length}',
name: 'LIVENESS_DEBUG',
);
// Show loading indicator while camera initializes
if (controller.cameraController == null) {
dev.log('Camera controller is null', name: 'LIVENESS_DEBUG');
return _buildErrorState('Camera initialization failed');
}
if (!controller.cameraController!.value.isInitialized) {
dev.log('Camera not initialized yet', name: 'LIVENESS_DEBUG');
return Center(
@ -262,7 +262,7 @@ class LivenessDetectionPage extends StatelessWidget {
borderRadius: BorderRadius.circular(24),
),
),
// Camera preview
ClipRRect(
borderRadius: BorderRadius.circular(24),
@ -574,7 +574,7 @@ class LivenessDetectionPage extends StatelessWidget {
),
const SizedBox(height: 20),
Text(
'Verification Successful!',
style: TextStyle(
@ -583,7 +583,7 @@ class LivenessDetectionPage extends StatelessWidget {
color: Colors.green.shade700,
),
),
const SizedBox(height: 8),
Text(
@ -812,10 +812,7 @@ class LivenessDetectionPage extends StatelessWidget {
'Ready For Photo',
'${controller.isFaceReadyForPhoto.value}',
),
_debugItem(
'Captured',
'${controller.isCaptured.value}',
),
_debugItem('Captured', '${controller.isCaptured}'),
_debugItem(
'Steps Completed',
'${controller.successfulSteps.length}',

View File

@ -4,8 +4,8 @@ import 'package:get/get.dart';
import 'package:sigap/src/features/auth/presentasion/controllers/basic/registration_form_controller.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/basic/id_card_verification_step.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/basic/identity_verification_step.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/basic/liveness_detection_screen.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/basic/personal_info_step.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/basic/selfie_verification_step.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/officer/officer_info_step.dart';
import 'package:sigap/src/features/auth/presentasion/pages/registration-form/officer/unit_info_step.dart';
import 'package:sigap/src/features/auth/presentasion/widgets/auth_button.dart';
@ -169,7 +169,7 @@ class FormRegistrationScreen extends StatelessWidget {
case 1:
return const IdCardVerificationStep();
case 2:
return const LivenessDetectionPage();
return const SelfieVerificationStep();
case 3:
return isOfficer
? const OfficerInfoStep()