mobile view full flow

This commit is contained in:
Venba 2024-04-12 08:15:38 +05:30
parent d78c46be9d
commit 20ae302ab8
18 changed files with 8972 additions and 3642 deletions

BIN
assets/mobileViewLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

File diff suppressed because it is too large Load Diff

View File

@ -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,36 +77,45 @@ 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: [
NavBarItem(
text: "",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
NavBarItem(
text: "",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
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: () {
Navigator.pushNamed(context, "routeName");
},
),
if (Responsive.isDesktop(context))
NavBarItem(
text: "",
onTap: () {
Navigator.pushNamed(context, "routeName");
},
),
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");
},
),
],

View File

@ -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) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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,66 +391,67 @@ class _excelVerifyState extends State<excelVerify> {
currentStep: _currentStep,
controlsBuilder:
(BuildContext context, ControlsDetails controls) {
return Positioned(
bottom: 0,
right: 0,
left: 0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
if (_currentStep != 0)
ElevatedButton(
onPressed: controls.onStepCancel,
child: Text(
'Cancel',
style:
TextStyle(color: Color(0xFFE26728)),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: BorderSide(
color: Color(0xFFE26728)),
),
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!(); // Call onStepCancel function
},
child: Text(
'Cancel',
style: TextStyle(color: Color(0xFFE26728)),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side:
BorderSide(color: Color(0xFFE26728)),
),
),
SizedBox(width: 10),
if (_currentStep != 2)
ElevatedButton(
onPressed: controls.onStepContinue,
child: const Text(
'NEXT',
style: TextStyle(color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
SizedBox(width: 10),
if (_currentStep != 2)
ElevatedButton(
onPressed: () {
controls
.onStepContinue!(); // Call onStepContinue function
},
child: const Text(
'NEXT',
style: TextStyle(color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
SizedBox(width: 10),
if (_currentStep == 2)
ElevatedButton(
onPressed: () {
_retrieveAndUploadFile();
},
child: Text(
'Submit',
style: TextStyle(color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
SizedBox(width: 10),
if (_currentStep == 2)
ElevatedButton(
onPressed: () {
_retrieveAndUploadFile();
},
child: Text(
'Submit',
style: TextStyle(color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
],
),
),
],
),
);
},
@ -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;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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,77 +257,81 @@ 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: [
Row(
children: [
Expanded(
flex: 4,
child: Align(
alignment: Alignment.centerLeft,
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
if (!Responsive.isMobile(context) &&
!Responsive.isTablet(context))
Row(
children: [
Expanded(
flex: 4,
child: Align(
alignment: Alignment.centerLeft,
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
),
),
],
),
),
),
),
)),
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
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
)),
],
),
)),
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
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
)),
],
),
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,

View File

