25-11-18/1

This commit is contained in:
Hamza-Ayed
2025-11-18 10:38:11 +03:00
parent a69e4c6912
commit b1b8efdd7d
19 changed files with 294 additions and 199 deletions

View File

@@ -306,7 +306,8 @@ class _PhoneNumberScreenState extends State<PhoneNumberScreen> {
final rawPhone = _phoneController.text.trim().replaceFirst('+', '');
final success = await PhoneAuthHelper.sendOtp(rawPhone);
if (success && mounted) {
Get.to(() => OtpVerificationScreen(phoneNumber: rawPhone));
// Get.to(() => OtpVerificationScreen(phoneNumber: rawPhone));
await PhoneAuthHelper.verifyOtp(rawPhone);
}
if (mounted) setState(() => _isLoading = false);
}
@@ -336,6 +337,7 @@ class _PhoneNumberScreenState extends State<PhoneNumberScreen> {
dropdownTextStyle: const TextStyle(color: Colors.black87),
decoration: InputDecoration(
labelText: 'Phone Number'.tr,
hintText: 'witout zero'.tr,
labelStyle: const TextStyle(color: Colors.black54),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
@@ -353,10 +355,14 @@ class _PhoneNumberScreenState extends State<PhoneNumberScreen> {
},
validator: (phone) {
if (phone == null || phone.number.isEmpty) {
return 'Please enter your phone number';
return 'Please enter your phone number'.tr;
}
// Check if the national number part starts with '0'
if (phone.number.startsWith('0')) {
return 'Please enter the number without the leading 0'.tr;
}
if (phone.completeNumber.length < 10) {
return 'Phone number seems too short';
return 'Phone number seems too short'.tr;
}
return null;
},
@@ -405,7 +411,7 @@ class _OtpVerificationScreenState extends State<OtpVerificationScreen> {
void _submit() async {
if (_formKey.currentState!.validate()) {
setState(() => _isLoading = true);
await PhoneAuthHelper.verifyOtp(widget.phoneNumber, _otpController.text);
await PhoneAuthHelper.verifyOtp(widget.phoneNumber);
if (mounted) setState(() => _isLoading = false);
}
}