forked from eatvio/eatvio_app
feat(verify_email): add dialog
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/verify_email_cubit/verify_email_state.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/widgets/change_email_dialog.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/widgets/code_not_received_dialog.dart';
|
||||
import 'package:eatvio_app/features/registration/services/registration_analytics_service.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -113,7 +114,21 @@ class _VerifyEmailScreenState extends State<VerifyEmailScreen> {
|
||||
Text("Код отправлен на почту\n$email", textAlign: TextAlign.center),
|
||||
const SizedBox(height: 20),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: List.generate(4, (index) => _buildCodeField(context, index))),
|
||||
const SizedBox(height: 40),
|
||||
const SizedBox(height: 16),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
final verifyEmailCubit = context.read<VerifyEmailCubit>();
|
||||
showDialog(context: context, builder: (context) => CodeNotReceivedDialog(
|
||||
currentEmail: email,
|
||||
verifyEmailCubit: verifyEmailCubit,
|
||||
));
|
||||
},
|
||||
child: Text(
|
||||
'Не приходит код?',
|
||||
style: TextStyles.textSMedium.copyWith(color: appTheme.blueA400, decoration: TextDecoration.underline),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
CustomOutlinedButton(
|
||||
text: 'Запросить код повторно',
|
||||
height: 52,
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/widgets/change_email_dialog.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart';
|
||||
|
||||
class CodeNotReceivedDialog extends StatelessWidget {
|
||||
final String currentEmail;
|
||||
final VerifyEmailCubit verifyEmailCubit;
|
||||
|
||||
const CodeNotReceivedDialog({
|
||||
super.key,
|
||||
required this.currentEmail,
|
||||
required this.verifyEmailCubit
|
||||
});
|
||||
|
||||
void _showChangeEmailDialog(BuildContext context) {
|
||||
Navigator.of(context).pop(); // Закрываем текущий диалог
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => ChangeEmailDialog(
|
||||
currentEmail: currentEmail,
|
||||
verifyEmailCubit: verifyEmailCubit,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
border: Border.all(color: Colors.grey[800]!, width: 2.0),
|
||||
),
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('Почему может не приходить код?', style: TextStyles.textLSemibold.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 16),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.gray600),
|
||||
children: [
|
||||
const TextSpan(text: 'Опечатка в email: Если адрес введён неправильно, код не придёт. '),
|
||||
TextSpan(
|
||||
text: 'Ввести email повторно.',
|
||||
style: TextStyles.textMMedium.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () => _showChangeEmailDialog(context),
|
||||
),
|
||||
const TextSpan(text: '\n\nПроверьте спам/промо/мусорную папку: Код может попасть туда из-за фильтров почтового провайдера\n\nПодождите 1-2 минуты: Иногда email задерживается из-за сетевых проблем.\n\nУбедитесь в стабильном соединении: Проверьте интернет и уведомления на устройстве.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: appTheme.blueA400,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Text('Понятно', style: TextStyles.textMSemibold.copyWith(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user