forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main' into issue-1089
This commit is contained in:
@@ -15,7 +15,11 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class VerifyEmailScreen extends StatefulWidget {
|
||||
const VerifyEmailScreen({super.key});
|
||||
const VerifyEmailScreen({super.key, this.returnOnSuccess = false});
|
||||
|
||||
/// Вернуться на предыдущий экран вместо перехода в ленту после подтверждения.
|
||||
/// Используется, когда экран открыт из публичного действия (пост, лайк, комментарий).
|
||||
final bool returnOnSuccess;
|
||||
|
||||
@override
|
||||
State<VerifyEmailScreen> createState() => _VerifyEmailScreenState();
|
||||
@@ -89,7 +93,12 @@ class _VerifyEmailScreenState extends State<VerifyEmailScreen> {
|
||||
_startTimer();
|
||||
} else if (state is VerifyEmailStateVerifySuccess) {
|
||||
showSuccessToast('Почта успешно подтверждена');
|
||||
goRouter.pushNamed('feedScreen');
|
||||
if (widget.returnOnSuccess) {
|
||||
// Экран открыт из публичного действия — возвращаемся назад с результатом.
|
||||
goRouter.pop(true);
|
||||
} else {
|
||||
goRouter.pushNamed('feedScreen');
|
||||
}
|
||||
} else if (state is VerifyEmailStateVerifyError) {
|
||||
showErrorToast("Неверный код. Попробуйте снова.");
|
||||
for (var controller in _controllers) {
|
||||
@@ -166,18 +175,20 @@ class _VerifyEmailScreenState extends State<VerifyEmailScreen> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
CustomOutlinedButton(
|
||||
text: 'Позже',
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.black900),
|
||||
buttonStyle: ButtonStyle(
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.gray.withValues(alpha: 0.1)),
|
||||
// При переходе из публичного действия уйти без подтверждения нельзя.
|
||||
if (!widget.returnOnSuccess)
|
||||
CustomOutlinedButton(
|
||||
text: 'Позже',
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.black900),
|
||||
buttonStyle: ButtonStyle(
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.gray.withValues(alpha: 0.1)),
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<VerifyEmailCubit>().skipVerification();
|
||||
},
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<VerifyEmailCubit>().skipVerification();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user