adding i18n to all other pages

This commit is contained in:
Azmat-7860
2026-10-03 11:22:48 +05:30
parent 47656678e1
commit 3fbeb606a8
22 changed files with 2526 additions and 249 deletions
+51 -27
View File
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../Utils/size_utils.dart';
import '../../l10n/app_localizations.dart';
import '../../theme/app_style.dart';
import '../../widgets/custom_button.dart';
import '../../widgets/custom_text_form_field.dart';
@@ -42,7 +43,8 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
_context = context; // Store the context
return Scaffold(
appBar: AppBar(title: const Text('Create Account')),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.createAccount)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
@@ -52,7 +54,8 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
children: [
Padding(
padding: getPadding(top: 19),
child: Text("Company Name",
child: Text(
AppLocalizations.of(context)!.companyName,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -62,18 +65,20 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['companyName'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Company Name';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.companyName);
}
return null;
},
hintText: "enter Company Name",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.companyName),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("Email",
child: Text(AppLocalizations.of(context)!.email,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -84,20 +89,23 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onChanged: _validateEmail,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Email';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.email);
}else if(!_isEmailValid){
return 'Please enter a valid email';
return AppLocalizations.of(context)!.validEmailShort;
}
return null;
},
hintText: "enter Email",
hintText: AppLocalizations.of(context)!
.enterThis(AppLocalizations.of(context)!.email),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("Mobile Number",
child: Text(
AppLocalizations.of(context)!.mobileNumber,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -111,17 +119,19 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['mobile'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Mob No';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.mobileNumber);
}
return null;
},
hintText: "enter Mobile Number",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.mobileNumber),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
),
Padding(
padding: getPadding(top: 19),
child: Text("Workspace",
child: Text(AppLocalizations.of(context)!.workspace,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -131,18 +141,20 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['workspace'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Workspace';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.workspace);
}
return null;
},
hintText: "enter Workspace",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.workspace),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("Gst Number",
child: Text(AppLocalizations.of(context)!.gstNumber,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -152,18 +164,20 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['gstNumber'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Gst Number';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.gstNumber);
}
return null;
},
hintText: "enter Gst Number",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.gstNumber),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("pancard",
child: Text(AppLocalizations.of(context)!.pancard,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -173,18 +187,21 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['pancard'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Pancard';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.pancard);
}
return null;
},
hintText: "enter pancard",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.pancard),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("Working",
child: Text(
AppLocalizations.of(context)!.workingField,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -194,11 +211,13 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
onsaved: (value) => formData['working'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Working';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.workingField);
}
return null;
},
hintText: "enter Working",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.workingField),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
@@ -208,7 +227,7 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
child: CustomButton(
height: getVerticalSize(50),
width: getHorizontalSize(396),
text: "SUBMIT",
text: AppLocalizations.of(context)!.submitCaps,
margin: getMargin(top: 25),
onTap: () async {
if (_formKey.currentState!.validate()) {
@@ -234,11 +253,16 @@ class _CreateAccountScreenState extends State<CreateAccountScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Error'),
content: Text('Account Creation Failed: $e'),
title: Text(AppLocalizations.of(context)!
.error),
content: Text(
AppLocalizations.of(context)!
.accountCreationFailed(
e.toString())),
actions: [
TextButton(
child: const Text('OK'),
child: Text(
AppLocalizations.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},