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
+54 -30
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../../l10n/app_localizations.dart';
import 'SignUpService.dart';
class CreateUserScreen extends StatefulWidget {
@@ -26,7 +27,8 @@ class _CreateUserScreenState extends State<CreateUserScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Sign Up - Step ${_currentStep + 1}'),
title: Text(AppLocalizations.of(context)!
.signUpStep((_currentStep + 1).toString())),
),
body: Column(
children: [
@@ -46,14 +48,14 @@ class _CreateUserScreenState extends State<CreateUserScreen> {
_currentStep--;
});
},
child: const Text('Previous'),
child: Text(AppLocalizations.of(context)!.previous),
),
if (_currentStep < 2)
ElevatedButton(
onPressed: () {
_proceedToNextStep();
},
child: const Text('Next'),
child: Text(AppLocalizations.of(context)!.next),
),
],
),
@@ -125,79 +127,95 @@ class StepCreateAccountState extends State<StepCreateAccount> {
alignment: Alignment.center,
child: Column(
children: [
const Text('Step 1: Create Account'),
Text(AppLocalizations.of(context)!.step1CreateAccount),
TextFormField(
decoration: const InputDecoration(labelText: 'Company Name'),
decoration: InputDecoration(
labelText:
AppLocalizations.of(context)!.companyName),
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;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'Email'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.email),
onSaved: (value) => formData['email'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Email';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.email);
}
return null;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'Mobile No'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.mobileNo),
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)!.mobileNo);
}
return null;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'Workspace'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.workspace),
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;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'Gst Number'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.gstNumber),
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;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'pancard'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.pancard),
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;
},
),
const SizedBox(height: 16),
TextFormField(
decoration: const InputDecoration(labelText: 'Working'),
decoration: InputDecoration(
labelText:
AppLocalizations.of(context)!.workingField),
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;
},
@@ -228,12 +246,15 @@ class StepCreateAccountState extends State<StepCreateAccount> {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Error'),
content: Text('Account Creation Failed: $e'),
return AlertDialog(
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();
},
@@ -246,12 +267,12 @@ class StepCreateAccountState extends State<StepCreateAccount> {
}
}
},
child: const SizedBox(
child: SizedBox(
width: double.infinity,
height: 50,
child: Center(
child: Text(
'SUBMIT',
AppLocalizations.of(context)!.submitCaps,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
@@ -261,7 +282,9 @@ class StepCreateAccountState extends State<StepCreateAccount> {
),
),
),
if (accountId != null) Text('Selected Account ID: $accountId'),
if (accountId != null)
Text(AppLocalizations.of(context)!
.selectedAccountId(accountId!)),
],
),
);
@@ -284,7 +307,7 @@ class StepGetEmailVerificationState extends State<StepGetEmailVerification> {
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
child: Text('Step 2: Get Email Verification'),
child: Text(AppLocalizations.of(context)!.step2EmailVerification),
);
}
}
@@ -303,7 +326,7 @@ class StepGetRegistrationState extends State<StepGetRegistration> {
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
child: Text('Step 3: Get Registration'),
child: Text(AppLocalizations.of(context)!.step3GetRegistration),
);
}
}
@@ -313,14 +336,15 @@ class CreateAccountDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text('Create Account'),
content: Text('Account created successfully!'),
title: Text(AppLocalizations.of(context)!.createAccount),
content:
Text(AppLocalizations.of(context)!.accountCreatedSuccess),
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop('12345'); // Pass the created account ID
},
child: Text('OK'),
child: Text(AppLocalizations.of(context)!.ok),
),
],
);