adding i18n to all other pages
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../Utils/image_constant.dart';
|
||||
import '../../Utils/size_utils.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../providers/token_manager.dart';
|
||||
import '../../resources/api_constants.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
@@ -40,14 +41,15 @@ class ResetPasswordScreen extends StatelessWidget {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
centerTitle: true,
|
||||
title: AppbarTitle(text: "Reset Password")),
|
||||
title: AppbarTitle(
|
||||
text: AppLocalizations.of(context)!.resetPassword)),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"You're signed in as $userEmail",
|
||||
AppLocalizations.of(context)!.signedInAs(userEmail),
|
||||
style: AppStyle.txtGilroyMedium16Bluegray800
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@@ -62,7 +64,7 @@ class ResetPasswordScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'Wrong account? Log in instead.',
|
||||
AppLocalizations.of(context)!.wrongAccount,
|
||||
style: AppStyle.txtGreenSemiBold16,
|
||||
),
|
||||
),
|
||||
@@ -132,7 +134,7 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
|
||||
Padding(
|
||||
padding: getPadding(top: 19),
|
||||
child: Text("Enter Old Password",
|
||||
child: Text(AppLocalizations.of(context)!.enterOldPassword,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style:
|
||||
@@ -140,16 +142,17 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
controller: oldPasswordController,
|
||||
hintText: "Enter Old Password",
|
||||
hintText:
|
||||
AppLocalizations.of(context)!.enterOldPassword,
|
||||
margin: getMargin(top: 6),
|
||||
errorText:
|
||||
_isPasswordValid1 ? null : 'Please enter your old password',
|
||||
_isPasswordValid1 ? null : AppLocalizations.of(context)!.oldPasswordError,
|
||||
padding: TextFormFieldPadding.PaddingT12,
|
||||
textInputAction: TextInputAction.done,
|
||||
onChanged: _validatePassword1,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your old password';
|
||||
return AppLocalizations.of(context)!.oldPasswordError;
|
||||
}
|
||||
return null; // Return null to indicate no error
|
||||
},
|
||||
@@ -170,7 +173,7 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
|
||||
Padding(
|
||||
padding: getPadding(top: 19),
|
||||
child: Text("Enter New Password",
|
||||
child: Text(AppLocalizations.of(context)!.enterNewPassword,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style:
|
||||
@@ -178,7 +181,8 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
controller: newPasswordController,
|
||||
hintText: "Enter New Password",
|
||||
hintText:
|
||||
AppLocalizations.of(context)!.enterNewPassword,
|
||||
margin: getMargin(top: 6),
|
||||
padding: TextFormFieldPadding.PaddingT12,
|
||||
textInputAction: TextInputAction.done,
|
||||
@@ -193,11 +197,11 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
},
|
||||
),
|
||||
errorText:
|
||||
_isPasswordValid2 ? null : 'Please enter your new password',
|
||||
_isPasswordValid2 ? null : AppLocalizations.of(context)!.newPasswordError,
|
||||
onChanged: _validatePassword2,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your new password';
|
||||
return AppLocalizations.of(context)!.newPasswordError;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -207,7 +211,8 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
|
||||
Padding(
|
||||
padding: getPadding(top: 19),
|
||||
child: Text("Re-Enter New Password",
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.reEnterNewPassword,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style:
|
||||
@@ -215,16 +220,17 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
controller: reEnterNewPasswordController,
|
||||
hintText: "Re-Enter New Password",
|
||||
hintText:
|
||||
AppLocalizations.of(context)!.reEnterNewPassword,
|
||||
margin: getMargin(top: 6),
|
||||
padding: TextFormFieldPadding.PaddingT12,
|
||||
onChanged: _validatePassword3,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please re-enter your new password';
|
||||
return AppLocalizations.of(context)!.reEnterPasswordError;
|
||||
}
|
||||
if (value != newPasswordController.text) {
|
||||
return 'Passwords do not match';
|
||||
return AppLocalizations.of(context)!.passwordsDontMatch;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -241,7 +247,7 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
},
|
||||
),
|
||||
errorText:
|
||||
_isPasswordValid3 ? null : 'Please re-enter your new password',
|
||||
_isPasswordValid3 ? null : AppLocalizations.of(context)!.reEnterPasswordError,
|
||||
textInputAction: TextInputAction.done,
|
||||
suffixConstraints: BoxConstraints(
|
||||
maxHeight: getVerticalSize(44)),
|
||||
@@ -249,7 +255,7 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
|
||||
CustomButton(
|
||||
height: getVerticalSize(50),
|
||||
text: "Continue",
|
||||
text: AppLocalizations.of(context)!.continueBtn,
|
||||
margin: getMargin(top: 24, bottom: 5),
|
||||
onTap: () async {
|
||||
if (oldPasswordController.text.isEmpty ||
|
||||
@@ -283,7 +289,8 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
setState(() {
|
||||
isVisible=true;
|
||||
issuccess=true;
|
||||
responseMessage = "Password Changes Successfully";
|
||||
responseMessage = AppLocalizations.of(context)!
|
||||
.passwordChangedSuccess;
|
||||
});
|
||||
print("success");
|
||||
Navigator.pushAndRemoveUntil(
|
||||
@@ -294,7 +301,8 @@ class _ResetPasswordFormState extends State<ResetPasswordForm> {
|
||||
} else {
|
||||
setState(() {
|
||||
isVisible=true;
|
||||
responseMessage = "Incorrect Password";
|
||||
responseMessage = AppLocalizations.of(context)!
|
||||
.incorrectPassword;
|
||||
});
|
||||
print(response.statusCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user