fix(apps): consolidate FormzInput validators and fix login screen
- Move FormzInput validators to core/form_inputs/form_inputs.dart - Fix login_screen.dart syntax error (missing 'class' keyword) - Remove unused _isLoading field - Fix unnecessary const keywords - Update login_cubit and register_cubit imports - Remove duplicate FormzInput definitions from register_cubit - Add Toast and Banner UI feedback system - Remove legacy login/register screens (login_code, login_email, login_password, register_step2) - Remove unused warning_banner widget - Update tests for new error messages and DI setup
This commit is contained in:
@@ -3,8 +3,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:formz/formz.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../../../../core/di/injection.dart';
|
||||
import '../../../../shared/widgets/app_button.dart';
|
||||
import '../../../../shared/widgets/warning_banner.dart';
|
||||
import '../../../../shared/widgets/banner/app_banner.dart';
|
||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||
import '../../presentation/cubits/register_cubit.dart';
|
||||
import '../../data/auth_repository.dart';
|
||||
|
||||
@@ -14,7 +16,7 @@ class RegisterScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => RegisterCubit(context.read<AuthRepository>()),
|
||||
create: (context) => RegisterCubit(sl<AuthRepository>()),
|
||||
child: const RegisterView(),
|
||||
);
|
||||
}
|
||||
@@ -53,7 +55,7 @@ class _RegisterViewState extends State<RegisterView> {
|
||||
|
||||
final success = await cubit.submitStep1();
|
||||
if (success && mounted) {
|
||||
context.push('/register/step2', extra: cubit);
|
||||
context.push('/register/verification', extra: cubit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,9 +148,9 @@ class _RegisterViewState extends State<RegisterView> {
|
||||
if (state.errorMessage != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: WarningBanner(
|
||||
child: AppBanner(
|
||||
message: state.errorMessage!,
|
||||
visible: true,
|
||||
type: ToastType.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
Reference in New Issue
Block a user