@ -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']));
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
Navigator.pushNamed(context, 'hrHome');
} 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,347 +208,451 @@ 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
Visibility(
visible: _size.width <=
1100, // Show only for screen width less than or equal to 1100 (mobile view)
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30), // Adjust border radius as needed
bottomRight:
Radius.circular(30), // Adjust border radius as needed
),
child: Container(
height: _size.height / 3, // One-third of the screen height
width: double.infinity, // Full width
color: Color(0xFF00989E), // Your desired background color
),
),
),
// Second half of the screen with the content
Container(
margin: marginInsets, // Adjust bottom margin
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)
Expanded(
flex: _size.width < 1100
? 6
: 12, // Take 6 parts out of 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',
height: _size.height,
fit: BoxFit.fill,
);
} else {
return SizedBox(); // If screen width is smaller, return an empty SizedBox
}
},
),
),
Expanded(
flex: _size.width < 1100 ? 6 : 12,
child: Container(
margin: _size.width > 1100
? EdgeInsets.only(left: 150, right: 150)
: null,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
)
: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
SizedBox(
height: _size.width <= 1100 ? 50 : 0,
),
Text(
"Welcome to Nhance",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
style: TextStyle(
fontSize: 12,
height: 1.5,
color: Color(0xFF000000)),
children: [
TextSpan(
text: " (Change Number)",
style: TextStyle(
fontSize: 12,
color: Color(
0xFFE26728)), // Change color as desired
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to the page where the user can change the phone number
Navigator.pushNamed(
context, 'hrLogin');
},
),
],
body: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Container(
height: _size.height,
color: Colors.white,
child: Stack(
children: [
Visibility(
visible: _size.width <= 1100,
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
child: Container(
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,
),
),
SizedBox(height: 30),
Pinput(
length: 6,
// defaultPinTheme: defaultPinTheme,
// focusedPinTheme: focusedPinTheme,
// submittedPinTheme: submittedPinTheme,
showCursor: true,
controller: _otpController,
),
SizedBox(height: 15),
SizedBox(height: 0),
Row(
mainAxisAlignment: MainAxisAlignment
.end, // Align text to the right
children: [
_isTimerRunning
? Text(
"Resend OTP in $_secondsRemaining seconds",
style: TextStyle(
color: Colors.black),
)
: InkWell(
onTap: () {
resendOTP(mobileNumber);
},
child: Text(
"Resend OTP",
style: TextStyle(
color: Colors.blue),
),
),
],
),
SizedBox(height: 10),
SizedBox(
width: double.infinity,
height: 45,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF00989E),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10),
),
),
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!
.save(); // Save form fields before calling verifyOTP
verifyOTP(_otpController.text);
}
},
child: Text(
"Submit",
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(
),
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: [
SizedBox(
height: 15), // Added SizedBox
Text(
"Benefits of Login",
'HR Login',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color(
0xFF000000), // Text color
// Add other text styles as needed
),
),
SizedBox(height: 15),
SizedBox(width: 5),
Icon(
Icons
.east, // Icon for customer login
color: Colors
.black, // Adjust color as needed
),
],
)
: SizedBox(), // Added SizedBox
_size.width > 1100
? Container(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
flex: 6,
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8),
// color: Colors.grey[200],
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical: 12),
decoration:
BoxDecoration(
border: Border(
right: BorderSide(
width: 1,
color: Colors
.black,
),
),
),
child: Column(
children: [
Icon(Icons.policy,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"View Policy"),
],
),
),
),
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical: 12),
child: Column(
children: [
Icon(Icons.edit,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"Manage Claims"),
],
),
),
),
],
),
),
),
],
),
)
: SizedBox(
height: _size.height * 0.2,
),
SizedBox(
height: _size.height * 0.1,
),
),
),
Container(
alignment: Alignment.bottomCenter,
padding: EdgeInsets.symmetric(vertical: 8),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
],
),
],
),
],
),
),
),
),
Container(
margin: marginInsets,
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Form(
key: _formKey,
child: Column(
children: [
Row(
children: [
if (_size.width > 1100)
Expanded(
flex: _size.width < 1100 ? 6 : 12,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints constraints) {
if (constraints.maxWidth > 600) {
return Image.asset(
'assets/hrLogin.jpg',
height: _size.height,
fit: BoxFit.fill,
);
} else {
return SizedBox();
}
},
),
),
Expanded(
flex: _size.width < 1100 ? 6 : 12,
child: Container(
margin: _size.width > 1100
? EdgeInsets.only(left: 20, right: 20)
: EdgeInsets.only(left: 0, right: 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
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
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
)),
],
),
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(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
SizedBox(height: 10),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
style: TextStyle(
fontSize: 12,
height: 1.5,
color: Color(0xFF000000)),
children: [
TextSpan(
text: " (Change Number)",
style: TextStyle(
fontSize: 12,
color: Color(
0xFFE26728)), // Change color as desired
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to the page where the user can change the phone number
Navigator.pushNamed(
context, 'hrLogin');
},
),
],
),
),
),
SizedBox(height: 15),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: Pinput(
length: 6,
// defaultPinTheme: defaultPinTheme,
// focusedPinTheme: focusedPinTheme,
// submittedPinTheme: submittedPinTheme,
showCursor: true,
controller: _otpController,
),
),
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: [
_isTimerRunning
? Text(
"Resend OTP in $_secondsRemaining seconds",
style: TextStyle(
color: Colors.black),
)
: InkWell(
onTap: () {
resendOTP(mobileNumber);
},
child: Text(
"Resend OTP",
style: TextStyle(
color: Colors.blue),
),
),
],
),
),
SizedBox(height: 10),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: SizedBox(
width: double.infinity,
height: 45,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF00989E),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10),
),
),
onPressed: () {
if (_formKey.currentState!
.validate()) {
_formKey.currentState!
.save(); // Save form fields before calling verifyOTP
verifyOTP(_otpController.text);
}
},
child: Text(
"Submit",
style: TextStyle(
color: Color(0xFFFFFFFF)),
),
),
),
),
SizedBox(
height: _size.width <= 1100 ? 0 : 0,
),
_size.width > 1100
? Container(
margin: EdgeInsets.symmetric(
horizontal: 150),
child: Column(
children: [
SizedBox(height: 30),
Text(
"Benefits of Login",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 15),
],
))
: SizedBox(),
_size.width > 1100
? Container(
margin: EdgeInsets.symmetric(
horizontal: 150),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
flex: 6,
child: Container(
padding:
EdgeInsets.symmetric(
vertical: 8),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical:
12),
decoration:
BoxDecoration(
border: Border(
right:
BorderSide(
width: 1,
color: Colors
.black,
),
),
),
child: Column(
children: [
Icon(
Icons
.policy,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"View Policy"),
],
),
),
),
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical:
12),
child: Column(
children: [
Icon(Icons.edit,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"Manage Claims"),
],
),
),
),
],
),
),
),
],
),
)
: SizedBox(
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),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
),
),
],
),
),
),
],
),
),
)),
])
]))))
]),
);
),
],
),
],
),
),
),
),
],
)),
));
}
}

