feat(auth): add toast feedback for code sending
This commit is contained in:
@@ -6,7 +6,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:formz/formz.dart';
|
import 'package:formz/formz.dart';
|
||||||
import '../../../../core/theme/design_tokens.dart';
|
import '../../../../core/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_button.dart';
|
import '../../../../shared/widgets/app_button.dart';
|
||||||
import '../../../../shared/widgets/banner/app_banner.dart';
|
import '../../../../shared/widgets/toast/toast.dart';
|
||||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||||
import '../../presentation/cubits/register_cubit.dart';
|
import '../../presentation/cubits/register_cubit.dart';
|
||||||
import '../../presentation/bloc/auth_bloc.dart';
|
import '../../presentation/bloc/auth_bloc.dart';
|
||||||
@@ -98,6 +98,7 @@ class _RegisterVerificationViewState extends State<RegisterVerificationView> {
|
|||||||
|
|
||||||
if (success && mounted) {
|
if (success && mounted) {
|
||||||
_startCountdown();
|
_startCountdown();
|
||||||
|
Toast.show(context, '验证码已发送', type: ToastType.success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +174,12 @@ class _RegisterVerificationViewState extends State<RegisterVerificationView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFormContainer() {
|
Widget _buildFormContainer() {
|
||||||
return BlocBuilder<RegisterCubit, RegisterState>(
|
return BlocConsumer<RegisterCubit, RegisterState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state.errorMessage != null && !state.isStep2Valid) {
|
||||||
|
Toast.show(context, state.errorMessage!, type: ToastType.error);
|
||||||
|
}
|
||||||
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 327,
|
width: 327,
|
||||||
@@ -183,14 +189,6 @@ class _RegisterVerificationViewState extends State<RegisterVerificationView> {
|
|||||||
_buildCodeInput(state),
|
_buildCodeInput(state),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildStepIndicator(),
|
_buildStepIndicator(),
|
||||||
if (state.errorMessage != null)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 8),
|
|
||||||
child: AppBanner(
|
|
||||||
message: state.errorMessage!,
|
|
||||||
type: ToastType.error,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
AppButton(
|
AppButton(
|
||||||
text: '完成注册',
|
text: '完成注册',
|
||||||
|
|||||||
Reference in New Issue
Block a user