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
@@ -5,6 +5,7 @@ import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:geolocator/geolocator.dart';
import 'package:permission_handler/permission_handler.dart' as ph;
import '../../l10n/app_localizations.dart';
import 'attendance_math.dart';
import 'attendance_storage.dart';
@@ -261,18 +262,17 @@ class AttendanceService {
final bool? go = await showDialog<bool>(
context: context,
builder: (c) => AlertDialog(
title: const Text('Keep tracking running'),
content: const Text(
'Xiaomi, Oppo, Vivo and Samsung phones stop background tracking '
'to save battery. Allow "Unrestricted" battery use for this app '
'so duty tracking keeps working when the screen is off?'),
title: Text(AppLocalizations.of(context)!.keepTracking),
content: Text(
AppLocalizations.of(context)!.batteryExemptBody),
actions: [
TextButton(
onPressed: () => Navigator.of(c).pop(false),
child: const Text('Later')),
child: Text(AppLocalizations.of(context)!.laterBtn)),
TextButton(
onPressed: () => Navigator.of(c).pop(true),
child: const Text('Open settings')),
child: Text(
AppLocalizations.of(context)!.openSettings)),
],
),
);
+33 -21
View File
@@ -5,6 +5,7 @@ import 'package:flutter_foreground_task/flutter_foreground_task.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';
@@ -116,9 +117,9 @@ class _PunchScreenState extends State<PunchScreen> {
await AttendanceService.maybeAskBatteryExemption(context);
}
await _refresh();
_msg('Punched in - tracking every 5 min', false);
_msg(AppLocalizations.of(context)!.punchedInTracking, false);
} catch (e) {
_msg('Punch in failed: $e', true);
_msg(AppLocalizations.of(context)!.punchInFailed(e.toString()), true);
} finally {
if (mounted) setState(() => _busy = false);
}
@@ -135,22 +136,21 @@ class _PunchScreenState extends State<PunchScreen> {
showDialog(
context: context,
builder: (c) => AlertDialog(
title: const Text('Duty summary'),
title: Text(AppLocalizations.of(context)!.dutySummary),
content: Text(
'Points recorded: $pts\n'
'Distance (straight line): ${km.toStringAsFixed(2)} km\n'
'Road distance: coming in step 4 (free API).',
AppLocalizations.of(context)!.dutySummaryBody(
pts.toString(), km.toStringAsFixed(2)),
),
actions: [
TextButton(
onPressed: () => Navigator.of(c).pop(),
child: const Text('OK'),
child: Text(AppLocalizations.of(context)!.ok),
),
],
),
);
} catch (e) {
_msg('Punch out failed: $e', true);
_msg(AppLocalizations.of(context)!.punchOutFailed(e.toString()), true);
} finally {
if (mounted) setState(() => _busy = false);
}
@@ -180,7 +180,8 @@ class _PunchScreenState extends State<PunchScreen> {
onTap: () => Navigator.pop(context),
),
centerTitle: true,
title: AppbarTitle(text: 'Duty Punch'),
title: AppbarTitle(
text: AppLocalizations.of(context)!.dutyPunch),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
@@ -192,22 +193,22 @@ class _PunchScreenState extends State<PunchScreen> {
CustomButton(
height: getVerticalSize(50),
text: _busy
? 'Please wait...'
: (_punchedIn ? 'Punch Out' : 'Punch In'),
? AppLocalizations.of(context)!.pleaseWait
: (_punchedIn
? AppLocalizations.of(context)!.punchOut
: AppLocalizations.of(context)!.punchIn),
margin: getMargin(top: 8, bottom: 5),
onTap: _busy ? () {} : (_punchedIn ? _onPunchOut : _onPunchIn),
),
const SizedBox(height: 8),
Text(
'Keeps recording one location every 5 min, even with the app '
'minimized. For Xiaomi/Oppo/Vivo/Samsung allow Unrestricted '
'battery use or tracking may pause.',
AppLocalizations.of(context)!.batteryNote,
style: AppStyle.txtGilroyMedium16Bluegray900.copyWith(
fontSize: 12,
),
),
const SizedBox(height: 20),
Text('Recent duties',
Text(AppLocalizations.of(context)!.recentDuties,
style: AppStyle.txtGilroyMedium16Bluegray900.copyWith(
fontWeight: FontWeight.bold,
)),
@@ -238,20 +239,29 @@ class _PunchScreenState extends State<PunchScreen> {
),
const SizedBox(width: 8),
Text(
_punchedIn ? 'Punched IN' : 'Punched OUT',
_punchedIn
? AppLocalizations.of(context)!.punchedIn
: AppLocalizations.of(context)!.punchedOut,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
],
),
const SizedBox(height: 12),
Text('Session: ${_sessionId ?? '-'}'),
if (_punchInTime != null) Text('Since: $_punchInTime'),
Text(AppLocalizations.of(context)!
.sessionRow(_sessionId ?? '-')),
if (_punchInTime != null)
Text(AppLocalizations.of(context)!
.sinceRow(_punchInTime!)),
const SizedBox(height: 8),
Text('Points: $_points',
Text(
AppLocalizations.of(context)!
.pointsRow(_points.toString()),
style:
const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
Text('Distance: ${_km.toStringAsFixed(2)} km',
Text(
AppLocalizations.of(context)!
.distanceRow(_km.toStringAsFixed(2)),
style:
const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
],
@@ -268,7 +278,9 @@ class _PunchScreenState extends State<PunchScreen> {
title: Text('${s['punch_in']}',
style: const TextStyle(fontSize: 12)),
subtitle: Text(
'Out: ${s['punch_out'] ?? '-'} • ${km.toStringAsFixed(2)} km',
AppLocalizations.of(context)!.historyOutRow(
(s['punch_out'] ?? '-').toString(),
km.toStringAsFixed(2)),
style: const TextStyle(fontSize: 11)),
trailing: Text(status,
style: TextStyle(
@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
// OLD: import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; // removed no namespace AGP8 - by Azmat
import 'package:mobile_scanner/mobile_scanner.dart'; // migrated for AGP8 Java17 - by Azmat
import '../../../l10n/app_localizations.dart';
class BarcodeScreen extends StatefulWidget {
const BarcodeScreen({super.key});
@@ -22,7 +24,8 @@ class _BarcodeScreenState extends State<BarcodeScreen> {
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: const Text('Scan Barcode')),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.scanBarcode)),
body: MobileScanner(
controller: barCodeController,
onDetect: (capture) => Navigator.pop(
@@ -47,7 +50,8 @@ class _BarcodeScreenState extends State<BarcodeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('BAR CODE')),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.barCode)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
@@ -56,8 +60,8 @@ class _BarcodeScreenState extends State<BarcodeScreen> {
child: Center(
child: Column(
children: [
const Text(
'Scanned Barcode:',
Text(
AppLocalizations.of(context)!.scannedBarcode,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
@@ -71,7 +75,8 @@ class _BarcodeScreenState extends State<BarcodeScreen> {
scanBarcode(); // Trigger barcode scanning
},
icon: const Icon(Icons.camera_alt), // Camera icon
label: const Text('Scan Barcode'),
label: Text(
AppLocalizations.of(context)!.scanBarcode),
),
const SizedBox(height: 16),
],
@@ -7,6 +7,7 @@ import 'package:barcode_widget/barcode_widget.dart';
import '../Barcode/Barcode_create_entity_screen.dart';
import '../Qrcode/Qrcode_create_entity_screen.dart';
import '../../../l10n/app_localizations.dart';
class QrBarCodeScreen extends StatefulWidget {
const QrBarCodeScreen({super.key});
@@ -26,7 +27,7 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Generated QR Code'),
title: Text(AppLocalizations.of(context)!.generatedQrCode),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
@@ -45,7 +46,7 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: const Text('Close'),
child: Text(AppLocalizations.of(context)!.close),
),
],
),
@@ -62,7 +63,8 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Generated Bar Code'),
title: Text(
AppLocalizations.of(context)!.generatedBarCode),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
@@ -87,7 +89,7 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: const Text('Close'),
child: Text(AppLocalizations.of(context)!.close),
),
],
),
@@ -104,7 +106,9 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('QR AND BAR CODE')),
appBar: AppBar(
title:
Text(AppLocalizations.of(context)!.qrAndBarCode)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
@@ -115,27 +119,34 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
// GENERATE QR CODE
TextFormField(
controller: qr_code_dataController,
decoration: const InputDecoration(labelText: 'qr_code_data'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!
.qrCodeData),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
_showqr_code_dataDialog();
},
child: const Text('Generate Qr')),
child: Text(AppLocalizations.of(context)!
.generateQr)),
// GENERATE BAR CODE
TextFormField(
controller: bar_code_dataController,
decoration: const InputDecoration(labelText: 'Bar Code Data'),
decoration: InputDecoration(
labelText: AppLocalizations.of(context)!
.barCodeData),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
_show_bar_code_dataDialog(bar_code_dataController.text);
},
child: const Text('Generate Bar code'),
child: Text(AppLocalizations.of(context)!
.generateBarCode),
),
// QR CODE SCANNER
const SizedBox(height: 16),
@@ -146,7 +157,8 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
MaterialPageRoute(
builder: (context) => const qrcodeScreen()));
},
child: const Text('QR Code Scanner'),
child: Text(AppLocalizations.of(context)!
.qrCodeScanner),
),
// BAR CODE SCANNER
@@ -158,7 +170,8 @@ class _QrBarCodeScreenState extends State<QrBarCodeScreen> {
MaterialPageRoute(
builder: (context) => const BarcodeScreen()));
},
child: const Text('Bar Code Scanner'),
child: Text(AppLocalizations.of(context)!
.barCodeScanner),
),
],
),
@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
// OLD: import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; // removed no namespace AGP8 - by Azmat
import 'package:mobile_scanner/mobile_scanner.dart'; // migrated for AGP8 Java17 - by Azmat
import '../../../l10n/app_localizations.dart';
class qrcodeScreen extends StatefulWidget {
const qrcodeScreen({super.key});
@@ -22,7 +24,8 @@ class _qrcodeScreenState extends State<qrcodeScreen> {
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: const Text('Scan QR')),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.scanQR)),
body: MobileScanner(
controller: qrCodeController,
onDetect: (capture) => Navigator.pop(
@@ -47,7 +50,8 @@ class _qrcodeScreenState extends State<qrcodeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('QR Code')),
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.qrCode)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
@@ -56,8 +60,8 @@ class _qrcodeScreenState extends State<qrcodeScreen> {
child: Center(
child: Column(
children: [
const Text(
'Scanned QRcode:',
Text(
AppLocalizations.of(context)!.scannedQRCode,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
@@ -71,7 +75,8 @@ class _qrcodeScreenState extends State<qrcodeScreen> {
scanQRcode(); // Trigger barcode scanning
},
icon: const Icon(Icons.camera_alt), // Camera icon
label: const Text('Scan QRcode'),
label: Text(
AppLocalizations.of(context)!.scanQRCode),
),
const SizedBox(height: 16),
],
@@ -20,6 +20,7 @@ import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import '../../Utils/color_constants.dart';
import '../../Utils/size_utils.dart';
import '../../l10n/app_localizations.dart';
import '../../providers/tab_navigation_provider.dart';
import '../../providers/token_manager.dart';
import '../../resources/api_constants.dart';
@@ -400,7 +401,7 @@ class _TabbedLayoutComponentState extends State<TabbedLayoutComponent> {
extendBodyBehindAppBar: true,
//bottomNavigationBar: AppFooter(),
body: screens.isEmpty
? const Text("Loading...")
? Text(AppLocalizations.of(context)!.loading)
: ListView.builder(
itemCount: screens.length,
scrollDirection: Axis.vertical,
@@ -453,7 +454,7 @@ class _TabbedLayoutComponentState extends State<TabbedLayoutComponent> {
GButton(
icon: FluentIcons.home_32_regular,
iconSize: 36,
text: 'Home',
text: AppLocalizations.of(context)!.navHome,
onPressed: () {
print('home');
},
@@ -461,7 +462,7 @@ class _TabbedLayoutComponentState extends State<TabbedLayoutComponent> {
GButton(
icon: FluentIcons.people_32_regular,
iconSize: 36,
text: 'Contacts',
text: AppLocalizations.of(context)!.navContacts,
onPressed: () {
print('contacts');
// Navigator.push(
@@ -476,7 +477,7 @@ class _TabbedLayoutComponentState extends State<TabbedLayoutComponent> {
),
GButton(
icon: Icons.wallet,
text: 'Wallet',
text: AppLocalizations.of(context)!.navWallet,
iconSize: 34,
onPressed: () {
print('wallet');
@@ -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,
+5 -3
View File
@@ -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);
}
+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();
},
+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),
),
],
);
@@ -4,6 +4,7 @@ import 'package:flutter/services.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';
@@ -126,7 +127,8 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
Navigator.pop(context);
}),
centerTitle: true,
title: AppbarTitle(text: "Registration")),
title: AppbarTitle(
text: AppLocalizations.of(context)!.registration)),
//AppBar(title: const Text('Registration')),
body: SingleChildScrollView(
child: Padding(
@@ -138,7 +140,8 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
children: [
Padding(
padding: getPadding(top: 19),
child: Text("First Name",
child: Text(
AppLocalizations.of(context)!.firstName,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -148,18 +151,20 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
onsaved: (value) => formData['first_name'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter First Name';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.firstName);
}
return null;
},
hintText: "enter First Name",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.firstName),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
),
Padding(
padding: getPadding(top: 19),
child: Text("Last Name",
child: Text(AppLocalizations.of(context)!.lastName,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -169,11 +174,13 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
onsaved: (value) => formData['last_name'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Last Name';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.lastName);
}
return null;
},
hintText: "enter Last Name",
hintText: AppLocalizations.of(context)!.enterThis(
AppLocalizations.of(context)!.lastName),
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputType: TextInputType.text
@@ -181,7 +188,8 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
Padding(
padding: getPadding(top: 19),
child: Text("Mobile Number",
child: Text(
AppLocalizations.of(context)!.mobileNumber,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
@@ -195,33 +203,38 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
onsaved: (value) => formData['mob_no'] = value,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Mobile Number';
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("New Password",
child: Text(AppLocalizations.of(context)!.newPassword,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroyMedium16Bluegray900)),
CustomTextFormField(
focusNode: _newPasswordNode,
hintText: "New Password",
hintText:
AppLocalizations.of(context)!.newPassword,
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputAction: TextInputAction.done,
textInputType:TextInputType.visiblePassword,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Password';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.password);
}else if(!_isPasswordValid){
return 'Please enter a valid password';
return AppLocalizations.of(context)!
.validPasswordShort;
}
return null;
},
@@ -248,21 +261,24 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
Padding(
padding: getPadding(top: 19),
child: Text("Confirm Password",
child: Text(
AppLocalizations.of(context)!.confirmPassword,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroyMedium16Bluegray900)),
CustomTextFormField(
focusNode: _confirmPasswordNode,
hintText: "Confirm Password",
hintText: AppLocalizations.of(context)!
.confirmPassword,
margin: getMargin(top: 6),
padding: TextFormFieldPadding.PaddingT12,
textInputAction: TextInputAction.done,
textInputType:TextInputType.visiblePassword,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Password';
return AppLocalizations.of(context)!.pleaseEnterThis(
AppLocalizations.of(context)!.password);
}
return _validatePasswordMatch(value);
},
@@ -289,8 +305,9 @@ class _RegistrationDetailsScreenState extends State<RegistrationDetailsScreen> {
Row(
children: [
const Expanded(
child: Text('Add Account'),
Expanded(
child: Text(
AppLocalizations.of(context)!.addAccount),
),
IconButton(
onPressed: () async {
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import '../../l10n/app_localizations.dart';
class StepGetEmailVerification extends StatefulWidget {
final LabeledGlobalKey<FormState> emailPasswordFormKey;
// final Function updateSignUpDetails;
@@ -67,7 +69,7 @@ class _StepGetEmailVerificationState extends State<StepGetEmailVerification> {
// validator: _validateNewPassword,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -76,7 +78,7 @@ class _StepGetEmailVerificationState extends State<StepGetEmailVerification> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "email",
hintText: AppLocalizations.of(context)!.email,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import '../../l10n/app_localizations.dart';
class StepGetRegistration extends StatefulWidget {
final LabeledGlobalKey<FormState> bankAccountFormKey;
// final Function updateSignUpDetails;
@@ -94,7 +96,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
widget.finalStepProccessing();
}
},
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -103,7 +105,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "first name",
hintText: AppLocalizations.of(context)!.firstName,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
@@ -153,7 +155,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
widget.finalStepProccessing();
}
},
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -162,7 +164,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "last name",
hintText: AppLocalizations.of(context)!.lastName,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
@@ -212,7 +214,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
widget.finalStepProccessing();
}
},
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -221,7 +223,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "mob no",
hintText: AppLocalizations.of(context)!.mobileNumber,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
@@ -270,7 +272,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
widget.finalStepProccessing();
}
},
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -279,7 +281,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "password",
hintText: AppLocalizations.of(context)!.password,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
@@ -329,7 +331,7 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
widget.finalStepProccessing();
}
},
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -338,7 +340,8 @@ class _StepGetRegistrationState extends State<StepGetRegistration> {
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "confirmPassword",
hintText:
AppLocalizations.of(context)!.confirmPassword,
hintStyle: TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
style: const TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
+41 -21
View File
@@ -6,6 +6,7 @@ import 'package:pinput/pinput.dart';
import '../../Utils/color_constants.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';
@@ -101,7 +102,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
Navigator.pop(context);
}),
centerTitle: true,
title: AppbarTitle(text: "Create User")),
title: AppbarTitle(
text: AppLocalizations.of(context)!.createUser)),
body: Builder(
builder: (BuildContext context) {
return SingleChildScrollView(
@@ -120,7 +122,7 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Email",
Text(AppLocalizations.of(context)!.email,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
@@ -129,17 +131,21 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
controller: emailcontroller,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter Email';
return AppLocalizations.of(context)!
.pleaseEnterThis(
AppLocalizations.of(context)!
.email);
}
return null;
},
hintText: "Enter Your Email",
hintText: AppLocalizations.of(context)!
.enterYourEmail,
margin: getMargin(top: 7),
textInputType: TextInputType.emailAddress),
CustomButton(
height: getVerticalSize(50),
width: getHorizontalSize(396),
text: "Send OTP",
text: AppLocalizations.of(context)!.sendOtp,
margin: getMargin(top: 25),
onTap: () async {
@@ -158,8 +164,9 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
moveToNextStep();
} catch (e) {
showErrorMessage(
'Failed to send OTP: $e');
showErrorMessage(AppLocalizations.of(
context)!
.failedToSendOtp(e.toString()));
}
}
@@ -226,7 +233,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
top: 29,
),
child: Text(
"Email Verification",
AppLocalizations.of(context)!
.emailVerification,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold24,
@@ -242,7 +250,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
right: 46,
),
child: Text(
"A mail with a 6-digit verification code was just sent to ${emailcontroller.text}",
AppLocalizations.of(context)!.otpSentToEmail(
emailcontroller.text),
maxLines: null,
textAlign: TextAlign.center,
style: AppStyle.txtGilroyMedium16,
@@ -276,7 +285,7 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
height: getVerticalSize(
50,
),
text: "Next",
text: AppLocalizations.of(context)!.next,
margin: getMargin(
top: 40,
),
@@ -287,9 +296,12 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
moveToNextStep();
showSuccessMessage(
'Email verified successfully');
AppLocalizations.of(context)!
.emailVerifiedSuccess);
} catch (e) {
showErrorMessage('Failed to verify OTP: $e');
showErrorMessage(AppLocalizations.of(
context)!
.failedToVerifyOtp(e.toString()));
}
},
),
@@ -300,19 +312,24 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
await Future.delayed(
const Duration(seconds: 5));
showSuccessMessage('OTP RESEND');
showSuccessMessage(AppLocalizations.of(
context)!
.otpResent);
} catch (e) {
showErrorMessage(
'Failed to resend OTP: $e');
showErrorMessage(AppLocalizations.of(
context)!
.failedToResendOtp(e.toString()));
}
},
child: Padding(
padding: getPadding(top: 3),
child: Text("Forgot Password?",
child: Text(
AppLocalizations.of(context)!
.forgotPasswordLink,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroyMedium14BlueA700)),
style: AppStyle
.txtGilroyMedium14BlueA700)),
),
@@ -330,7 +347,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
top: 2,
),
child: Text(
"Didn’t get the code?",
AppLocalizations.of(context)!
.didntGetCode,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
@@ -342,7 +360,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
bottom: 1,
),
child: Text(
"Resend",
AppLocalizations.of(context)!
.resend,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold16BlueA700,
@@ -364,7 +383,8 @@ class _SignUpUserScreenState extends State<SignUpUserScreenNew> {
height: getVerticalSize(
50,
),
text: "Go to Registration Details",
text: AppLocalizations.of(context)!
.goToRegistrationDetails,
margin: getMargin(
top: 40,
),
+22 -13
View File
@@ -3,6 +3,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import '../../hadwin_components.dart';
import '../../l10n/app_localizations.dart';
import '../../utilities/slide_right_route.dart';
import '../Login Screen/login_screen.dart';
import 'StepGetEmailVerification.dart';
@@ -151,12 +152,13 @@ class _SignUpStepsState extends State<SignUpSteps> {
const EdgeInsets.symmetric(vertical: 3.6, horizontal: 10),
child: RichText(
text: TextSpan(
text: 'By signing up you are agreeing to the ',
text: AppLocalizations.of(context)!.termsAgreePrefix,
style: const TextStyle(
fontSize: 14, color: Color(0xFF929BAB)),
children: <InlineSpan>[
TextSpan(
text: 'Terms & Conditions',
text: AppLocalizations.of(context)!
.termsConditions,
style: const TextStyle(
fontSize: 14, color: Colors.blue),
recognizer: TapGestureRecognizer()
@@ -167,19 +169,23 @@ class _SignUpStepsState extends State<SignUpSteps> {
() => Navigator.push(
context,
SlideRightRoute(
page: const HadWinMarkdownViewer(
screenName: "Terms & Conditons",
page: HadWinMarkdownViewer(
screenName:
AppLocalizations.of(context)!
.termsConditions,
urlRequested:
'https://raw.githubusercontent.com/brownboycodes/HADWIN/master/docs/TERMS_AND_CONDITIONS.md',
))));
}),
const TextSpan(
text: ' and our ',
TextSpan(
text:
AppLocalizations.of(context)!.termsAndOur,
style:
TextStyle(fontSize: 14, color: Color(0xFF929BAB)),
),
TextSpan(
text: 'End User License Agreement',
text:
AppLocalizations.of(context)!.eula,
style: const TextStyle(
fontSize: 14, color: Colors.blue),
recognizer: TapGestureRecognizer()
@@ -190,9 +196,10 @@ class _SignUpStepsState extends State<SignUpSteps> {
() => Navigator.push(
context,
SlideRightRoute(
page: const HadWinMarkdownViewer(
page: HadWinMarkdownViewer(
screenName:
"End User License Agreement",
AppLocalizations.of(context)!
.eula,
urlRequested:
'https://raw.githubusercontent.com/brownboycodes/HADWIN/master/docs/END_USER_LICENSE_AGREEMENT.md',
))));
@@ -311,8 +318,9 @@ class _SignUpStepsState extends State<SignUpSteps> {
if (stepHasError[_currentStep] == false && mounted) {
ScaffoldMessenger.of(context)
.showSnackBar(
const SnackBar(
content: Text('Processing'),
SnackBar(
content:
Text(AppLocalizations.of(context)!.processingPlain),
backgroundColor: Colors.blue,
// onVisible: _tryRegistering,
),
@@ -487,8 +495,9 @@ class _SignUpStepsState extends State<SignUpSteps> {
print('Account succesfully created');
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(
content: Text("Account Created Successfully"),
.showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!
.accountCreatedSuccess),
backgroundColor: Colors.green))
.closed
.then((value) => Navigator.of(context).pushAndRemoveUntil(
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import '../../l10n/app_localizations.dart';
class StepCreateAccount extends StatefulWidget {
final LabeledGlobalKey<FormState> nameAddressFormKey;
// final Function updateSignUpDetails;
@@ -99,7 +101,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
validator: _validatecompanyName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -108,7 +110,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "Company_Name",
hintText:
AppLocalizations.of(context)!.companyName,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -155,7 +158,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatelastName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -164,7 +167,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "email",
hintText:
AppLocalizations.of(context)!.email,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -213,7 +217,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatemobno,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -222,7 +226,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "mob_no",
hintText: AppLocalizations.of(context)!
.mobileNumber,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -271,7 +276,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatelastName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -280,7 +285,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "workspace",
hintText:
AppLocalizations.of(context)!.workspace,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -327,7 +333,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatelastName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -336,7 +342,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "gst number",
hintText:
AppLocalizations.of(context)!.gstNumber,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -383,7 +390,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatelastName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -392,7 +399,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "pancard",
hintText:
AppLocalizations.of(context)!.pancard,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),
@@ -439,7 +447,7 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
// validator: _validatelastName,
autofocus: mounted,
autocorrect: false,
decoration: const InputDecoration(
decoration: InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -448,7 +456,8 @@ class _StepCreateAccountState extends State<StepCreateAccount> {
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: 15, bottom: 11, top: 11, right: 15),
hintText: "working",
hintText: AppLocalizations.of(context)!
.workingField,
hintStyle:
TextStyle(fontSize: 16, color: Color(0xFF929BAB)),
),