adding i18n to all other pages
This commit is contained in:
@@ -152,11 +152,12 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text('Please select an image.'),
|
||||
title: Text(AppLocalizations.of(context)!.error),
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.selectImage),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('OK'),
|
||||
child: Text(AppLocalizations.of(context)!.ok),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@@ -180,7 +181,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
await fetchProfileImageData();
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Profile image updated')),
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.profileImageUpdated)),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -188,11 +191,12 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text('Failed to upload image: $e'),
|
||||
title: Text(AppLocalizations.of(context)!.error),
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.failedUploadImage(e.toString())),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('OK'),
|
||||
child: Text(AppLocalizations.of(context)!.ok),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@@ -212,7 +216,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
if (rawUserId == null) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('User id missing, please re-login')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.userIdMissing)),
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -241,7 +247,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
print("success");
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Profile updated')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.profileUpdated)),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
@@ -251,15 +259,18 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Failed to update profile: ${response.statusCode}')),
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.failedUpdateProfile(
|
||||
response.statusCode.toString()))),
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to update: $e')),
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.failedUpdate(e.toString()))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -301,7 +312,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
centerTitle: true,
|
||||
title: AppbarTitle(text: "My Profile Settings")),
|
||||
title: AppbarTitle(
|
||||
text:
|
||||
AppLocalizations.of(context)!.myProfileSettings)),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
@@ -323,7 +336,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
SizedBox(height: 10),
|
||||
CustomButton(
|
||||
height: getVerticalSize(50),
|
||||
text: "Pick a Profile Photo",
|
||||
text: AppLocalizations.of(context)!
|
||||
.pickProfilePhoto,
|
||||
margin: getMargin(top: 24, bottom: 5),
|
||||
onTap: () async {
|
||||
// Pick + auto-upload, same as authsec_flutter_new
|
||||
@@ -345,7 +359,7 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
SizedBox(height: 20),
|
||||
// Section: Profile Form
|
||||
Text(
|
||||
'Your Profile Information',
|
||||
AppLocalizations.of(context)!.yourProfileInfo,
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
@@ -359,17 +373,21 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Your Full Name",
|
||||
Text(
|
||||
AppLocalizations.of(context)!
|
||||
.yourFullName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
controller: fullNameController,
|
||||
hintText: "Enter Full Name",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterFullName,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your full name';
|
||||
return AppLocalizations.of(context)!
|
||||
.enterFullNameError;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -381,13 +399,14 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Pronouns",
|
||||
Text(AppLocalizations.of(context)!.pronouns,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Pronouns",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterPronouns,
|
||||
controller: pronounsController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
@@ -397,13 +416,14 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Role",
|
||||
Text(AppLocalizations.of(context)!.role,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Role",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterRole,
|
||||
controller: roleController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
@@ -413,13 +433,16 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Department or Team",
|
||||
Text(
|
||||
AppLocalizations.of(context)!
|
||||
.departmentOrTeam,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Department or Team",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterDepartmentOrTeam,
|
||||
controller: departmentController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
@@ -429,17 +452,19 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Email",
|
||||
Text(AppLocalizations.of(context)!.email,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Email",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterEmail,
|
||||
controller: emailController,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty || !value!.contains('@')) {
|
||||
return 'Please enter a valid email address';
|
||||
return AppLocalizations.of(context)!
|
||||
.validEmailError;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -451,20 +476,21 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("About Me",
|
||||
Text(AppLocalizations.of(context)!.aboutMe,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "About Me",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.aboutMe,
|
||||
controller: aboutMeController,
|
||||
maxLines: 3,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
CustomButton(
|
||||
height: getVerticalSize(50),
|
||||
text: "Update Profile",
|
||||
text: AppLocalizations.of(context)!.updateProfile,
|
||||
margin: getMargin(top: 24, bottom: 5),
|
||||
onTap: _updateProfile,
|
||||
),
|
||||
@@ -489,8 +515,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
text: TextSpan(
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text:
|
||||
"Password:Change Password for your account Change password",
|
||||
text: AppLocalizations.of(context)!
|
||||
.profilePasswordRow,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.blue,
|
||||
@@ -509,8 +535,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
text: TextSpan(
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text:
|
||||
'Security:Logout of all sessions except this current browser Logout other sessions',
|
||||
text: AppLocalizations.of(context)!
|
||||
.profileSecurityRow,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.blue,
|
||||
@@ -529,8 +555,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
|
||||
text: TextSpan(
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text:
|
||||
'Deactivation:Remove access to all organizations and workspace in cloudnsure Deactivate account',
|
||||
text: AppLocalizations.of(context)!
|
||||
.profileDeactivationRow,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.blue,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../Utils/image_constant.dart';
|
||||
import '../../Utils/size_utils.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../theme/app_style.dart';
|
||||
import '../../widgets/app_bar/appbar_image.dart';
|
||||
import '../../widgets/app_bar/appbar_title.dart';
|
||||
@@ -23,18 +24,19 @@ class AboutScreen extends StatelessWidget {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
centerTitle: true,
|
||||
title: AppbarTitle(text: "About Us")),
|
||||
title: AppbarTitle(
|
||||
text: AppLocalizations.of(context)!.aboutUs)),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'About Us',
|
||||
AppLocalizations.of(context)!.aboutUs,
|
||||
style: AppStyle.txtGilroyBold18Bluegray900,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'Create a new project if you have access, if you don\'t have access, then contact the admin.',
|
||||
AppLocalizations.of(context)!.aboutDescription,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.txtGilroyBold16BlueA700,
|
||||
),
|
||||
|
||||
@@ -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