adding multilingual support
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:base_project/routes/route_names.dart';
|
||||
import 'package:base_project/view_model/auth/auth_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
import '../../core/providers/dynamic_theme_provider.dart';
|
||||
import '../../core/providers/theme_provider.dart';
|
||||
@@ -497,7 +498,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Welcome Back!',
|
||||
AppLocalizations.of(context)!.welcomeBack,
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -507,7 +508,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing12),
|
||||
Text(
|
||||
'Sign in to continue to your account',
|
||||
AppLocalizations.of(context)!.signInToContinue,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurface.withOpacity(0.8),
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -557,8 +558,8 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
children: [
|
||||
// Email Field
|
||||
_buildEnhancedTextField(
|
||||
label: 'Email Address',
|
||||
hint: 'Enter your email',
|
||||
label: AppLocalizations.of(context)!.emailAddress,
|
||||
hint: AppLocalizations.of(context)!.enterYourEmail,
|
||||
controller: _emailController,
|
||||
focusNode: _emailFocusNode,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
@@ -569,11 +570,11 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
onSubmitted: (_) => _passwordFocusNode.requestFocus(),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Email is required';
|
||||
return AppLocalizations.of(context)!.emailRequired;
|
||||
}
|
||||
if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$')
|
||||
.hasMatch(value)) {
|
||||
return 'Please enter a valid email';
|
||||
return AppLocalizations.of(context)!.validEmail;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -583,8 +584,8 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
|
||||
// Password Field
|
||||
_buildEnhancedTextField(
|
||||
label: 'Password',
|
||||
hint: 'Enter your password',
|
||||
label: AppLocalizations.of(context)!.password,
|
||||
hint: AppLocalizations.of(context)!.enterYourPassword,
|
||||
controller: _passwordController,
|
||||
focusNode: _passwordFocusNode,
|
||||
obscureText: !_isPasswordVisible,
|
||||
@@ -607,10 +608,10 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
textInputAction: TextInputAction.done,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Password is required';
|
||||
return AppLocalizations.of(context)!.passwordRequired;
|
||||
}
|
||||
if (value.length < 6) {
|
||||
return 'Password must be at least 6 characters';
|
||||
return AppLocalizations.of(context)!.passwordMinLength;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -727,7 +728,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing6),
|
||||
Text(
|
||||
'Forgot Password?',
|
||||
AppLocalizations.of(context)!.forgotPassword,
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -771,7 +772,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
child: Consumer<AuthViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return ModernButton(
|
||||
text: 'Sign In',
|
||||
text: AppLocalizations.of(context)!.signIn,
|
||||
type: ModernButtonType.primary,
|
||||
size: ModernButtonSize.large,
|
||||
isLoading: provider.isLoading,
|
||||
@@ -823,7 +824,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Don't have an account? ",
|
||||
'${AppLocalizations.of(context)!.noAccount} ',
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Colors.grey.shade700,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -834,7 +835,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
Navigator.pushNamed(context, RouteNames.getOtpView);
|
||||
},
|
||||
child: Text(
|
||||
'Sign Up',
|
||||
AppLocalizations.of(context)!.signUp,
|
||||
style: Theme.of(context).textTheme.labelLarge?.copyWith(
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -870,7 +871,7 @@ class _LoginViewState extends State<LoginView> with TickerProviderStateMixin {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: UIConstants.spacing16),
|
||||
child: Text(
|
||||
'Or continue with',
|
||||
AppLocalizations.of(context)!.orContinueWith,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
Reference in New Issue
Block a user