MIF_E31221222/sigap-mobile/lib/src/utils/constants/form_key.dart

63 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
/// Class containing all the FormKey identifiers used across the app
/// This helps prevent duplication of form key strings and makes it easier to manage them
class TGlobalFormKey {
// Registration form step keys
static const String personalInfoForm = 'personal_info_new_form_key';
static const String idCardVerificationForm = 'id_card_verification_form_key';
static const String selfieVerificationForm = 'selfie_verification_form_key';
static const String identityVerificationForm =
'identity_verification_form_key';
static const String officerInfoForm = 'officer_info_form_key';
static const String unitInfoForm = 'unit_info_form_key';
// Authentication form keys
static const String signInForm = 'sign_in_form_key';
static const String signUpForm = 'sign_up_form_key';
static const String forgotPasswordForm = 'forgot_password_form_key';
static const String resetPasswordForm = 'reset_password_form_key';
static const String otpVerificationForm = 'otp_verification_form_key';
// Profile form keys
static const String editProfileForm = 'edit_profile_form_key';
static const String changePasswordForm = 'change_password_form_key';
static const String notificationSettingsForm =
'notification_settings_form_key';
// Create global keys for forms with specific debug labels
static GlobalKey<FormState> createFormKey(String keyName) {
return GlobalKey<FormState>(debugLabel: keyName);
}
// Helper function to get a personal info form key
static GlobalKey<FormState> personalInfo() {
return createFormKey(personalInfoForm);
}
// Helper function to get an ID card verification form key
static GlobalKey<FormState> idCardVerification() {
return createFormKey(idCardVerificationForm);
}
// Helper function to get a selfie verification form key
static GlobalKey<FormState> selfieVerification() {
return createFormKey(selfieVerificationForm);
}
// Helper function to get an identity verification form key
static GlobalKey<FormState> identityVerification() {
return createFormKey(identityVerificationForm);
}
// Helper function to get an officer info form key
static GlobalKey<FormState> officerInfo() {
return createFormKey(officerInfoForm);
}
// Helper function to get a unit info form key
static GlobalKey<FormState> unitInfo() {
return createFormKey(unitInfoForm);
}
}