mobile view full flow
This commit is contained in:
parent
d78c46be9d
commit
20ae302ab8
BIN
assets/mobileViewLogo.png
Normal file
BIN
assets/mobileViewLogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 212 KiB |
BIN
assets/nhance_client_logo.png
Normal file
BIN
assets/nhance_client_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
2822
lib/addons.dart
2822
lib/addons.dart
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:adaptive_navbar/adaptive_navbar.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:nhancepolicy/responsive.dart';
|
||||
|
||||
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(kToolbarHeight);
|
||||
|
||||
Future<void> logout(BuildContext context) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? hrtoken = prefs.getString('hrtoken');
|
||||
final String? token = prefs.getString('token');
|
||||
|
||||
if (token != null && token.isNotEmpty) {
|
||||
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||
prefs.remove('token');
|
||||
Navigator.pushNamed(context, 'hrHome');
|
||||
} else {
|
||||
await prefs.clear();
|
||||
Navigator.pushNamed(context, 'phone');
|
||||
}
|
||||
} else if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||
await prefs.clear();
|
||||
Navigator.pushNamed(context, 'hrLogin');
|
||||
}
|
||||
// Navigator.pushNamed(context, "phone");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sw = MediaQuery.of(context).size.width;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Color(0xFF00989E), // Set background color for AppBar
|
||||
backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar
|
||||
appBar: PreferredSize(
|
||||
preferredSize: preferredSize,
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(horizontal: 16.0)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Logo Column
|
||||
Expanded(
|
||||
flex: 3,
|
||||
flex: Responsive.isDesktop(context) ? 3 : 9,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceEvenly, // Adjust the alignment as needed
|
||||
mainAxisAlignment: Responsive.isDesktop(context)
|
||||
? MainAxisAlignment.spaceEvenly
|
||||
: MainAxisAlignment
|
||||
.start, // Adjust the alignment as needed
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10, bottom: 10),
|
||||
width: 230,
|
||||
height: 230,
|
||||
child: Image.asset(
|
||||
'assets/Group_3.png',
|
||||
'assets/nhance_client_logo.png',
|
||||
fit: BoxFit.contain, // Adjust the fit as needed
|
||||
),
|
||||
),
|
||||
@ -49,26 +77,29 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
// AdaptiveNavBar Column
|
||||
Expanded(
|
||||
flex: 9,
|
||||
flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||
child: AdaptiveNavBar(
|
||||
screenWidth: sw,
|
||||
backgroundColor: Color(0xFF00989E),
|
||||
backgroundColor: Color(0xFFFFFCE5),
|
||||
leading:
|
||||
Container(), // Set an empty container as we have the logo separately
|
||||
title: Text(''),
|
||||
navBarItems: [
|
||||
if (Responsive.isDesktop(context))
|
||||
NavBarItem(
|
||||
text: "",
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, "routeName");
|
||||
},
|
||||
),
|
||||
if (Responsive.isDesktop(context))
|
||||
NavBarItem(
|
||||
text: "",
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, "routeName");
|
||||
},
|
||||
),
|
||||
if (Responsive.isDesktop(context))
|
||||
NavBarItem(
|
||||
text: "",
|
||||
onTap: () {
|
||||
@ -77,8 +108,14 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
NavBarItem(
|
||||
text: "Logout",
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, "phone");
|
||||
onTap: () async {
|
||||
logout(context);
|
||||
// Clear local storage (SharedPreferences)
|
||||
// final prefs = await SharedPreferences.getInstance();
|
||||
// prefs.clear();
|
||||
// ToastHelper.showSuccessToast(
|
||||
// context, 'Logout Successfully...');
|
||||
// Navigator.pushNamed(context, "phone");
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,17 +1,212 @@
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:toastification/toastification.dart';
|
||||
|
||||
class ToastHelper {
|
||||
static void showSuccessToast(BuildContext context, String message) {
|
||||
_showToast(context, message, Colors.green);
|
||||
toastification.show(
|
||||
context: context,
|
||||
type: ToastificationType.success,
|
||||
style: ToastificationStyle.flatColored,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
title: Text(message),
|
||||
// you can also use RichText widget for title and description parameters
|
||||
// description: RichText(
|
||||
// text: const TextSpan(text: 'This is a sample toast message. ')),
|
||||
alignment: Alignment.topRight,
|
||||
direction: TextDirection.ltr,
|
||||
animationDuration: const Duration(milliseconds: 100),
|
||||
animationBuilder: (context, animation, alignment, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.check),
|
||||
primaryColor: Colors.green,
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 16),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
showProgressBar: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
closeOnClick: false,
|
||||
pauseOnHover: true,
|
||||
dragToClose: true,
|
||||
applyBlurEffect: true,
|
||||
callbacks: ToastificationCallbacks(
|
||||
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
|
||||
onCloseButtonTap: (toastItem) =>
|
||||
print('Toast ${toastItem.id} close button tapped'),
|
||||
onAutoCompleteCompleted: (toastItem) =>
|
||||
print('Toast ${toastItem.id} auto complete completed'),
|
||||
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static void showWarningToast(BuildContext context, String message) {
|
||||
_showToast(context, message, Colors.orange);
|
||||
toastification.show(
|
||||
context: context,
|
||||
type: ToastificationType.warning,
|
||||
style: ToastificationStyle.flatColored,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
title: Text(message),
|
||||
// you can also use RichText widget for title and description parameters
|
||||
// description: RichText(
|
||||
// text: const TextSpan(text: 'This is a sample toast message. ')),
|
||||
alignment: Alignment.topRight,
|
||||
direction: TextDirection.ltr,
|
||||
animationDuration: const Duration(milliseconds: 100),
|
||||
animationBuilder: (context, animation, alignment, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.warning),
|
||||
primaryColor: Colors.amberAccent,
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 16),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
showProgressBar: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
closeOnClick: false,
|
||||
pauseOnHover: true,
|
||||
dragToClose: true,
|
||||
applyBlurEffect: true,
|
||||
callbacks: ToastificationCallbacks(
|
||||
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
|
||||
onCloseButtonTap: (toastItem) =>
|
||||
print('Toast ${toastItem.id} close button tapped'),
|
||||
onAutoCompleteCompleted: (toastItem) =>
|
||||
print('Toast ${toastItem.id} auto complete completed'),
|
||||
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static void showErrorToast(BuildContext context, String message) {
|
||||
_showToast(context, message, Colors.red);
|
||||
toastification.show(
|
||||
context: context,
|
||||
type: ToastificationType.error,
|
||||
style: ToastificationStyle.flatColored,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
title: Text(message),
|
||||
// you can also use RichText widget for title and description parameters
|
||||
// description: RichText(
|
||||
// text: const TextSpan(text: 'This is a sample toast message. ')),
|
||||
alignment: Alignment.topRight,
|
||||
direction: TextDirection.ltr,
|
||||
animationDuration: const Duration(milliseconds: 100),
|
||||
animationBuilder: (context, animation, alignment, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.error),
|
||||
primaryColor: Colors.redAccent,
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 16),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
showProgressBar: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
closeOnClick: false,
|
||||
pauseOnHover: true,
|
||||
dragToClose: true,
|
||||
applyBlurEffect: true,
|
||||
callbacks: ToastificationCallbacks(
|
||||
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
|
||||
onCloseButtonTap: (toastItem) =>
|
||||
print('Toast ${toastItem.id} close button tapped'),
|
||||
onAutoCompleteCompleted: (toastItem) =>
|
||||
print('Toast ${toastItem.id} auto complete completed'),
|
||||
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
|
||||
),
|
||||
);
|
||||
// _showToast(context, message, Colors.red);
|
||||
}
|
||||
|
||||
static void showInfoToast(BuildContext context, String message) {
|
||||
toastification.show(
|
||||
context: context,
|
||||
type: ToastificationType.info,
|
||||
style: ToastificationStyle.flatColored,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
title: Text(message),
|
||||
// you can also use RichText widget for title and description parameters
|
||||
// description: RichText(
|
||||
// text: const TextSpan(text: 'This is a sample toast message. ')),
|
||||
alignment: Alignment.topRight,
|
||||
direction: TextDirection.ltr,
|
||||
animationDuration: const Duration(milliseconds: 100),
|
||||
animationBuilder: (context, animation, alignment, child) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.info),
|
||||
primaryColor: Colors.lightBlue,
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 16),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
showProgressBar: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
closeOnClick: false,
|
||||
pauseOnHover: true,
|
||||
dragToClose: true,
|
||||
applyBlurEffect: true,
|
||||
callbacks: ToastificationCallbacks(
|
||||
onTap: (toastItem) => print('Toast ${toastItem.id} tapped'),
|
||||
onCloseButtonTap: (toastItem) =>
|
||||
print('Toast ${toastItem.id} close button tapped'),
|
||||
onAutoCompleteCompleted: (toastItem) =>
|
||||
print('Toast ${toastItem.id} auto complete completed'),
|
||||
onDismissed: (toastItem) => print('Toast ${toastItem.id} dismissed'),
|
||||
),
|
||||
);
|
||||
// _showToast(context, message, Colors.red);
|
||||
}
|
||||
|
||||
static void _showToast(BuildContext context, String message, Color color) {
|
||||
|
||||
2068
lib/empDetails.dart
2068
lib/empDetails.dart
File diff suppressed because it is too large
Load Diff
1147
lib/empReview.dart
1147
lib/empReview.dart
File diff suppressed because it is too large
Load Diff
@ -5,11 +5,14 @@ import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:excel/excel.dart';
|
||||
import 'dart:io';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class excelVerify extends StatefulWidget {
|
||||
const excelVerify({Key? key}) : super(key: key);
|
||||
@ -38,6 +41,8 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
dynamic policyFirstPart;
|
||||
List<Map<String, dynamic>> originalData = []; // Original data source
|
||||
List<Map<String, dynamic>> filteredData = []; // Filtered data source
|
||||
dynamic client_policy_id;
|
||||
dynamic policy_name;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -52,8 +57,8 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final token = prefs.getString('token');
|
||||
if (token != null) {
|
||||
final token = prefs.getString('hrtoken');
|
||||
if (token != null && token.isNotEmpty) {
|
||||
setState(() {
|
||||
_token = token;
|
||||
});
|
||||
@ -61,8 +66,10 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
clintID = decodedToken['client_id'].toString();
|
||||
await getPolicyName(clintID);
|
||||
} else {
|
||||
_token = 'null';
|
||||
// Handle the case when token is not available
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'hrLogin');
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,16 +93,37 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
setState(() {
|
||||
dataPolicy = List<Map<String, dynamic>>.from(data['data']);
|
||||
print(dataPolicy);
|
||||
getPolicyNameDetails = dataPolicy[0]['policy_name'];
|
||||
print(getPolicyNameDetails);
|
||||
getPolicyNo = dataPolicy[0]['client_policy_id'];
|
||||
|
||||
// Find the object where the 'type' matches the 'policyFirstPart'
|
||||
Map<String, dynamic> matchingPolicy = dataPolicy.firstWhere(
|
||||
(policy) => policy['type'] == policyFirstPart,
|
||||
orElse: () => <String,
|
||||
dynamic>{} // Return an empty map if no matching policy is found
|
||||
);
|
||||
print(matchingPolicy);
|
||||
if (matchingPolicy != null) {
|
||||
// Matching policy found
|
||||
print('Matching Policy: $matchingPolicy');
|
||||
client_policy_id = matchingPolicy['client_policy_id'];
|
||||
policy_name = matchingPolicy['policy_name'];
|
||||
} else {
|
||||
// No matching policy found
|
||||
print('No matching policy found for $policyFirstPart');
|
||||
}
|
||||
// getPolicyNameDetails = dataPolicy[0]['policy_name'];
|
||||
// print(getPolicyNameDetails);
|
||||
// getPolicyNo = dataPolicy[0]['client_policy_id'];
|
||||
});
|
||||
|
||||
print('Successfully Sent');
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -108,7 +136,9 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
}
|
||||
|
||||
void _uploadFile(importPolicyName) async {
|
||||
print('Test');
|
||||
if (kIsWeb) {
|
||||
print('kIsWeb');
|
||||
final input = html.FileUploadInputElement();
|
||||
input.accept = '.xlsx';
|
||||
input.click();
|
||||
@ -116,22 +146,26 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
final file = input.files!.first;
|
||||
final reader = html.FileReader();
|
||||
reader.readAsArrayBuffer(file);
|
||||
reader.onLoadEnd.listen((event) async {
|
||||
await reader.onLoadEnd.first; // Wait for the file to be loaded
|
||||
if (reader.readyState == html.FileReader.DONE) {
|
||||
Uint8List? fileBytes = reader.result as Uint8List?;
|
||||
if (fileBytes != null) {
|
||||
// Call function to process Excel data
|
||||
setState(() {
|
||||
fileName = file.name;
|
||||
});
|
||||
// Save fileBytes to local storage
|
||||
final jsonString = json.encode(fileBytes);
|
||||
html.window.localStorage['fileBytes'] = jsonString;
|
||||
print(fileName);
|
||||
print(fileBytes);
|
||||
print('File Name: $fileName');
|
||||
print('File Bytes: $fileBytes');
|
||||
// Call the function to process Excel data here
|
||||
_processExcelData(fileBytes);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Handle non-web platforms here (e.g., show an error message)
|
||||
print('File upload is only supported on web platforms.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,8 +181,8 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
if (dataArray[0].length == 10) {
|
||||
for (int i = 0; i < dataArray.length; i++) {
|
||||
Map<String, dynamic> dataMap = {
|
||||
"S.No": dataArray[i][0].value,
|
||||
"Emp Code": dataArray[i][1].value,
|
||||
"Sno": dataArray[i][0].value,
|
||||
"emp_code": dataArray[i][1].value,
|
||||
"Name": dataArray[i][2].value,
|
||||
"DOJ": dataArray[i][3].value,
|
||||
"Gender": dataArray[i][4].value,
|
||||
@ -284,11 +318,11 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
request.files.add(http.MultipartFile.fromBytes('file', fileBytes,
|
||||
filename: fileName)); // Specify filename here
|
||||
request.fields['client_id'] = clintID;
|
||||
if (policyFirstPart == 'GPA') {
|
||||
request.fields['policy_id'] = '1';
|
||||
} else {
|
||||
request.fields['policy_id'] = '3';
|
||||
}
|
||||
// if (policyFirstPart == 'GPA') {
|
||||
request.fields['policy_id'] = client_policy_id;
|
||||
// } else {
|
||||
// request.fields['policy_id'] = '3';
|
||||
// }
|
||||
|
||||
// Send the request
|
||||
final response = await request.send();
|
||||
@ -296,11 +330,14 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
// Check the status code of the response
|
||||
if (response.statusCode == 200) {
|
||||
// ToastHelper.showSuccessToast(context, 'File uploaded successfully');
|
||||
ToastHelper.showSuccessToast(context, 'Data Successfully Send...');
|
||||
print('File uploaded successfully');
|
||||
Navigator.pushNamed(context, 'hrHome');
|
||||
} else {
|
||||
// ToastHelper.showSuccessToast(
|
||||
// context, 'Failed to upload file: ${response.reasonPhrase}');
|
||||
ToastHelper.showSuccessToast(
|
||||
context, 'Failed to send data: ${response.reasonPhrase}');
|
||||
print('Failed to upload file: ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
@ -326,12 +363,9 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
dynamic importPolicyName =
|
||||
ModalRoute.of(context)!.settings.arguments as String?;
|
||||
|
||||
List<String> parts = importPolicyName.split(" - ");
|
||||
policyFirstPart =
|
||||
parts.isNotEmpty ? parts[0] : ''; // Accessing the first element
|
||||
print(policyFirstPart); // Output: GMC
|
||||
// List<String> parts = importPolicyName.split(" - ");
|
||||
policyFirstPart = importPolicyName;
|
||||
|
||||
print(importPolicyName);
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(),
|
||||
body: SafeArea(
|
||||
@ -357,36 +391,38 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
currentStep: _currentStep,
|
||||
controlsBuilder:
|
||||
(BuildContext context, ControlsDetails controls) {
|
||||
return Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
left: 0,
|
||||
child: Padding(
|
||||
return Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
if (_currentStep != 0)
|
||||
ElevatedButton(
|
||||
onPressed: controls.onStepCancel,
|
||||
onPressed: () {
|
||||
controls
|
||||
.onStepCancel!(); // Call onStepCancel function
|
||||
},
|
||||
child: Text(
|
||||
'Cancel',
|
||||
style:
|
||||
TextStyle(color: Color(0xFFE26728)),
|
||||
style: TextStyle(color: Color(0xFFE26728)),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
side: BorderSide(
|
||||
color: Color(0xFFE26728)),
|
||||
side:
|
||||
BorderSide(color: Color(0xFFE26728)),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
if (_currentStep != 2)
|
||||
ElevatedButton(
|
||||
onPressed: controls.onStepContinue,
|
||||
onPressed: () {
|
||||
controls
|
||||
.onStepContinue!(); // Call onStepContinue function
|
||||
},
|
||||
child: const Text(
|
||||
'NEXT',
|
||||
style: TextStyle(color: Colors.white),
|
||||
@ -417,7 +453,6 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onStepContinue: _currentStep == 2
|
||||
@ -478,7 +513,7 @@ class _excelVerifyState extends State<excelVerify> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
importPolicyName ?? '',
|
||||
policy_name ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@ -788,14 +823,18 @@ class _DependenceDataSource0 extends DataTableSource {
|
||||
@override
|
||||
DataRow getRow(int index) {
|
||||
final row = _data[index];
|
||||
|
||||
// Format date of birth to "July 10, 1996"
|
||||
String dob = row['dob'] != null ? formatDateString(row['dob']) : 'N/A';
|
||||
|
||||
return DataRow(cells: [
|
||||
DataCell(Text(row['SNo'].toString())),
|
||||
DataCell(Text(row['EmpCode'].toString())),
|
||||
DataCell(Text(row['Sno'].toString())),
|
||||
DataCell(Text(row['emp_code'].toString())),
|
||||
DataCell(Text(row['Name'].toString())),
|
||||
DataCell(Text(row['DOJ']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(row['Gender']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(row['Relation']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(row['DOB']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(dob)),
|
||||
DataCell(Text(row['Mail']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(row['Mobile']?.toString() ?? 'N/A')),
|
||||
DataCell(Text(row['SI']?.toString() ?? 'N/A')),
|
||||
@ -810,4 +849,13 @@ class _DependenceDataSource0 extends DataTableSource {
|
||||
|
||||
@override
|
||||
int get selectedRowCount => 0;
|
||||
|
||||
String formatDateString(String dateString) {
|
||||
// Parse the date string to DateTime object
|
||||
DateTime dateTime = DateTime.parse(dateString);
|
||||
// Format the DateTime object to "July 03, 2024"
|
||||
String formattedDate = DateFormat.yMMMMd().format(dateTime);
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
||||
|
||||
586
lib/hrHome.dart
586
lib/hrHome.dart
@ -7,7 +7,6 @@ import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
// import 'dart:html' as html;
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
@ -15,6 +14,7 @@ import 'dart:typed_data';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:excel/excel.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class MyHrHome extends StatefulWidget {
|
||||
const MyHrHome({Key? key}) : super(key: key);
|
||||
@ -24,28 +24,33 @@ class MyHrHome extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
Uint8List? _fileBytes;
|
||||
Uint8List? fileBytes;
|
||||
late String _token;
|
||||
List<Map<String, dynamic>> getEmpDependenceByClintIdGMC = [];
|
||||
List<Map<String, dynamic>> getEmpDependenceByClintIdGPA = [];
|
||||
List<Map<String, dynamic>> getEmpDependenceByClintIdAddOns = [];
|
||||
dynamic getPolicyNameDetails0;
|
||||
dynamic getPolicyNameDetails1;
|
||||
dynamic getPolicyNameDetails2;
|
||||
dynamic getPolicyNo0;
|
||||
dynamic getPolicyNo1;
|
||||
dynamic getPolicyNo2;
|
||||
bool _isLoading = false;
|
||||
dynamic clintID;
|
||||
late TabController _tabController;
|
||||
List<dynamic> dataPolicy = [];
|
||||
List<dynamic> reversedDataPolicy = [];
|
||||
List<Map<String, dynamic>> originalDataGpa = []; // Original data source
|
||||
List<Map<String, dynamic>> filteredDataGpa = []; // Filtered data source
|
||||
List<Map<String, dynamic>> originalDataGmc = []; // Original data source
|
||||
List<Map<String, dynamic>> filteredDataGmc = []; // Filtered data source
|
||||
List<Map<String, dynamic>> originalDataAddOns = []; // Original data source
|
||||
List<Map<String, dynamic>> filteredDataAddOns = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
_tabController = TabController(length: 3, vsync: this);
|
||||
_loadToken();
|
||||
}
|
||||
|
||||
@ -57,17 +62,19 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final token = prefs.getString('token');
|
||||
if (token != null) {
|
||||
final token = prefs.getString('hrtoken');
|
||||
if (token != null && token.isNotEmpty) {
|
||||
setState(() {
|
||||
_token = token;
|
||||
});
|
||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(token);
|
||||
clintID = decodedToken['client_id'];
|
||||
await getPolicyName(clintID);
|
||||
getPolicyName(clintID);
|
||||
} else {
|
||||
_token = 'null';
|
||||
// Handle the case when token is not available
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'hrLogin');
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,22 +98,52 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
setState(() {
|
||||
dataPolicy = List<Map<String, dynamic>>.from(data['data']);
|
||||
print(dataPolicy);
|
||||
getPolicyNameDetails0 = dataPolicy[0]['policy_name'];
|
||||
print(getPolicyNameDetails0);
|
||||
getPolicyNameDetails1 = dataPolicy[1]['policy_name'];
|
||||
print(getPolicyNameDetails1);
|
||||
getPolicyNo0 = dataPolicy[0]['client_policy_id'];
|
||||
print(getPolicyNameDetails1);
|
||||
getPolicyNo1 = dataPolicy[1]['client_policy_id'];
|
||||
print(getPolicyNameDetails1);
|
||||
reversedDataPolicy = dataPolicy.reversed.toList();
|
||||
// getPolicyNameDetails0 = dataPolicy[0]['policy_name'];
|
||||
// print(getPolicyNameDetails0);
|
||||
// getPolicyNameDetails1 = dataPolicy[1]['policy_name'];
|
||||
// print(getPolicyNameDetails1);
|
||||
// getPolicyNameDetails2 = dataPolicy[2]['policy_name'];
|
||||
// print(getPolicyNameDetails2);
|
||||
// getPolicyNo0 = dataPolicy[0]['client_policy_id'];
|
||||
// print(getPolicyNameDetails1);
|
||||
// getPolicyNo1 = dataPolicy[1]['client_policy_id'];
|
||||
// print(getPolicyNameDetails1);
|
||||
// getPolicyNo2 = dataPolicy[2]['client_policy_id'];
|
||||
// print(getPolicyNameDetails2);
|
||||
});
|
||||
// Code to execute periodically every 2 seconds
|
||||
getEmployeeAndDependenceGPA(clintID, getPolicyNo0);
|
||||
getEmployeeAndDependenceGMC(clintID, getPolicyNo1);
|
||||
reversedDataPolicy.forEach((policy) {
|
||||
if (policy['type'] == 'GPA') {
|
||||
String clientPolicyId = policy['client_policy_id'];
|
||||
String clientId = policy['client_id'];
|
||||
getEmployeeAndDependenceGPA(clientId, clientPolicyId);
|
||||
} else if (policy['type'] == 'GMC') {
|
||||
String clientPolicyId = policy['client_policy_id'];
|
||||
String clientId = policy['client_id'];
|
||||
getEmployeeAndDependenceGMC(clientId, clientPolicyId);
|
||||
} else if (policy['type'] == 'AddOn') {
|
||||
String clientPolicyId = policy['client_policy_id'];
|
||||
String clientId = policy['client_id'];
|
||||
getEmployeeAndDependenceAddOnsSi(clientId, clientPolicyId);
|
||||
} else if (policy['type'] == 'AddOn-DEPENDENT') {
|
||||
String clientPolicyId = policy['client_policy_id'];
|
||||
String clientId = policy['client_id'];
|
||||
getEmployeeAndDependenceAddOnsDependent(clientId, clientPolicyId);
|
||||
}
|
||||
// Extract client_policy_id from the policy object
|
||||
});
|
||||
// getEmployeeAndDependenceGPA(clintID, getPolicyNo2);
|
||||
// getEmployeeAndDependenceGMC(clintID, getPolicyNo1);
|
||||
// getEmployeeAndDependenceAddOns(clintID, getPolicyNo0);
|
||||
} else {
|
||||
ToastHelper.showWarningToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showWarningToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -118,12 +155,12 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getEmployeeAndDependenceGPA(clintID, getPolicyNo0) async {
|
||||
Future<void> getEmployeeAndDependenceGPA(clintID, getPolicyNo) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var url = Uri.parse(Environment.apiUrl +
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo0');
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo');
|
||||
try {
|
||||
var response = await http.get(
|
||||
url,
|
||||
@ -141,9 +178,13 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
filteredDataGpa = List.from(originalDataGpa);
|
||||
});
|
||||
} else {
|
||||
ToastHelper.showWarningToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showWarningToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -155,12 +196,12 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getEmployeeAndDependenceGMC(clintID, getPolicyNo1) async {
|
||||
Future<void> getEmployeeAndDependenceGMC(clintID, getPolicyNo) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var url = Uri.parse(Environment.apiUrl +
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo1');
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo');
|
||||
try {
|
||||
var response = await http.get(
|
||||
url,
|
||||
@ -178,9 +219,96 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
filteredDataGmc = List.from(originalDataGmc);
|
||||
});
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Exception occurred: $e');
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getEmployeeAndDependenceAddOnsSi(clintID, getPolicyNo) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var url = Uri.parse(Environment.apiUrl +
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo');
|
||||
try {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> data = json.decode(response.body);
|
||||
if (data['status'] == 'success') {
|
||||
setState(() {
|
||||
getEmpDependenceByClintIdAddOns =
|
||||
List<Map<String, dynamic>>.from(data['data']);
|
||||
originalDataAddOns = getEmpDependenceByClintIdAddOns;
|
||||
filteredDataAddOns = List.from(originalDataAddOns);
|
||||
});
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Exception occurred: $e');
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getEmployeeAndDependenceAddOnsDependent(
|
||||
clintID, getPolicyNo) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
var url = Uri.parse(Environment.apiUrl +
|
||||
'getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo');
|
||||
try {
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'Authorization': 'Bearer $_token',
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> data = json.decode(response.body);
|
||||
if (data['status'] == 'success') {
|
||||
setState(() {
|
||||
getEmpDependenceByClintIdAddOns =
|
||||
List<Map<String, dynamic>>.from(data['data']);
|
||||
originalDataAddOns = getEmpDependenceByClintIdAddOns;
|
||||
filteredDataAddOns = List.from(originalDataAddOns);
|
||||
});
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -195,9 +323,14 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
void _uploadFile(importPolicyName) async {
|
||||
var argumentDetails;
|
||||
if (importPolicyName == 'GPA') {
|
||||
argumentDetails = importPolicyName + ' - ' + getPolicyNameDetails0;
|
||||
// argumentDetails = importPolicyName + ' - ' + getPolicyNameDetails2;
|
||||
argumentDetails = 'GPA';
|
||||
} else if (importPolicyName == 'GMC') {
|
||||
// argumentDetails = importPolicyName + ' - ' + getPolicyNameDetails1;
|
||||
argumentDetails = 'GMC';
|
||||
} else {
|
||||
argumentDetails = importPolicyName + ' - ' + getPolicyNameDetails1;
|
||||
// argumentDetails = importPolicyName + ' - ' + getPolicyNameDetails0;
|
||||
argumentDetails = 'ADDONS';
|
||||
}
|
||||
|
||||
Navigator.pushNamed(context, 'excelVerify', arguments: argumentDetails);
|
||||
@ -250,8 +383,39 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
});
|
||||
}
|
||||
|
||||
void searchAddOns(String query) {
|
||||
setState(() {
|
||||
if (query.isEmpty) {
|
||||
// If search query is empty, show all data
|
||||
filteredDataAddOns = List.from(originalDataAddOns);
|
||||
} else {
|
||||
// Filter the data based on the search query
|
||||
filteredDataAddOns = originalDataAddOns.where((item) {
|
||||
// Implement your filter logic here, for example:
|
||||
return item['emp_code'].toLowerCase().contains(query.toLowerCase());
|
||||
}).toList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (dataPolicy == []) {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
color: Color(0xFFEFF3F6),
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Text('No Data Available'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
} else {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(),
|
||||
body: Container(
|
||||
@ -265,28 +429,45 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
labelColor: Colors.white, // Selected tab color
|
||||
unselectedLabelColor: Colors.grey, // Unselected tab color
|
||||
indicator: BoxDecoration(
|
||||
color: Color(0xFFE26728), // Background color of selected tab
|
||||
color:
|
||||
Color(0xFFE26728), // Background color of selected tab
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
controller: _tabController,
|
||||
tabs: [
|
||||
Tab(
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 0),
|
||||
child: Text('GPA-' + (getPolicyNameDetails0 ?? '')),
|
||||
),
|
||||
),
|
||||
Tab(
|
||||
tabs: reversedDataPolicy != null &&
|
||||
reversedDataPolicy.isNotEmpty
|
||||
? reversedDataPolicy.map((policy) {
|
||||
return Tab(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 0),
|
||||
child: Text('GMC-' + (getPolicyNameDetails1 ?? '')),
|
||||
child: Text(
|
||||
'${policy['type']}-${policy['policy_name']}'),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList()
|
||||
: [
|
||||
Tab(text: 'Loading...')
|
||||
], // Display a loading tab if dataPolicy is null or empty
|
||||
// tabs: [
|
||||
// Tab(
|
||||
// child: Container(
|
||||
// width: double.maxFinite,
|
||||
// alignment: Alignment.center,
|
||||
// padding: EdgeInsets.symmetric(vertical: 0),
|
||||
// child: Text('GPA-' + (getPolicyNameDetails0 ?? '')),
|
||||
// ),
|
||||
// ),
|
||||
// Tab(
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// alignment: Alignment.center,
|
||||
// padding: EdgeInsets.symmetric(vertical: 0),
|
||||
// child: Text('GMC-' + (getPolicyNameDetails1 ?? '')),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
@ -330,7 +511,8 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
BorderRadius.circular(5),
|
||||
),
|
||||
child: TextField(
|
||||
textAlignVertical: TextAlignVertical
|
||||
textAlignVertical:
|
||||
TextAlignVertical
|
||||
.center, // Center the text vertically
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search',
|
||||
@ -366,15 +548,15 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
style: TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
style:
|
||||
ElevatedButton.styleFrom(
|
||||
style: ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
Color(0xFFE26728),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
BorderRadius
|
||||
.circular(5),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -390,7 +572,7 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: _buildDataTableGPA(),
|
||||
child: _buildDataTableGPA(context),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -437,7 +619,8 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
BorderRadius.circular(5),
|
||||
),
|
||||
child: TextField(
|
||||
textAlignVertical: TextAlignVertical
|
||||
textAlignVertical:
|
||||
TextAlignVertical
|
||||
.center, // Center the text vertically
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search',
|
||||
@ -473,15 +656,15 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
style: TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
style:
|
||||
ElevatedButton.styleFrom(
|
||||
style: ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
Color(0xFFE26728),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
BorderRadius
|
||||
.circular(5),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -497,7 +680,116 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: _buildDataTableGMC(),
|
||||
child: _buildDataTableGMC(context),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: _isLoading
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
width:
|
||||
350, // Set your desired width here
|
||||
height:
|
||||
40, // Set your desired height here
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color.fromRGBO(
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
0.5), // Shadow color with opacity
|
||||
offset: Offset(5,
|
||||
5), // Shadow position (horizontal, vertical)
|
||||
blurRadius:
|
||||
10, // Blur radius
|
||||
spreadRadius:
|
||||
0, // Spread radius
|
||||
),
|
||||
],
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
),
|
||||
child: TextField(
|
||||
textAlignVertical:
|
||||
TextAlignVertical
|
||||
.center, // Center the text vertically
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search',
|
||||
suffixIcon:
|
||||
Icon(Icons.search),
|
||||
contentPadding: EdgeInsets.all(
|
||||
10), // Adjust the horizontal padding
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(
|
||||
0xFFf5f5f7)), // Set border color to gray
|
||||
),
|
||||
),
|
||||
onChanged:
|
||||
searchAddOns, // Call the search method on text change
|
||||
),
|
||||
)),
|
||||
),
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerRight,
|
||||
// child: Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// onPressed: () =>
|
||||
// _uploadFile('ADDONS'),
|
||||
// child: Text(
|
||||
// 'Import',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white),
|
||||
// ),
|
||||
// style: ElevatedButton
|
||||
// .styleFrom(
|
||||
// backgroundColor:
|
||||
// Color(0xFFE26728),
|
||||
// shape:
|
||||
// RoundedRectangleBorder(
|
||||
// borderRadius:
|
||||
// BorderRadius
|
||||
// .circular(5),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child:
|
||||
_buildDataTableAddOns(context),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -515,8 +807,9 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDataTableGPA() {
|
||||
Widget _buildDataTableGPA(context) {
|
||||
if (filteredDataGpa.isEmpty) {
|
||||
SizedBox(height: 25);
|
||||
return Text('No available data');
|
||||
@ -533,13 +826,13 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
DataColumn(label: Text('Gender')),
|
||||
DataColumn(label: Text('Mobile No')),
|
||||
],
|
||||
source: _DependenceDataSource0(filteredDataGpa),
|
||||
source: _DependenceDataSource0(filteredDataGpa, context),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDataTableGMC() {
|
||||
Widget _buildDataTableGMC(context) {
|
||||
if (filteredDataGmc.isEmpty) {
|
||||
SizedBox(height: 25);
|
||||
return Text('No available data');
|
||||
@ -556,7 +849,30 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
DataColumn(label: Text('Gender')),
|
||||
DataColumn(label: Text('Mobile No')),
|
||||
],
|
||||
source: _DependenceDataSource1(filteredDataGmc),
|
||||
source: _DependenceDataSource1(filteredDataGmc, context),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildDataTableAddOns(context) {
|
||||
if (filteredDataAddOns.isEmpty) {
|
||||
SizedBox(height: 25);
|
||||
return Text('No available data');
|
||||
} else {
|
||||
return Card(
|
||||
elevation: 0, // Set elevation to 0 for no shadow
|
||||
child: PaginatedDataTable(
|
||||
rowsPerPage: 5, // Adjust rows per page as needed
|
||||
columns: [
|
||||
DataColumn(label: Text('Employee ID')),
|
||||
DataColumn(label: Text('Name')),
|
||||
DataColumn(label: Text('Relationship')),
|
||||
DataColumn(label: Text('Date of Birth')),
|
||||
DataColumn(label: Text('Gender')),
|
||||
DataColumn(label: Text('Mobile No')),
|
||||
],
|
||||
source: _DependenceDataSource2(filteredDataAddOns, context),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -565,19 +881,41 @@ class _MyHrHomeState extends State<MyHrHome> with TickerProviderStateMixin {
|
||||
|
||||
class _DependenceDataSource0 extends DataTableSource {
|
||||
final List<Map<String, dynamic>> _data;
|
||||
_DependenceDataSource0(this._data);
|
||||
final BuildContext context;
|
||||
_DependenceDataSource0(this._data, this.context);
|
||||
|
||||
@override
|
||||
DataRow getRow(int index) {
|
||||
final row = _data[index];
|
||||
return DataRow(cells: [
|
||||
DataCell(Text(row['emp_code'].toString())),
|
||||
DataCell(Text(row['name'].toString())),
|
||||
DataCell(Text(row['relationship'].toString())),
|
||||
DataCell(Text(row['dob'] ?? 'N/A')),
|
||||
DataCell(Text(row['gender'] ?? 'N/A')),
|
||||
DataCell(Text(row['mobile'] ?? 'N/A')),
|
||||
]);
|
||||
Color rowColor = Colors.transparent;
|
||||
TextStyle textStyle = TextStyle(color: Colors.black);
|
||||
bool isClickable = false;
|
||||
|
||||
if (row['relationship'] == 'Self') {
|
||||
rowColor = Color(0xFFFFF1DD); // Setting background color for 'Self' rows
|
||||
textStyle = TextStyle(color: Colors.black);
|
||||
isClickable = true; // Making 'Self' rows clickable
|
||||
}
|
||||
// Format date of birth to "July 10, 1996"
|
||||
String dob = row['dob'] != null ? _formatDate(row['dob']) : 'N/A';
|
||||
|
||||
return DataRow(
|
||||
color: MaterialStateColor.resolveWith(
|
||||
(states) => rowColor), // Setting row background color
|
||||
cells: [
|
||||
DataCell(
|
||||
Text(row['emp_code'].toString(), style: textStyle),
|
||||
onTap: isClickable
|
||||
? () => _navigateToAnotherPage(row)
|
||||
: null, // Navigation only for 'Self' rows
|
||||
),
|
||||
DataCell(Text(row['name'].toString(), style: textStyle)),
|
||||
DataCell(Text(row['relationship'].toString(), style: textStyle)),
|
||||
DataCell(Text(dob, style: textStyle)),
|
||||
DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)),
|
||||
DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -588,22 +926,56 @@ class _DependenceDataSource0 extends DataTableSource {
|
||||
|
||||
@override
|
||||
int get selectedRowCount => 0;
|
||||
|
||||
void _navigateToAnotherPage(row) {
|
||||
print(row['mobile']);
|
||||
// Navigation logic here
|
||||
Navigator.pushNamed(context, 'empDetails',
|
||||
arguments: {'mobile': row['mobile']});
|
||||
}
|
||||
|
||||
String _formatDate(String date) {
|
||||
DateTime parsedDate = DateTime.parse(date);
|
||||
String formattedDate = DateFormat.yMMMMd().format(parsedDate);
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
||||
|
||||
class _DependenceDataSource1 extends DataTableSource {
|
||||
final List<Map<String, dynamic>> _data;
|
||||
_DependenceDataSource1(this._data);
|
||||
final BuildContext context;
|
||||
_DependenceDataSource1(this._data, this.context);
|
||||
|
||||
@override
|
||||
DataRow getRow(int index) {
|
||||
final row = _data[index];
|
||||
return DataRow(cells: [
|
||||
DataCell(Text(row['emp_code'].toString())),
|
||||
DataCell(Text(row['name'].toString())),
|
||||
DataCell(Text(row['relationship'].toString())),
|
||||
DataCell(Text(row['dob'] ?? 'N/A')),
|
||||
DataCell(Text(row['gender'] ?? 'N/A')),
|
||||
DataCell(Text(row['mobile'] ?? 'N/A')),
|
||||
Color rowColor = Colors.transparent;
|
||||
TextStyle textStyle = TextStyle(color: Colors.black);
|
||||
bool isClickable = false;
|
||||
|
||||
if (row['relationship'] == 'Self') {
|
||||
rowColor = Color(0xFFFFF1DD); // Setting background color for 'Self' rows
|
||||
textStyle = TextStyle(color: Colors.black);
|
||||
isClickable = true; // Making 'Self' rows clickable
|
||||
}
|
||||
|
||||
// Format date of birth to "July 10, 1996"
|
||||
String dob = row['dob'] != null ? _formatDate(row['dob']) : 'N/A';
|
||||
|
||||
return DataRow(
|
||||
color: MaterialStateColor.resolveWith((states) => rowColor),
|
||||
cells: [
|
||||
DataCell(
|
||||
Text(row['emp_code'].toString(), style: textStyle),
|
||||
onTap: isClickable
|
||||
? () => _navigateToAnotherPage(row)
|
||||
: null, // Navigation only for 'Self' rows
|
||||
),
|
||||
DataCell(Text(row['name'].toString(), style: textStyle)),
|
||||
DataCell(Text(row['relationship'].toString(), style: textStyle)),
|
||||
DataCell(Text(dob, style: textStyle)),
|
||||
DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)),
|
||||
DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -615,6 +987,78 @@ class _DependenceDataSource1 extends DataTableSource {
|
||||
|
||||
@override
|
||||
int get selectedRowCount => 0;
|
||||
|
||||
void _navigateToAnotherPage(row) {
|
||||
print(row);
|
||||
Navigator.pushNamed(context, 'empDetails',
|
||||
arguments: {'mobile': row['mobile']});
|
||||
}
|
||||
|
||||
String _formatDate(String date) {
|
||||
DateTime parsedDate = DateTime.parse(date);
|
||||
String formattedDate = DateFormat.yMMMMd().format(parsedDate);
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
||||
|
||||
class _DependenceDataSource2 extends DataTableSource {
|
||||
final List<Map<String, dynamic>> _data;
|
||||
final BuildContext context;
|
||||
_DependenceDataSource2(this._data, this.context);
|
||||
|
||||
@override
|
||||
DataRow getRow(int index) {
|
||||
final row = _data[index];
|
||||
Color rowColor = Colors.transparent;
|
||||
TextStyle textStyle = TextStyle(color: Colors.black);
|
||||
bool isClickable = false;
|
||||
|
||||
if (row['relationship'] == 'Self') {
|
||||
rowColor = Color(0xFFFFF1DD); // Setting background color for 'Self' rows
|
||||
textStyle = TextStyle(color: Colors.black);
|
||||
isClickable = true; // Making 'Self' rows clickable
|
||||
}
|
||||
|
||||
// Format date of birth to "July 10, 1996"
|
||||
String dob = row['dob'] != null ? _formatDate(row['dob']) : 'N/A';
|
||||
|
||||
return DataRow(
|
||||
color: MaterialStateColor.resolveWith((states) => rowColor),
|
||||
cells: [
|
||||
DataCell(
|
||||
Text(row['emp_code'].toString(), style: textStyle),
|
||||
onTap: isClickable
|
||||
? () => _navigateToAnotherPage(row)
|
||||
: null, // Navigation only for 'Self' rows
|
||||
),
|
||||
DataCell(Text(row['name'].toString(), style: textStyle)),
|
||||
DataCell(Text(row['relationship'].toString(), style: textStyle)),
|
||||
DataCell(Text(dob, style: textStyle)),
|
||||
DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)),
|
||||
DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)),
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isRowCountApproximate => false;
|
||||
|
||||
@override
|
||||
int get rowCount => _data.length;
|
||||
|
||||
@override
|
||||
int get selectedRowCount => 0;
|
||||
|
||||
void _navigateToAnotherPage(row) {
|
||||
print(row);
|
||||
Navigator.pushNamed(context, 'empDetails',
|
||||
arguments: {'mobile': row['mobile']});
|
||||
}
|
||||
|
||||
String _formatDate(String date) {
|
||||
DateTime parsedDate = DateTime.parse(date);
|
||||
String formattedDate = DateFormat.yMMMMd().format(parsedDate);
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
||||
|
||||
// Sample Data class representing each element in the array
|
||||
|
||||
146
lib/hrLogin.dart
146
lib/hrLogin.dart
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
@ -44,10 +45,12 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
bool userVerification = data['data']['user_verification'];
|
||||
return userVerification;
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Failed to verify mobile number');
|
||||
throw Exception('Failed to verify mobile number');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
ToastHelper.showErrorToast(context, 'Error: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -60,14 +63,11 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
||||
|
||||
if (isValid) {
|
||||
ToastHelper.showSuccessToast(context, 'Mobile No Verified...');
|
||||
Navigator.pushNamed(context, 'hrVerify',
|
||||
arguments: enteredMobileNumber);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Invalid mobile number'),
|
||||
),
|
||||
);
|
||||
ToastHelper.showErrorToast(context, 'Invalid mobile number');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,6 +118,109 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
height: _size.height / 3,
|
||||
width: double.infinity,
|
||||
color: Color(0xFF00989E),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 40, // Adjust top position as needed
|
||||
left: 10, // Align to the right
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Add your navigation logic here
|
||||
// For example, you can use Navigator.push to navigate to another page
|
||||
Navigator.pushNamed(context, 'phone');
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.west, // Icon for customer login
|
||||
color: Colors
|
||||
.black, // Adjust color as needed
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'Customer Login',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF000000), // Text color
|
||||
// Add other text styles as needed
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _size.height /
|
||||
6.4), // Adjust the spacing between the rows
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.center, // Align to the center
|
||||
children: [
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||
child: Align(
|
||||
alignment: Responsive.isDesktop(context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment.bottomCenter,
|
||||
child: Image.asset(
|
||||
_size.width <= 1100
|
||||
? 'assets/mobileViewLogo.png'
|
||||
: 'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Add your navigation logic here
|
||||
// For example, you can use Navigator.push to navigate to another page
|
||||
Navigator.pushNamed(
|
||||
context, 'hrLogin');
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align to the end (right)
|
||||
children: [
|
||||
Text(
|
||||
'HR Login',
|
||||
style: TextStyle(
|
||||
color: Color(
|
||||
0xFF000000), // Text color
|
||||
// Add other text styles as needed
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Icon(
|
||||
Icons
|
||||
.east, // Icon for customer login
|
||||
color: Colors
|
||||
.black, // Adjust color as needed
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -154,10 +257,12 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
child: Container(
|
||||
margin: _size.width > 1100
|
||||
? EdgeInsets.only(left: 20, right: 20)
|
||||
: null,
|
||||
: EdgeInsets.only(left: 0, right: 0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -223,8 +328,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -243,8 +350,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
height: 15,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -266,8 +375,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
),
|
||||
Container(
|
||||
height: 55,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 1, color: Colors.grey),
|
||||
@ -334,8 +445,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
@ -455,7 +568,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: _size.height * 0.2,
|
||||
height:
|
||||
Responsive.isDesktop(context)
|
||||
? _size.height * 0.1
|
||||
: _size.height * 0.2,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.height * 0.1,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'dart:async';
|
||||
@ -70,23 +71,27 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// Handle successful response
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('OTP resent successfully.'),
|
||||
),
|
||||
);
|
||||
ToastHelper.showSuccessToast(context, 'OTP resent successfully.');
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text('OTP resent successfully.'),
|
||||
// ),
|
||||
// );
|
||||
} else {
|
||||
// Handle other response status codes
|
||||
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
||||
throw Exception('Failed to resend OTP');
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle API call errors
|
||||
print('Error: $e');
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to resend OTP. Please try again.'),
|
||||
),
|
||||
);
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Failed to resend OTP. Please try again.');
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text('Failed to resend OTP. Please try again.'),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,32 +115,41 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
print(status);
|
||||
if (status == 'success') {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString('token', data['data']);
|
||||
// Store data in local storage (if needed)
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// await prefs.setString('userData', json.encode(data['data']));
|
||||
|
||||
// Redirect to another page
|
||||
prefs.setString('hrtoken', data['data']);
|
||||
final hrtoken = prefs.getString('hrtoken');
|
||||
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
Navigator.pushNamed(context, 'hrHome');
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'hrLogin');
|
||||
}
|
||||
// Redirect to another page
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again.');
|
||||
// Show a Snackbar if the OTP is invalid
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Invalid OTP. Please try again.'),
|
||||
),
|
||||
);
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text('Invalid OTP. Please try again.'),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Failed to verify OTP');
|
||||
throw Exception('Failed to verify OTP');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Failed to verify OTP. Please try again.');
|
||||
// Show a Snackbar if there's an error while verifying OTP
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Failed to verify OTP. Please try again.'),
|
||||
),
|
||||
);
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text('Failed to verify OTP. Please try again.'),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,57 +208,112 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
// extendBodyBehindAppBar: true,
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// leading: IconButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// icon: Icon(
|
||||
// Icons.arrow_back_ios_rounded,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// elevation: 0,
|
||||
// ),
|
||||
body: Stack(children: [
|
||||
// First half of the screen with background color
|
||||
body: SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
child: Container(
|
||||
height: _size.height,
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: _size.width <=
|
||||
1100, // Show only for screen width less than or equal to 1100 (mobile view)
|
||||
visible: _size.width <= 1100,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(30), // Adjust border radius as needed
|
||||
bottomRight:
|
||||
Radius.circular(30), // Adjust border radius as needed
|
||||
bottomLeft: Radius.circular(30),
|
||||
bottomRight: Radius.circular(30),
|
||||
),
|
||||
child: Container(
|
||||
height: _size.height / 3, // One-third of the screen height
|
||||
width: double.infinity, // Full width
|
||||
color: Color(0xFF00989E), // Your desired background color
|
||||
height: _size.height / 3,
|
||||
width: double.infinity,
|
||||
color: Color(0xFF00989E),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _size.height /
|
||||
6.4), // Adjust the spacing between the rows
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.center, // Align to the center
|
||||
children: [
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||
child: Align(
|
||||
alignment: Responsive.isDesktop(context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment.bottomCenter,
|
||||
child: Image.asset(
|
||||
_size.width <= 1100
|
||||
? 'assets/mobileViewLogo.png'
|
||||
: 'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Add your navigation logic here
|
||||
// For example, you can use Navigator.push to navigate to another page
|
||||
Navigator.pushNamed(
|
||||
context, 'hrLogin');
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align to the end (right)
|
||||
children: [
|
||||
Text(
|
||||
'HR Login',
|
||||
style: TextStyle(
|
||||
color: Color(
|
||||
0xFF000000), // Text color
|
||||
// Add other text styles as needed
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Icon(
|
||||
Icons
|
||||
.east, // Icon for customer login
|
||||
color: Colors
|
||||
.black, // Adjust color as needed
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Second half of the screen with the content
|
||||
Container(
|
||||
margin: marginInsets, // Adjust bottom margin
|
||||
margin: marginInsets,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
if (_size.width >
|
||||
1100) // Render Expanded column only if screen width is greater than 600 (tablet or larger)
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
if (_size.width > 1100)
|
||||
Expanded(
|
||||
flex: _size.width < 1100
|
||||
? 6
|
||||
: 12, // Take 6 parts out of 12
|
||||
flex: _size.width < 1100 ? 6 : 12,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context,
|
||||
BoxConstraints constraints) {
|
||||
// Only show the image column if screen width is greater than 600 (tablet or larger)
|
||||
if (constraints.maxWidth > 600) {
|
||||
return Image.asset(
|
||||
'assets/hrLogin.jpg',
|
||||
@ -252,7 +321,7 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
} else {
|
||||
return SizedBox(); // If screen width is smaller, return an empty SizedBox
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -261,18 +330,27 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
flex: _size.width < 1100 ? 6 : 12,
|
||||
child: Container(
|
||||
margin: _size.width > 1100
|
||||
? EdgeInsets.only(left: 150, right: 150)
|
||||
: null,
|
||||
? EdgeInsets.only(left: 20, right: 20)
|
||||
: EdgeInsets.only(left: 0, right: 0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_size.width <= 1100
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Align(
|
||||
alignment: Alignment
|
||||
.centerRight, // Align to the start
|
||||
child: _size.width <= 1100
|
||||
? Image.asset(
|
||||
'assets/Nhance-Logo-Final-mobile.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
)
|
||||
: _size.width <= 1100
|
||||
: _size.width > 1100
|
||||
? Image.asset(
|
||||
'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
@ -283,17 +361,36 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.width <= 1100 ? 50 : 0,
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Welcome to Nhance",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
RichText(
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
text:
|
||||
@ -319,8 +416,14 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
Pinput(
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 6,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
@ -328,9 +431,14 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
showCursor: true,
|
||||
controller: _otpController,
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
SizedBox(height: 0),
|
||||
Row(
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align text to the right
|
||||
children: [
|
||||
@ -352,8 +460,14 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
child: ElevatedButton(
|
||||
@ -365,7 +479,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (_formKey.currentState!
|
||||
.validate()) {
|
||||
_formKey.currentState!
|
||||
.save(); // Save form fields before calling verifyOTP
|
||||
verifyOTP(_otpController.text);
|
||||
@ -373,37 +488,22 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
},
|
||||
child: Text(
|
||||
"Submit",
|
||||
style:
|
||||
TextStyle(color: Color(0xFFFFFFFF)),
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFFFFFF)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Row(
|
||||
// children: [
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pushNamedAndRemoveUntil(
|
||||
// context,
|
||||
// 'phone',
|
||||
// (route) => false,
|
||||
// );
|
||||
// },
|
||||
// child: Text("Edit Phone Number?",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFE26728))),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(
|
||||
height: _size.width <= 1100 ? 0 : 0,
|
||||
), // Added SizedBox
|
||||
),
|
||||
_size.width > 1100
|
||||
? // Conditionally rendering based on screen width
|
||||
Column(
|
||||
? Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 150),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15), // Added SizedBox
|
||||
SizedBox(height: 30),
|
||||
Text(
|
||||
"Benefits of Login",
|
||||
style: TextStyle(
|
||||
@ -413,10 +513,12 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
],
|
||||
)
|
||||
: SizedBox(), // Added SizedBox
|
||||
))
|
||||
: SizedBox(),
|
||||
_size.width > 1100
|
||||
? Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 150),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -424,9 +526,9 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 8),
|
||||
// color: Colors.grey[200],
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
@ -436,11 +538,13 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
child: Container(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 12),
|
||||
vertical:
|
||||
12),
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
border: Border(
|
||||
right: BorderSide(
|
||||
right:
|
||||
BorderSide(
|
||||
width: 1,
|
||||
color: Colors
|
||||
.black,
|
||||
@ -449,7 +553,9 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.policy,
|
||||
Icon(
|
||||
Icons
|
||||
.policy,
|
||||
color: Color(
|
||||
0xFFE26728)),
|
||||
SizedBox(
|
||||
@ -464,7 +570,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
child: Container(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 12),
|
||||
vertical:
|
||||
12),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.edit,
|
||||
@ -486,14 +593,18 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: _size.height * 0.2,
|
||||
height:
|
||||
Responsive.isDesktop(context)
|
||||
? _size.height * 0.1
|
||||
: _size.height * 0.2,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.height * 0.1,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 8),
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
@ -531,10 +642,17 @@ class _MyVerifyState extends State<MyHrVerify> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
])
|
||||
]))))
|
||||
]),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
import 'dart:js';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nhancepolicy/addons.dart';
|
||||
import 'package:nhancepolicy/empReview.dart';
|
||||
|
||||
148
lib/phone.dart
148
lib/phone.dart
@ -45,9 +45,11 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
bool userVerification = data['data']['user_verification'];
|
||||
return userVerification;
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Failed to verify mobile number');
|
||||
throw Exception('Failed to verify mobile number');
|
||||
}
|
||||
} catch (e) {
|
||||
ToastHelper.showErrorToast(context, '$e');
|
||||
print('Error: $e');
|
||||
return false;
|
||||
}
|
||||
@ -61,9 +63,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
||||
|
||||
if (isValid) {
|
||||
ToastHelper.showSuccessToast(context, 'Mobile No Verified..');
|
||||
Navigator.pushNamed(context, 'verify', arguments: enteredMobileNumber);
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(context, 'Invalid mobile number');
|
||||
ToastHelper.showErrorToast(context, 'Invalid mobile number..');
|
||||
print('Invalid mobile number');
|
||||
}
|
||||
}
|
||||
@ -115,6 +118,106 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
height: _size.height / 3,
|
||||
width: double.infinity,
|
||||
color: Color(0xFF00989E),
|
||||
child: Stack(
|
||||
children: [
|
||||
// Positioned(
|
||||
// top: 40, // Adjust top position as needed
|
||||
// right: 10, // Align to the right
|
||||
// child: MouseRegion(
|
||||
// cursor: SystemMouseCursors.click,
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// // Add your navigation logic here
|
||||
// // For example, you can use Navigator.push to navigate to another page
|
||||
// Navigator.pushNamed(context, 'hrLogin');
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'HR Login',
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFF000000), // Text color
|
||||
// // Add other text styles as needed
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(width: 5),
|
||||
// Icon(
|
||||
// Icons.east, // Icon for customer login
|
||||
// color:
|
||||
// Colors.black, // Adjust color as needed
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _size.height /
|
||||
6.4), // Adjust the spacing between the rows
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.center, // Align to the center
|
||||
children: [
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||
child: Align(
|
||||
alignment: Responsive.isDesktop(context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment.bottomCenter,
|
||||
child: Image.asset(
|
||||
_size.width <= 1100
|
||||
? 'assets/mobileViewLogo.png'
|
||||
: 'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Add your navigation logic here
|
||||
// For example, you can use Navigator.push to navigate to another page
|
||||
Navigator.pushNamed(
|
||||
context, 'hrLogin');
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align to the end (right)
|
||||
children: [
|
||||
Text(
|
||||
'HR Login',
|
||||
style: TextStyle(
|
||||
color: Color(
|
||||
0xFF000000), // Text color
|
||||
// Add other text styles as needed
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Icon(
|
||||
Icons
|
||||
.east, // Icon for customer login
|
||||
color: Colors
|
||||
.black, // Adjust color as needed
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -133,17 +236,22 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
child: Container(
|
||||
margin: _size.width > 1100
|
||||
? EdgeInsets.only(left: 20, right: 20)
|
||||
: null,
|
||||
: EdgeInsets.only(left: 0, right: 0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: Align(
|
||||
alignment: Alignment
|
||||
.centerLeft, // Align to the start
|
||||
alignment: Responsive.isDesktop(
|
||||
context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment
|
||||
.bottomCenter, // Align to the start
|
||||
child: _size.width <= 1100
|
||||
? Image.asset(
|
||||
'assets/Nhance-Logo-Final-mobile.png',
|
||||
@ -165,7 +273,8 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
alignment:
|
||||
Alignment.centerRight,
|
||||
child: MouseRegion(
|
||||
cursor:
|
||||
SystemMouseCursors.click,
|
||||
@ -202,8 +311,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -222,8 +333,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
height: 15,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -245,8 +358,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
),
|
||||
Container(
|
||||
height: 55,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 1, color: Colors.grey),
|
||||
@ -313,8 +428,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 150),
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
@ -434,7 +551,10 @@ class _MyPhoneState extends State<MyPhone> {
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: _size.height * 0.2,
|
||||
height:
|
||||
Responsive.isDesktop(context)
|
||||
? _size.height * 0.1
|
||||
: _size.height * 0.2,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.height * 0.1,
|
||||
|
||||
325
lib/verify.dart
325
lib/verify.dart
@ -24,6 +24,10 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
late Timer _timer;
|
||||
int _secondsRemaining = 30;
|
||||
bool _isTimerRunning = false;
|
||||
dynamic empCodeString;
|
||||
dynamic empPrimaryId;
|
||||
dynamic gpaEmpName;
|
||||
dynamic client_id;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -74,6 +78,7 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
ToastHelper.showSuccessToast(context, 'OTP resent successfully');
|
||||
} else {
|
||||
// Handle other response status codes
|
||||
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
||||
throw Exception('Failed to resend OTP');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -105,23 +110,47 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
if (status == 'success') {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString('token', data['data']);
|
||||
// Store data in local storage (if needed)
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// await prefs.setString('userData', json.encode(data['data']));
|
||||
// ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
|
||||
// Decode the JWT token received from the API response
|
||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||
print(decodedToken);
|
||||
empCodeString = decodedToken['emp_code'].toString();
|
||||
prefs.setString('empCode', empCodeString);
|
||||
empPrimaryId = decodedToken['id'];
|
||||
prefs.setString('empPrimaryId', empPrimaryId);
|
||||
gpaEmpName = decodedToken['name'].toString();
|
||||
prefs.setString('gpaEmpName', gpaEmpName);
|
||||
client_id = decodedToken['client_id'];
|
||||
prefs.setString('client_id', client_id);
|
||||
|
||||
print('Successfully Login');
|
||||
|
||||
// Redirect to another page
|
||||
Navigator.pushNamed(context, 'empDetails');
|
||||
final token = prefs.getString('token');
|
||||
if (token != null && token.isNotEmpty) {
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
Navigator.pushReplacementNamed(context, 'empDetails',
|
||||
arguments: {'mobile': ''});
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'phone');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||
// Show a Snackbar if the OTP is invalid
|
||||
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||
print('Invalid OTP. Please try again');
|
||||
}
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Failed to verify OTP');
|
||||
throw Exception('Failed to verify OTP');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
ToastHelper.showErrorToast(
|
||||
context, 'Failed to verify OTP. Please try again.');
|
||||
// Show a Snackbar if there's an error while verifying OTP
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Failed to verify OTP. Please try again.');
|
||||
@ -184,63 +213,134 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
// extendBodyBehindAppBar: true,
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// leading: IconButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// icon: Icon(
|
||||
// Icons.arrow_back_ios_rounded,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// elevation: 0,
|
||||
// ),
|
||||
body: Stack(children: [
|
||||
// First half of the screen with background color
|
||||
body: SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
child: Container(
|
||||
height: _size.height,
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: _size.width <=
|
||||
1100, // Show only for screen width less than or equal to 1100 (mobile view)
|
||||
visible: _size.width <= 1100,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(30), // Adjust border radius as needed
|
||||
bottomRight:
|
||||
Radius.circular(30), // Adjust border radius as needed
|
||||
bottomLeft: Radius.circular(30),
|
||||
bottomRight: Radius.circular(30),
|
||||
),
|
||||
child: Container(
|
||||
height: _size.height / 3, // One-third of the screen height
|
||||
width: double.infinity, // Full width
|
||||
color: Color(0xFF00989E), // Your desired background color
|
||||
height: _size.height / 3,
|
||||
width: double.infinity,
|
||||
color: Color(0xFF00989E),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _size.height /
|
||||
6.4), // Adjust the spacing between the rows
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.center, // Align to the center
|
||||
children: [
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||
child: Align(
|
||||
alignment: Responsive.isDesktop(context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment.bottomCenter,
|
||||
child: Image.asset(
|
||||
_size.width <= 1100
|
||||
? 'assets/mobileViewLogo.png'
|
||||
: 'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Add your navigation logic here
|
||||
// For example, you can use Navigator.push to navigate to another page
|
||||
Navigator.pushNamed(
|
||||
context, 'hrLogin');
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align to the end (right)
|
||||
children: [
|
||||
Text(
|
||||
'HR Login',
|
||||
style: TextStyle(
|
||||
color: Color(
|
||||
0xFF000000), // Text color
|
||||
// Add other text styles as needed
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Icon(
|
||||
Icons
|
||||
.east, // Icon for customer login
|
||||
color: Colors
|
||||
.black, // Adjust color as needed
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Second half of the screen with the content
|
||||
Container(
|
||||
margin: marginInsets, // Adjust bottom margin
|
||||
margin: marginInsets,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: _size.width < 1100 ? 6 : 12,
|
||||
child: Container(
|
||||
margin: _size.width > 1100
|
||||
? EdgeInsets.only(left: 150, right: 150)
|
||||
: null,
|
||||
? EdgeInsets.only(left: 20, right: 20)
|
||||
: EdgeInsets.only(left: 0, right: 0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_size.width <= 1100
|
||||
if (!Responsive.isMobile(context) &&
|
||||
!Responsive.isTablet(context))
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: Align(
|
||||
alignment: Responsive.isDesktop(
|
||||
context)
|
||||
? Alignment.centerLeft
|
||||
: Alignment
|
||||
.bottomCenter, // Align to the start
|
||||
child: _size.width <= 1100
|
||||
? Image.asset(
|
||||
'assets/Nhance-Logo-Final-mobile.png',
|
||||
width: 150,
|
||||
height: 150,
|
||||
)
|
||||
: _size.width <= 1100
|
||||
: _size.width > 1100
|
||||
? Image.asset(
|
||||
'assets/Nhance-Logo-Final 1.png',
|
||||
width: 150,
|
||||
@ -251,17 +351,36 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
width: 150,
|
||||
height: 150,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.width <= 1100 ? 50 : 0,
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Welcome to Nhance",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
RichText(
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
text:
|
||||
@ -287,8 +406,14 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
Pinput(
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 6,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
@ -296,9 +421,14 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
showCursor: true,
|
||||
controller: _otpController,
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
SizedBox(height: 0),
|
||||
Row(
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.end, // Align text to the right
|
||||
children: [
|
||||
@ -320,8 +450,14 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(
|
||||
Container(
|
||||
margin: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: 150)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
child: ElevatedButton(
|
||||
@ -333,7 +469,8 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (_formKey.currentState!
|
||||
.validate()) {
|
||||
_formKey.currentState!
|
||||
.save(); // Save form fields before calling verifyOTP
|
||||
verifyOTP(_otpController.text);
|
||||
@ -341,37 +478,19 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
},
|
||||
child: Text(
|
||||
"Submit",
|
||||
style:
|
||||
TextStyle(color: Color(0xFFFFFFFF)),
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFFFFFF)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Row(
|
||||
// children: [
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pushNamedAndRemoveUntil(
|
||||
// context,
|
||||
// 'phone',
|
||||
// (route) => false,
|
||||
// );
|
||||
// },
|
||||
// child: Text("Edit Phone Number?",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFE26728))),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(
|
||||
height: _size.width <= 1100 ? 0 : 0,
|
||||
), // Added SizedBox
|
||||
_size.width > 1100
|
||||
? // Conditionally rendering based on screen width
|
||||
Column(
|
||||
? Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 150),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15), // Added SizedBox
|
||||
SizedBox(height: 30),
|
||||
Text(
|
||||
"Benefits of Login",
|
||||
style: TextStyle(
|
||||
@ -381,10 +500,12 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
],
|
||||
)
|
||||
: SizedBox(), // Added SizedBox
|
||||
))
|
||||
: SizedBox(),
|
||||
_size.width > 1100
|
||||
? Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 150),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@ -392,9 +513,9 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 8),
|
||||
// color: Colors.grey[200],
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
@ -404,11 +525,13 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
child: Container(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 12),
|
||||
vertical:
|
||||
12),
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
border: Border(
|
||||
right: BorderSide(
|
||||
right:
|
||||
BorderSide(
|
||||
width: 1,
|
||||
color: Colors
|
||||
.black,
|
||||
@ -417,7 +540,9 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.policy,
|
||||
Icon(
|
||||
Icons
|
||||
.policy,
|
||||
color: Color(
|
||||
0xFFE26728)),
|
||||
SizedBox(
|
||||
@ -432,7 +557,8 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
child: Container(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 12),
|
||||
vertical:
|
||||
12),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.edit,
|
||||
@ -454,14 +580,18 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: _size.height * 0.2,
|
||||
height:
|
||||
Responsive.isDesktop(context)
|
||||
? _size.height * 0.1
|
||||
: _size.height * 0.2,
|
||||
),
|
||||
SizedBox(
|
||||
height: _size.height * 0.1,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 8),
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
@ -499,17 +629,14 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
if (_size.width >
|
||||
1100) // Render Expanded column only if screen width is greater than 600 (tablet or larger)
|
||||
),
|
||||
),
|
||||
if (_size.width > 1100)
|
||||
Expanded(
|
||||
flex: _size.width < 1100
|
||||
? 6
|
||||
: 12, // Take 6 parts out of 12
|
||||
flex: _size.width < 1100 ? 6 : 12,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context,
|
||||
BoxConstraints constraints) {
|
||||
// Only show the image column if screen width is greater than 600 (tablet or larger)
|
||||
if (constraints.maxWidth > 600) {
|
||||
return Image.asset(
|
||||
'assets/login_web.jpg',
|
||||
@ -517,14 +644,20 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
} else {
|
||||
return SizedBox(); // If screen width is smaller, return an empty SizedBox
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
])
|
||||
]))))
|
||||
]),
|
||||
);
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,8 @@ dependencies:
|
||||
data_tables: ^1.4.0
|
||||
universal_html: ^2.2.4
|
||||
excel: ^4.0.3
|
||||
intl: ^0.19.0
|
||||
toastification: ^1.2.1
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
BIN
web/assets/nhance-loader.gif
Normal file
BIN
web/assets/nhance-loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 493 KiB |
BIN
web/favicon.png
BIN
web/favicon.png
Binary file not shown.
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 1.2 KiB |
@ -32,14 +32,47 @@
|
||||
<title>nhancepolicy</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 10%;
|
||||
height: 10vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFFCE5; /* Overlay background color with opacity */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Styles for the loading indicator */
|
||||
.indicator {
|
||||
width: 5vw;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// The value below is injected by flutter build, do not touch.
|
||||
const serviceWorkerVersion = null;
|
||||
</script>
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<body style="overflow:hidden">
|
||||
<div id="loading_indicator" class="container overlay">
|
||||
<img class="indicator" src="assets/nhance-loader.gif">
|
||||
</div>
|
||||
<script>
|
||||
window.addEventListener('load', function(ev) {
|
||||
// Download main.dart.js
|
||||
@ -55,5 +88,15 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
window.onLoad = function(){
|
||||
setTimeout(function () {
|
||||
var loadingIndicator = document.getElementById("loading_indicator");
|
||||
if(loadingIndicator){
|
||||
loadingIndicator.remove();
|
||||
}
|
||||
},10000);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user