fix mask formatter in phone

This commit is contained in:
mso7nueh
2026-01-29 15:49:13 +03:00
parent 4ff880e079
commit 044d86e710
4 changed files with 27 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widge
import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/core/firebase_api.dart';
import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/core/utils/validation_utils.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -538,7 +539,7 @@ class _RegisterViaSocialScreenState extends State<RegisterViaSocialScreen> {
if (hasErrorWeightOrHeightError) return;
// Очищаем номер телефона от маски для отправки
final cleanPhone = phoneController.text.replaceAll(RegExp(r'[^\d+]'), '');
final cleanPhone = ValidationUtils.normalizePhone(phoneController.text);
if (clientID == null) return;
// Вызываем OAuth регистрацию
@@ -615,7 +616,7 @@ class _RegisterViaSocialScreenState extends State<RegisterViaSocialScreen> {
final oauthCubit = CubitRegistrations.sl<OAuthCubit>();
// Всегда передаем и email и phone
final String email = emailController.text;
final String phone = phoneController.text.replaceAll(RegExp(r'[^\d+]'), '');
final String phone = ValidationUtils.normalizePhone(phoneController.text);
final response = await oauthCubit.requestOAuthVerification(email: email, phone: phone);
@@ -726,7 +727,7 @@ class _RegisterViaSocialScreenState extends State<RegisterViaSocialScreen> {
// Всегда передаем и email и phone (полный набор данных от провайдера)
// Используем данные из формы, если они есть, иначе из authResult
final String email = emailController.text.isNotEmpty ? emailController.text : (authResult.email ?? '');
final String phone = phoneController.text.isNotEmpty ? phoneController.text.replaceAll(RegExp(r'[^\d+]'), '') : (authResult.phone ?? '');
final String phone = phoneController.text.isNotEmpty ? ValidationUtils.normalizePhone(phoneController.text) : ValidationUtils.normalizePhone(authResult.phone ?? '');
// Проверяем, что данные есть
if (email.isEmpty && phone.isEmpty) {