diff --git a/apps/lib/features/auth/ui/screens/register_screen.dart b/apps/lib/features/auth/ui/screens/register_screen.dart index 3af8e76..7afe657 100644 --- a/apps/lib/features/auth/ui/screens/register_screen.dart +++ b/apps/lib/features/auth/ui/screens/register_screen.dart @@ -8,6 +8,7 @@ import '../../../../core/theme/design_tokens.dart'; import '../../../../core/di/injection.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 '../../presentation/cubits/register_cubit.dart'; import '../../data/auth_repository.dart'; @@ -52,6 +53,17 @@ class _RegisterViewState extends State { cubit.passwordChanged(_passwordController.text); if (!cubit.state.isStep1Valid || cubit.state.isSending) { + String? errorMsg; + if (!cubit.state.username.isValid) { + errorMsg = '请输入有效的昵称(3-30个字符)'; + } else if (!cubit.state.email.isValid) { + errorMsg = '请输入有效的邮箱地址'; + } else if (!cubit.state.password.isValid) { + errorMsg = '密码至少需要6个字符'; + } + if (errorMsg != null && mounted) { + Toast.show(context, errorMsg, type: ToastType.warning); + } return; }