View File

@ -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';

View File

@ -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,77 +236,85 @@ 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: [
Row(
children: [
Expanded(
flex: 10,
child: Align(
alignment: Alignment
.centerLeft, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
)
: _size.width > 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
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
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
)),
Expanded(
flex: 2,
child: Align(
alignment:
Alignment.centerRight,
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
),
),
)),
Expanded(
flex: 2,
child: Align(
alignment: Alignment.centerRight,
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
),
),
SizedBox(width: 5),
Icon(
Icons
.east, // Icon for customer login
color: Colors
.black, // Adjust color as needed
),
],
],
),
),
),
),
)),
],
),
)),
],
),
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,

View File

@ -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,347 +213,451 @@ 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
Visibility(
visible: _size.width <=
1100, // Show only for screen width less than or equal to 1100 (mobile view)
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30), // Adjust border radius as needed
bottomRight:
Radius.circular(30), // Adjust border radius as needed
),
child: Container(
height: _size.height / 3, // One-third of the screen height
width: double.infinity, // Full width
color: Color(0xFF00989E), // Your desired background color
),
),
),
// Second half of the screen with the content
Container(
margin: marginInsets, // Adjust bottom margin
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Form(
key: _formKey,
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,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
)
: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
SizedBox(
height: _size.width <= 1100 ? 50 : 0,
),
Text(
"Welcome to Nhance",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
style: TextStyle(
fontSize: 12,
height: 1.5,
color: Color(0xFF000000)),
children: [
TextSpan(
text: " (Change Number)",
style: TextStyle(
fontSize: 12,
color: Color(
0xFFE26728)), // Change color as desired
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to the page where the user can change the phone number
Navigator.pushNamed(
context, 'phone');
},
),
],
body: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Container(
height: _size.height,
color: Colors.white,
child: Stack(
children: [
Visibility(
visible: _size.width <= 1100,
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
child: Container(
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,
),
),
SizedBox(height: 30),
Pinput(
length: 6,
// defaultPinTheme: defaultPinTheme,
// focusedPinTheme: focusedPinTheme,
// submittedPinTheme: submittedPinTheme,
showCursor: true,
controller: _otpController,
),
SizedBox(height: 15),
SizedBox(height: 0),
Row(
mainAxisAlignment: MainAxisAlignment
.end, // Align text to the right
children: [
_isTimerRunning
? Text(
"Resend OTP in $_secondsRemaining seconds",
style: TextStyle(
color: Colors.black),
)
: InkWell(
onTap: () {
resendOTP(mobileNumber);
},
child: Text(
"Resend OTP",
style: TextStyle(
color: Colors.blue),
),
),
],
),
SizedBox(height: 10),
SizedBox(
width: double.infinity,
height: 45,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF00989E),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10),
),
),
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!
.save(); // Save form fields before calling verifyOTP
verifyOTP(_otpController.text);
}
},
child: Text(
"Submit",
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(
),
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: [
SizedBox(
height: 15), // Added SizedBox
Text(
"Benefits of Login",
'HR Login',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color(
0xFF000000), // Text color
// Add other text styles as needed
),
),
SizedBox(height: 15),
SizedBox(width: 5),
Icon(
Icons
.east, // Icon for customer login
color: Colors
.black, // Adjust color as needed
),
],
)
: SizedBox(), // Added SizedBox
_size.width > 1100
? Container(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
flex: 6,
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8),
// color: Colors.grey[200],
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical: 12),
decoration:
BoxDecoration(
border: Border(
right: BorderSide(
width: 1,
color: Colors
.black,
),
),
),
child: Column(
children: [
Icon(Icons.policy,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"View Policy"),
],
),
),
),
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical: 12),
child: Column(
children: [
Icon(Icons.edit,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"Manage Claims"),
],
),
),
),
],
),
),
),
],
),
)
: SizedBox(
height: _size.height * 0.2,
),
SizedBox(
height: _size.height * 0.1,
),
),
),
Container(
alignment: Alignment.bottomCenter,
padding: EdgeInsets.symmetric(vertical: 8),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
],
),
],
),
],
),
),
),
),
Container(
margin: marginInsets,
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Form(
key: _formKey,
child: Column(
children: [
Row(
children: [
Expanded(
flex: _size.width < 1100 ? 6 : 12,
child: Container(
margin: _size.width > 1100
? EdgeInsets.only(left: 20, right: 20)
: 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: 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
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),
)),
],
),
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(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
SizedBox(height: 10),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
style: TextStyle(
fontSize: 12,
height: 1.5,
color: Color(0xFF000000)),
children: [
TextSpan(
text: " (Change Number)",
style: TextStyle(
fontSize: 12,
color: Color(
0xFFE26728)), // Change color as desired
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to the page where the user can change the phone number
Navigator.pushNamed(
context, 'phone');
},
),
],
),
),
),
SizedBox(height: 15),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: Pinput(
length: 6,
// defaultPinTheme: defaultPinTheme,
// focusedPinTheme: focusedPinTheme,
// submittedPinTheme: submittedPinTheme,
showCursor: true,
controller: _otpController,
),
),
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: [
_isTimerRunning
? Text(
"Resend OTP in $_secondsRemaining seconds",
style: TextStyle(
color: Colors.black),
)
: InkWell(
onTap: () {
resendOTP(mobileNumber);
},
child: Text(
"Resend OTP",
style: TextStyle(
color: Colors.blue),
),
),
],
),
),
SizedBox(height: 10),
Container(
margin: Responsive.isDesktop(context)
? EdgeInsets.symmetric(
horizontal: 150)
: EdgeInsets.symmetric(horizontal: 0),
child: SizedBox(
width: double.infinity,
height: 45,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF00989E),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10),
),
),
onPressed: () {
if (_formKey.currentState!
.validate()) {
_formKey.currentState!
.save(); // Save form fields before calling verifyOTP
verifyOTP(_otpController.text);
}
},
child: Text(
"Submit",
style: TextStyle(
color: Color(0xFFFFFFFF)),
),
),
),
),
_size.width > 1100
? Container(
margin: EdgeInsets.symmetric(
horizontal: 150),
child: Column(
children: [
SizedBox(height: 30),
Text(
"Benefits of Login",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 15),
],
))
: SizedBox(),
_size.width > 1100
? Container(
margin: EdgeInsets.symmetric(
horizontal: 150),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
flex: 6,
child: Container(
padding:
EdgeInsets.symmetric(
vertical: 8),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical:
12),
decoration:
BoxDecoration(
border: Border(
right:
BorderSide(
width: 1,
color: Colors
.black,
),
),
),
child: Column(
children: [
Icon(
Icons
.policy,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"View Policy"),
],
),
),
),
Expanded(
child: Container(
padding: EdgeInsets
.symmetric(
vertical:
12),
child: Column(
children: [
Icon(Icons.edit,
color: Color(
0xFFE26728)),
SizedBox(
height: 10),
Text(
"Manage Claims"),
],
),
),
),
],
),
),
),
],
),
)
: SizedBox(
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),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
color: Color(0xFF00989E),
fontSize: 9,
),
),
],
),
),
),
],
),
),
)),
if (_size.width >
1100) // Render Expanded column only if screen width is greater than 600 (tablet or larger)
Expanded(
flex: _size.width < 1100
? 6
: 12, // Take 6 parts out of 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',
height: _size.height,
fit: BoxFit.fill,
);
} else {
return SizedBox(); // If screen width is smaller, return an empty SizedBox
}
},
),
),
])
]))))
]),
);
if (_size.width > 1100)
Expanded(
flex: _size.width < 1100 ? 6 : 12,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints constraints) {
if (constraints.maxWidth > 600) {
return Image.asset(
'assets/login_web.jpg',
height: _size.height,
fit: BoxFit.fill,
);
} else {
return SizedBox();
}
},
),
),
],
),
],
),
),
),
),
],
)),
));
}
}

View File

@ -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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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>