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 |
3624
lib/addons.dart
3624
lib/addons.dart
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,64 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:adaptive_navbar/adaptive_navbar.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 {
|
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
@override
|
@override
|
||||||
Size get preferredSize => Size.fromHeight(kToolbarHeight);
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sw = MediaQuery.of(context).size.width;
|
final sw = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Color(0xFF00989E), // Set background color for AppBar
|
backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: preferredSize,
|
preferredSize: preferredSize,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
padding: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(horizontal: 16.0)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// Logo Column
|
// Logo Column
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: Responsive.isDesktop(context) ? 3 : 9,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment
|
mainAxisAlignment: Responsive.isDesktop(context)
|
||||||
.spaceEvenly, // Adjust the alignment as needed
|
? MainAxisAlignment.spaceEvenly
|
||||||
|
: MainAxisAlignment
|
||||||
|
.start, // Adjust the alignment as needed
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 10, bottom: 10),
|
margin: EdgeInsets.only(top: 10, bottom: 10),
|
||||||
width: 230,
|
width: 230,
|
||||||
height: 230,
|
height: 230,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/Group_3.png',
|
'assets/nhance_client_logo.png',
|
||||||
fit: BoxFit.contain, // Adjust the fit as needed
|
fit: BoxFit.contain, // Adjust the fit as needed
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -49,36 +77,45 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
// AdaptiveNavBar Column
|
// AdaptiveNavBar Column
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 9,
|
flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||||
child: AdaptiveNavBar(
|
child: AdaptiveNavBar(
|
||||||
screenWidth: sw,
|
screenWidth: sw,
|
||||||
backgroundColor: Color(0xFF00989E),
|
backgroundColor: Color(0xFFFFFCE5),
|
||||||
leading:
|
leading:
|
||||||
Container(), // Set an empty container as we have the logo separately
|
Container(), // Set an empty container as we have the logo separately
|
||||||
title: Text(''),
|
title: Text(''),
|
||||||
navBarItems: [
|
navBarItems: [
|
||||||
NavBarItem(
|
if (Responsive.isDesktop(context))
|
||||||
text: "",
|
NavBarItem(
|
||||||
onTap: () {
|
text: "",
|
||||||
Navigator.pushNamed(context, "routeName");
|
onTap: () {
|
||||||
},
|
Navigator.pushNamed(context, "routeName");
|
||||||
),
|
},
|
||||||
NavBarItem(
|
),
|
||||||
text: "",
|
if (Responsive.isDesktop(context))
|
||||||
onTap: () {
|
NavBarItem(
|
||||||
Navigator.pushNamed(context, "routeName");
|
text: "",
|
||||||
},
|
onTap: () {
|
||||||
),
|
Navigator.pushNamed(context, "routeName");
|
||||||
NavBarItem(
|
},
|
||||||
text: "",
|
),
|
||||||
onTap: () {
|
if (Responsive.isDesktop(context))
|
||||||
Navigator.pushNamed(context, "routeName");
|
NavBarItem(
|
||||||
},
|
text: "",
|
||||||
),
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, "routeName");
|
||||||
|
},
|
||||||
|
),
|
||||||
NavBarItem(
|
NavBarItem(
|
||||||
text: "Logout",
|
text: "Logout",
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.pushNamed(context, "phone");
|
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:flutter/material.dart';
|
||||||
// import 'package:fluttertoast/fluttertoast.dart';
|
// import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:toastification/toastification.dart';
|
||||||
|
|
||||||
class ToastHelper {
|
class ToastHelper {
|
||||||
static void showSuccessToast(BuildContext context, String message) {
|
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) {
|
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) {
|
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) {
|
static void _showToast(BuildContext context, String message, Color color) {
|
||||||
|
|||||||
2750
lib/empDetails.dart
2750
lib/empDetails.dart
File diff suppressed because it is too large
Load Diff
2483
lib/empReview.dart
2483
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:convert';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:universal_html/html.dart' as html;
|
import 'package:universal_html/html.dart' as html;
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:excel/excel.dart';
|
import 'package:excel/excel.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class excelVerify extends StatefulWidget {
|
class excelVerify extends StatefulWidget {
|
||||||
const excelVerify({Key? key}) : super(key: key);
|
const excelVerify({Key? key}) : super(key: key);
|
||||||
@ -38,6 +41,8 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
dynamic policyFirstPart;
|
dynamic policyFirstPart;
|
||||||
List<Map<String, dynamic>> originalData = []; // Original data source
|
List<Map<String, dynamic>> originalData = []; // Original data source
|
||||||
List<Map<String, dynamic>> filteredData = []; // Filtered data source
|
List<Map<String, dynamic>> filteredData = []; // Filtered data source
|
||||||
|
dynamic client_policy_id;
|
||||||
|
dynamic policy_name;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -52,8 +57,8 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
|
|
||||||
Future<void> _loadToken() async {
|
Future<void> _loadToken() async {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
final token = prefs.getString('token');
|
final token = prefs.getString('hrtoken');
|
||||||
if (token != null) {
|
if (token != null && token.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_token = token;
|
_token = token;
|
||||||
});
|
});
|
||||||
@ -61,8 +66,10 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
clintID = decodedToken['client_id'].toString();
|
clintID = decodedToken['client_id'].toString();
|
||||||
await getPolicyName(clintID);
|
await getPolicyName(clintID);
|
||||||
} else {
|
} else {
|
||||||
_token = 'null';
|
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||||
// Handle the case when token is not available
|
// 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(() {
|
setState(() {
|
||||||
dataPolicy = List<Map<String, dynamic>>.from(data['data']);
|
dataPolicy = List<Map<String, dynamic>>.from(data['data']);
|
||||||
print(dataPolicy);
|
print(dataPolicy);
|
||||||
getPolicyNameDetails = dataPolicy[0]['policy_name'];
|
|
||||||
print(getPolicyNameDetails);
|
// Find the object where the 'type' matches the 'policyFirstPart'
|
||||||
getPolicyNo = dataPolicy[0]['client_policy_id'];
|
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');
|
print('Successfully Sent');
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'API request failed with status: ${data['status']}');
|
||||||
print('API request failed with status: ${data['status']}');
|
print('API request failed with status: ${data['status']}');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'Request failed with status: ${response.statusCode}');
|
||||||
print('Request failed with status: ${response.statusCode}');
|
print('Request failed with status: ${response.statusCode}');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -108,7 +136,9 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _uploadFile(importPolicyName) async {
|
void _uploadFile(importPolicyName) async {
|
||||||
|
print('Test');
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
|
print('kIsWeb');
|
||||||
final input = html.FileUploadInputElement();
|
final input = html.FileUploadInputElement();
|
||||||
input.accept = '.xlsx';
|
input.accept = '.xlsx';
|
||||||
input.click();
|
input.click();
|
||||||
@ -116,22 +146,26 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
final file = input.files!.first;
|
final file = input.files!.first;
|
||||||
final reader = html.FileReader();
|
final reader = html.FileReader();
|
||||||
reader.readAsArrayBuffer(file);
|
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?;
|
Uint8List? fileBytes = reader.result as Uint8List?;
|
||||||
if (fileBytes != null) {
|
if (fileBytes != null) {
|
||||||
// Call function to process Excel data
|
|
||||||
setState(() {
|
setState(() {
|
||||||
fileName = file.name;
|
fileName = file.name;
|
||||||
});
|
});
|
||||||
// Save fileBytes to local storage
|
// Save fileBytes to local storage
|
||||||
final jsonString = json.encode(fileBytes);
|
final jsonString = json.encode(fileBytes);
|
||||||
html.window.localStorage['fileBytes'] = jsonString;
|
html.window.localStorage['fileBytes'] = jsonString;
|
||||||
print(fileName);
|
print('File Name: $fileName');
|
||||||
print(fileBytes);
|
print('File Bytes: $fileBytes');
|
||||||
|
// Call the function to process Excel data here
|
||||||
_processExcelData(fileBytes);
|
_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) {
|
if (dataArray[0].length == 10) {
|
||||||
for (int i = 0; i < dataArray.length; i++) {
|
for (int i = 0; i < dataArray.length; i++) {
|
||||||
Map<String, dynamic> dataMap = {
|
Map<String, dynamic> dataMap = {
|
||||||
"S.No": dataArray[i][0].value,
|
"Sno": dataArray[i][0].value,
|
||||||
"Emp Code": dataArray[i][1].value,
|
"emp_code": dataArray[i][1].value,
|
||||||
"Name": dataArray[i][2].value,
|
"Name": dataArray[i][2].value,
|
||||||
"DOJ": dataArray[i][3].value,
|
"DOJ": dataArray[i][3].value,
|
||||||
"Gender": dataArray[i][4].value,
|
"Gender": dataArray[i][4].value,
|
||||||
@ -284,11 +318,11 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
request.files.add(http.MultipartFile.fromBytes('file', fileBytes,
|
request.files.add(http.MultipartFile.fromBytes('file', fileBytes,
|
||||||
filename: fileName)); // Specify filename here
|
filename: fileName)); // Specify filename here
|
||||||
request.fields['client_id'] = clintID;
|
request.fields['client_id'] = clintID;
|
||||||
if (policyFirstPart == 'GPA') {
|
// if (policyFirstPart == 'GPA') {
|
||||||
request.fields['policy_id'] = '1';
|
request.fields['policy_id'] = client_policy_id;
|
||||||
} else {
|
// } else {
|
||||||
request.fields['policy_id'] = '3';
|
// request.fields['policy_id'] = '3';
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
final response = await request.send();
|
final response = await request.send();
|
||||||
@ -296,11 +330,14 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
// Check the status code of the response
|
// Check the status code of the response
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
// ToastHelper.showSuccessToast(context, 'File uploaded successfully');
|
// ToastHelper.showSuccessToast(context, 'File uploaded successfully');
|
||||||
|
ToastHelper.showSuccessToast(context, 'Data Successfully Send...');
|
||||||
print('File uploaded successfully');
|
print('File uploaded successfully');
|
||||||
Navigator.pushNamed(context, 'hrHome');
|
Navigator.pushNamed(context, 'hrHome');
|
||||||
} else {
|
} else {
|
||||||
// ToastHelper.showSuccessToast(
|
// ToastHelper.showSuccessToast(
|
||||||
// context, 'Failed to upload file: ${response.reasonPhrase}');
|
// context, 'Failed to upload file: ${response.reasonPhrase}');
|
||||||
|
ToastHelper.showSuccessToast(
|
||||||
|
context, 'Failed to send data: ${response.reasonPhrase}');
|
||||||
print('Failed to upload file: ${response.reasonPhrase}');
|
print('Failed to upload file: ${response.reasonPhrase}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,12 +363,9 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
dynamic importPolicyName =
|
dynamic importPolicyName =
|
||||||
ModalRoute.of(context)!.settings.arguments as String?;
|
ModalRoute.of(context)!.settings.arguments as String?;
|
||||||
|
|
||||||
List<String> parts = importPolicyName.split(" - ");
|
// List<String> parts = importPolicyName.split(" - ");
|
||||||
policyFirstPart =
|
policyFirstPart = importPolicyName;
|
||||||
parts.isNotEmpty ? parts[0] : ''; // Accessing the first element
|
|
||||||
print(policyFirstPart); // Output: GMC
|
|
||||||
|
|
||||||
print(importPolicyName);
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(),
|
appBar: CustomAppBar(),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@ -357,66 +391,67 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
currentStep: _currentStep,
|
currentStep: _currentStep,
|
||||||
controlsBuilder:
|
controlsBuilder:
|
||||||
(BuildContext context, ControlsDetails controls) {
|
(BuildContext context, ControlsDetails controls) {
|
||||||
return Positioned(
|
return Container(
|
||||||
bottom: 0,
|
alignment: Alignment.bottomCenter,
|
||||||
right: 0,
|
padding: const EdgeInsets.all(16.0),
|
||||||
left: 0,
|
child: Row(
|
||||||
child: Padding(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
padding: const EdgeInsets.all(16.0),
|
children: <Widget>[
|
||||||
child: Row(
|
if (_currentStep != 0)
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
ElevatedButton(
|
||||||
children: <Widget>[
|
onPressed: () {
|
||||||
if (_currentStep != 0)
|
controls
|
||||||
ElevatedButton(
|
.onStepCancel!(); // Call onStepCancel function
|
||||||
onPressed: controls.onStepCancel,
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Cancel',
|
'Cancel',
|
||||||
style:
|
style: TextStyle(color: Color(0xFFE26728)),
|
||||||
TextStyle(color: Color(0xFFE26728)),
|
),
|
||||||
),
|
style: ElevatedButton.styleFrom(
|
||||||
style: ElevatedButton.styleFrom(
|
backgroundColor: Colors.white,
|
||||||
backgroundColor: Colors.white,
|
shape: RoundedRectangleBorder(
|
||||||
shape: RoundedRectangleBorder(
|
borderRadius: BorderRadius.circular(5),
|
||||||
borderRadius: BorderRadius.circular(5),
|
side:
|
||||||
side: BorderSide(
|
BorderSide(color: Color(0xFFE26728)),
|
||||||
color: Color(0xFFE26728)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
),
|
||||||
if (_currentStep != 2)
|
SizedBox(width: 10),
|
||||||
ElevatedButton(
|
if (_currentStep != 2)
|
||||||
onPressed: controls.onStepContinue,
|
ElevatedButton(
|
||||||
child: const Text(
|
onPressed: () {
|
||||||
'NEXT',
|
controls
|
||||||
style: TextStyle(color: Colors.white),
|
.onStepContinue!(); // Call onStepContinue function
|
||||||
),
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
child: const Text(
|
||||||
backgroundColor: Color(0xFFE26728),
|
'NEXT',
|
||||||
shape: RoundedRectangleBorder(
|
style: TextStyle(color: Colors.white),
|
||||||
borderRadius: BorderRadius.circular(5),
|
),
|
||||||
),
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Color(0xFFE26728),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
),
|
||||||
if (_currentStep == 2)
|
SizedBox(width: 10),
|
||||||
ElevatedButton(
|
if (_currentStep == 2)
|
||||||
onPressed: () {
|
ElevatedButton(
|
||||||
_retrieveAndUploadFile();
|
onPressed: () {
|
||||||
},
|
_retrieveAndUploadFile();
|
||||||
child: Text(
|
},
|
||||||
'Submit',
|
child: Text(
|
||||||
style: TextStyle(color: Colors.white),
|
'Submit',
|
||||||
),
|
style: TextStyle(color: Colors.white),
|
||||||
style: ElevatedButton.styleFrom(
|
),
|
||||||
backgroundColor: Color(0xFFE26728),
|
style: ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
backgroundColor: Color(0xFFE26728),
|
||||||
borderRadius: BorderRadius.circular(5),
|
shape: RoundedRectangleBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -478,7 +513,7 @@ class _excelVerifyState extends State<excelVerify> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
importPolicyName ?? '',
|
policy_name ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
@ -788,14 +823,18 @@ class _DependenceDataSource0 extends DataTableSource {
|
|||||||
@override
|
@override
|
||||||
DataRow getRow(int index) {
|
DataRow getRow(int index) {
|
||||||
final row = _data[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: [
|
return DataRow(cells: [
|
||||||
DataCell(Text(row['SNo'].toString())),
|
DataCell(Text(row['Sno'].toString())),
|
||||||
DataCell(Text(row['EmpCode'].toString())),
|
DataCell(Text(row['emp_code'].toString())),
|
||||||
DataCell(Text(row['Name'].toString())),
|
DataCell(Text(row['Name'].toString())),
|
||||||
DataCell(Text(row['DOJ']?.toString() ?? 'N/A')),
|
DataCell(Text(row['DOJ']?.toString() ?? 'N/A')),
|
||||||
DataCell(Text(row['Gender']?.toString() ?? 'N/A')),
|
DataCell(Text(row['Gender']?.toString() ?? 'N/A')),
|
||||||
DataCell(Text(row['Relation']?.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['Mail']?.toString() ?? 'N/A')),
|
||||||
DataCell(Text(row['Mobile']?.toString() ?? 'N/A')),
|
DataCell(Text(row['Mobile']?.toString() ?? 'N/A')),
|
||||||
DataCell(Text(row['SI']?.toString() ?? 'N/A')),
|
DataCell(Text(row['SI']?.toString() ?? 'N/A')),
|
||||||
@ -810,4 +849,13 @@ class _DependenceDataSource0 extends DataTableSource {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get selectedRowCount => 0;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1064
lib/hrHome.dart
1064
lib/hrHome.dart
File diff suppressed because it is too large
Load Diff
266
lib/hrLogin.dart
266
lib/hrLogin.dart
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@ -44,10 +45,12 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
bool userVerification = data['data']['user_verification'];
|
bool userVerification = data['data']['user_verification'];
|
||||||
return userVerification;
|
return userVerification;
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to verify mobile number');
|
||||||
throw Exception('Failed to verify mobile number');
|
throw Exception('Failed to verify mobile number');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
|
ToastHelper.showErrorToast(context, 'Error: $e');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,14 +63,11 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
ToastHelper.showSuccessToast(context, 'Mobile No Verified...');
|
||||||
Navigator.pushNamed(context, 'hrVerify',
|
Navigator.pushNamed(context, 'hrVerify',
|
||||||
arguments: enteredMobileNumber);
|
arguments: enteredMobileNumber);
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ToastHelper.showErrorToast(context, 'Invalid mobile number');
|
||||||
SnackBar(
|
|
||||||
content: Text('Invalid mobile number'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +118,109 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
height: _size.height / 3,
|
height: _size.height / 3,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Color(0xFF00989E),
|
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(
|
child: Container(
|
||||||
margin: _size.width > 1100
|
margin: _size.width > 1100
|
||||||
? EdgeInsets.only(left: 20, right: 20)
|
? EdgeInsets.only(left: 20, right: 20)
|
||||||
: null,
|
: EdgeInsets.only(left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
if (!Responsive.isMobile(context) &&
|
||||||
children: [
|
!Responsive.isTablet(context))
|
||||||
Expanded(
|
Row(
|
||||||
flex: 4,
|
children: [
|
||||||
child: Align(
|
Expanded(
|
||||||
alignment: Alignment.centerLeft,
|
flex: 4,
|
||||||
child: MouseRegion(
|
child: Align(
|
||||||
cursor:
|
alignment: Alignment.centerLeft,
|
||||||
SystemMouseCursors.click,
|
child: MouseRegion(
|
||||||
child: GestureDetector(
|
cursor:
|
||||||
onTap: () {
|
SystemMouseCursors.click,
|
||||||
// Add your navigation logic here
|
child: GestureDetector(
|
||||||
// For example, you can use Navigator.push to navigate to another page
|
onTap: () {
|
||||||
Navigator.pushNamed(
|
// Add your navigation logic here
|
||||||
context, 'phone');
|
// For example, you can use Navigator.push to navigate to another page
|
||||||
},
|
Navigator.pushNamed(
|
||||||
child: Row(
|
context, 'phone');
|
||||||
children: [
|
},
|
||||||
Icon(
|
child: Row(
|
||||||
Icons
|
children: [
|
||||||
.west, // Icon for customer login
|
Icon(
|
||||||
color: Colors
|
Icons
|
||||||
.black, // Adjust color as needed
|
.west, // Icon for customer login
|
||||||
),
|
color: Colors
|
||||||
SizedBox(width: 5),
|
.black, // Adjust color as needed
|
||||||
Text(
|
|
||||||
'Customer Login',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(
|
|
||||||
0xFF000000), // Text color
|
|
||||||
// Add other text styles as needed
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(width: 5),
|
||||||
],
|
Text(
|
||||||
|
'Customer Login',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(
|
||||||
|
0xFF000000), // Text color
|
||||||
|
// Add other text styles as needed
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
)),
|
Expanded(
|
||||||
Expanded(
|
flex: 8,
|
||||||
flex: 8,
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment
|
||||||
alignment: Alignment
|
.centerRight, // Align to the start
|
||||||
.centerRight, // Align to the start
|
child: _size.width <= 1100
|
||||||
child: _size.width <= 1100
|
? Image.asset(
|
||||||
? Image.asset(
|
'assets/Nhance-Logo-Final-mobile.png',
|
||||||
'assets/Nhance-Logo-Final-mobile.png',
|
width: 150,
|
||||||
width: 150,
|
height: 150,
|
||||||
height: 150,
|
)
|
||||||
)
|
: _size.width > 1100
|
||||||
: _size.width > 1100
|
? Image.asset(
|
||||||
? Image.asset(
|
'assets/Nhance-Logo-Final 1.png',
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
width: 150,
|
||||||
width: 150,
|
height: 150,
|
||||||
height: 150,
|
)
|
||||||
)
|
: Image.asset(
|
||||||
: Image.asset(
|
'assets/Nhance-Logo-Final 1.png',
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
width: 150,
|
||||||
width: 150,
|
height: 150,
|
||||||
height: 150,
|
),
|
||||||
),
|
)),
|
||||||
)),
|
],
|
||||||
],
|
),
|
||||||
),
|
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -243,8 +350,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -266,8 +375,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1, color: Colors.grey),
|
width: 1, color: Colors.grey),
|
||||||
@ -334,8 +445,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 45,
|
height: 45,
|
||||||
@ -455,7 +568,10 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
height: _size.height * 0.2,
|
height:
|
||||||
|
Responsive.isDesktop(context)
|
||||||
|
? _size.height * 0.1
|
||||||
|
: _size.height * 0.2,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: _size.height * 0.1,
|
height: _size.height * 0.1,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'package:pinput/pinput.dart';
|
import 'package:pinput/pinput.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
@ -70,23 +71,27 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
// Handle successful response
|
// Handle successful response
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ToastHelper.showSuccessToast(context, 'OTP resent successfully.');
|
||||||
SnackBar(
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
content: Text('OTP resent successfully.'),
|
// SnackBar(
|
||||||
),
|
// content: Text('OTP resent successfully.'),
|
||||||
);
|
// ),
|
||||||
|
// );
|
||||||
} else {
|
} else {
|
||||||
// Handle other response status codes
|
// Handle other response status codes
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
||||||
throw Exception('Failed to resend OTP');
|
throw Exception('Failed to resend OTP');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Handle API call errors
|
// Handle API call errors
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ToastHelper.showErrorToast(
|
||||||
SnackBar(
|
context, 'Failed to resend OTP. Please try again.');
|
||||||
content: Text('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);
|
print(status);
|
||||||
if (status == 'success') {
|
if (status == 'success') {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('token', data['data']);
|
prefs.setString('hrtoken', data['data']);
|
||||||
// Store data in local storage (if needed)
|
final hrtoken = prefs.getString('hrtoken');
|
||||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||||
// await prefs.setString('userData', json.encode(data['data']));
|
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
|
// Redirect to another page
|
||||||
Navigator.pushNamed(context, 'hrHome');
|
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again.');
|
||||||
// Show a Snackbar if the OTP is invalid
|
// Show a Snackbar if the OTP is invalid
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
// SnackBar(
|
||||||
content: Text('Invalid OTP. Please try again.'),
|
// content: Text('Invalid OTP. Please try again.'),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to verify OTP');
|
||||||
throw Exception('Failed to verify OTP');
|
throw Exception('Failed to verify OTP');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error: $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
|
// Show a Snackbar if there's an error while verifying OTP
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
// SnackBar(
|
||||||
content: Text('Failed to verify OTP. Please try again.'),
|
// content: Text('Failed to verify OTP. Please try again.'),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,347 +208,451 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// extendBodyBehindAppBar: true,
|
body: SingleChildScrollView(
|
||||||
// appBar: AppBar(
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||||
// backgroundColor: Colors.transparent,
|
child: Container(
|
||||||
// leading: IconButton(
|
height: _size.height,
|
||||||
// onPressed: () {
|
color: Colors.white,
|
||||||
// Navigator.pop(context);
|
child: Stack(
|
||||||
// },
|
children: [
|
||||||
// icon: Icon(
|
Visibility(
|
||||||
// Icons.arrow_back_ios_rounded,
|
visible: _size.width <= 1100,
|
||||||
// color: Colors.black,
|
child: ClipRRect(
|
||||||
// ),
|
borderRadius: BorderRadius.only(
|
||||||
// ),
|
bottomLeft: Radius.circular(30),
|
||||||
// elevation: 0,
|
bottomRight: Radius.circular(30),
|
||||||
// ),
|
),
|
||||||
body: Stack(children: [
|
child: Container(
|
||||||
// First half of the screen with background color
|
height: _size.height / 3,
|
||||||
Visibility(
|
width: double.infinity,
|
||||||
visible: _size.width <=
|
color: Color(0xFF00989E),
|
||||||
1100, // Show only for screen width less than or equal to 1100 (mobile view)
|
child: Stack(
|
||||||
child: ClipRRect(
|
children: [
|
||||||
borderRadius: BorderRadius.only(
|
Column(
|
||||||
bottomLeft: Radius.circular(30), // Adjust border radius as needed
|
children: [
|
||||||
bottomRight:
|
SizedBox(
|
||||||
Radius.circular(30), // Adjust border radius as needed
|
height: _size.height /
|
||||||
),
|
6.4), // Adjust the spacing between the rows
|
||||||
child: Container(
|
Row(
|
||||||
height: _size.height / 3, // One-third of the screen height
|
mainAxisAlignment: MainAxisAlignment
|
||||||
width: double.infinity, // Full width
|
.center, // Align to the center
|
||||||
color: Color(0xFF00989E), // Your desired background color
|
children: [
|
||||||
),
|
Expanded(
|
||||||
),
|
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||||
),
|
child: Align(
|
||||||
// Second half of the screen with the content
|
alignment: Responsive.isDesktop(context)
|
||||||
Container(
|
? Alignment.centerLeft
|
||||||
margin: marginInsets, // Adjust bottom margin
|
: Alignment.bottomCenter,
|
||||||
alignment: Alignment.bottomCenter,
|
child: Image.asset(
|
||||||
child: SingleChildScrollView(
|
_size.width <= 1100
|
||||||
child: Form(
|
? 'assets/mobileViewLogo.png'
|
||||||
key: _formKey,
|
: 'assets/Nhance-Logo-Final 1.png',
|
||||||
child: Column(children: [
|
width: 150,
|
||||||
Row(children: [
|
height: 150,
|
||||||
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');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 30),
|
),
|
||||||
Pinput(
|
if (!Responsive.isMobile(context) &&
|
||||||
length: 6,
|
!Responsive.isTablet(context))
|
||||||
// defaultPinTheme: defaultPinTheme,
|
Expanded(
|
||||||
// focusedPinTheme: focusedPinTheme,
|
flex: 2,
|
||||||
// submittedPinTheme: submittedPinTheme,
|
child: MouseRegion(
|
||||||
showCursor: true,
|
cursor: SystemMouseCursors.click,
|
||||||
controller: _otpController,
|
child: GestureDetector(
|
||||||
),
|
onTap: () {
|
||||||
SizedBox(height: 15),
|
// Add your navigation logic here
|
||||||
SizedBox(height: 0),
|
// For example, you can use Navigator.push to navigate to another page
|
||||||
Row(
|
Navigator.pushNamed(
|
||||||
mainAxisAlignment: MainAxisAlignment
|
context, 'hrLogin');
|
||||||
.end, // Align text to the right
|
},
|
||||||
children: [
|
child: Row(
|
||||||
_isTimerRunning
|
mainAxisAlignment: MainAxisAlignment
|
||||||
? Text(
|
.end, // Align to the end (right)
|
||||||
"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(
|
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
height: 15), // Added SizedBox
|
|
||||||
Text(
|
Text(
|
||||||
"Benefits of Login",
|
'HR Login',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
color: Color(
|
||||||
fontWeight: FontWeight.bold,
|
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,
|
Container(
|
||||||
fontSize: 9,
|
margin: marginInsets,
|
||||||
),
|
alignment: Alignment.bottomCenter,
|
||||||
children: <TextSpan>[
|
child: SingleChildScrollView(
|
||||||
TextSpan(
|
child: Form(
|
||||||
text: 'privacy policy ',
|
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(
|
style: TextStyle(
|
||||||
color: Color(0xFF00989E),
|
fontSize: 16,
|
||||||
fontSize: 9,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'and ',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'terms of use',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
])
|
],
|
||||||
]))))
|
),
|
||||||
]),
|
],
|
||||||
);
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
import 'dart:js';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:nhancepolicy/addons.dart';
|
import 'package:nhancepolicy/addons.dart';
|
||||||
import 'package:nhancepolicy/empReview.dart';
|
import 'package:nhancepolicy/empReview.dart';
|
||||||
|
|||||||
260
lib/phone.dart
260
lib/phone.dart
@ -45,9 +45,11 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
bool userVerification = data['data']['user_verification'];
|
bool userVerification = data['data']['user_verification'];
|
||||||
return userVerification;
|
return userVerification;
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to verify mobile number');
|
||||||
throw Exception('Failed to verify mobile number');
|
throw Exception('Failed to verify mobile number');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
ToastHelper.showErrorToast(context, '$e');
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -61,9 +63,10 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
bool isValid = await verifyMobileNumber(enteredMobileNumber);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
ToastHelper.showSuccessToast(context, 'Mobile No Verified..');
|
||||||
Navigator.pushNamed(context, 'verify', arguments: enteredMobileNumber);
|
Navigator.pushNamed(context, 'verify', arguments: enteredMobileNumber);
|
||||||
} else {
|
} else {
|
||||||
// ToastHelper.showErrorToast(context, 'Invalid mobile number');
|
ToastHelper.showErrorToast(context, 'Invalid mobile number..');
|
||||||
print('Invalid mobile number');
|
print('Invalid mobile number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,6 +118,106 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
height: _size.height / 3,
|
height: _size.height / 3,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Color(0xFF00989E),
|
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(
|
child: Container(
|
||||||
margin: _size.width > 1100
|
margin: _size.width > 1100
|
||||||
? EdgeInsets.only(left: 20, right: 20)
|
? EdgeInsets.only(left: 20, right: 20)
|
||||||
: null,
|
: EdgeInsets.only(left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
if (!Responsive.isMobile(context) &&
|
||||||
children: [
|
!Responsive.isTablet(context))
|
||||||
Expanded(
|
Row(
|
||||||
flex: 10,
|
children: [
|
||||||
child: Align(
|
Expanded(
|
||||||
alignment: Alignment
|
flex: 10,
|
||||||
.centerLeft, // Align to the start
|
child: Align(
|
||||||
child: _size.width <= 1100
|
alignment: Responsive.isDesktop(
|
||||||
? Image.asset(
|
context)
|
||||||
'assets/Nhance-Logo-Final-mobile.png',
|
? Alignment.centerLeft
|
||||||
width: 150,
|
: Alignment
|
||||||
height: 150,
|
.bottomCenter, // Align to the start
|
||||||
)
|
child: _size.width <= 1100
|
||||||
: _size.width > 1100
|
? Image.asset(
|
||||||
? Image.asset(
|
'assets/Nhance-Logo-Final-mobile.png',
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
width: 150,
|
||||||
width: 150,
|
height: 150,
|
||||||
height: 150,
|
)
|
||||||
)
|
: _size.width > 1100
|
||||||
: Image.asset(
|
? Image.asset(
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
'assets/Nhance-Logo-Final 1.png',
|
||||||
width: 150,
|
width: 150,
|
||||||
height: 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
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)),
|
SizedBox(width: 5),
|
||||||
Expanded(
|
Icon(
|
||||||
flex: 2,
|
Icons
|
||||||
child: Align(
|
.east, // Icon for customer login
|
||||||
alignment: Alignment.centerRight,
|
color: Colors
|
||||||
child: MouseRegion(
|
.black, // Adjust color as needed
|
||||||
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(height: 15),
|
SizedBox(height: 15),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -222,8 +333,10 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -245,8 +358,10 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1, color: Colors.grey),
|
width: 1, color: Colors.grey),
|
||||||
@ -313,8 +428,10 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
EdgeInsets.symmetric(horizontal: 150),
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 45,
|
height: 45,
|
||||||
@ -434,7 +551,10 @@ class _MyPhoneState extends State<MyPhone> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
height: _size.height * 0.2,
|
height:
|
||||||
|
Responsive.isDesktop(context)
|
||||||
|
? _size.height * 0.1
|
||||||
|
: _size.height * 0.2,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: _size.height * 0.1,
|
height: _size.height * 0.1,
|
||||||
|
|||||||
791
lib/verify.dart
791
lib/verify.dart
@ -24,6 +24,10 @@ class _MyVerifyState extends State<MyVerify> {
|
|||||||
late Timer _timer;
|
late Timer _timer;
|
||||||
int _secondsRemaining = 30;
|
int _secondsRemaining = 30;
|
||||||
bool _isTimerRunning = false;
|
bool _isTimerRunning = false;
|
||||||
|
dynamic empCodeString;
|
||||||
|
dynamic empPrimaryId;
|
||||||
|
dynamic gpaEmpName;
|
||||||
|
dynamic client_id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -74,6 +78,7 @@ class _MyVerifyState extends State<MyVerify> {
|
|||||||
ToastHelper.showSuccessToast(context, 'OTP resent successfully');
|
ToastHelper.showSuccessToast(context, 'OTP resent successfully');
|
||||||
} else {
|
} else {
|
||||||
// Handle other response status codes
|
// Handle other response status codes
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
||||||
throw Exception('Failed to resend OTP');
|
throw Exception('Failed to resend OTP');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -105,23 +110,47 @@ class _MyVerifyState extends State<MyVerify> {
|
|||||||
if (status == 'success') {
|
if (status == 'success') {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('token', data['data']);
|
prefs.setString('token', data['data']);
|
||||||
// Store data in local storage (if needed)
|
|
||||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
// Decode the JWT token received from the API response
|
||||||
// await prefs.setString('userData', json.encode(data['data']));
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
// ToastHelper.showSuccessToast(context, 'Successfully Login');
|
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');
|
print('Successfully Login');
|
||||||
|
|
||||||
// Redirect to another page
|
// 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 {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||||
// Show a Snackbar if the OTP is invalid
|
// Show a Snackbar if the OTP is invalid
|
||||||
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||||
print('Invalid OTP. Please try again');
|
print('Invalid OTP. Please try again');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Failed to verify OTP');
|
||||||
throw Exception('Failed to verify OTP');
|
throw Exception('Failed to verify OTP');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error: $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
|
// Show a Snackbar if there's an error while verifying OTP
|
||||||
// ToastHelper.showErrorToast(
|
// ToastHelper.showErrorToast(
|
||||||
// context, 'Failed to verify OTP. Please try again.');
|
// context, 'Failed to verify OTP. Please try again.');
|
||||||
@ -184,347 +213,451 @@ class _MyVerifyState extends State<MyVerify> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// extendBodyBehindAppBar: true,
|
body: SingleChildScrollView(
|
||||||
// appBar: AppBar(
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||||
// backgroundColor: Colors.transparent,
|
child: Container(
|
||||||
// leading: IconButton(
|
height: _size.height,
|
||||||
// onPressed: () {
|
color: Colors.white,
|
||||||
// Navigator.pop(context);
|
child: Stack(
|
||||||
// },
|
children: [
|
||||||
// icon: Icon(
|
Visibility(
|
||||||
// Icons.arrow_back_ios_rounded,
|
visible: _size.width <= 1100,
|
||||||
// color: Colors.black,
|
child: ClipRRect(
|
||||||
// ),
|
borderRadius: BorderRadius.only(
|
||||||
// ),
|
bottomLeft: Radius.circular(30),
|
||||||
// elevation: 0,
|
bottomRight: Radius.circular(30),
|
||||||
// ),
|
),
|
||||||
body: Stack(children: [
|
child: Container(
|
||||||
// First half of the screen with background color
|
height: _size.height / 3,
|
||||||
Visibility(
|
width: double.infinity,
|
||||||
visible: _size.width <=
|
color: Color(0xFF00989E),
|
||||||
1100, // Show only for screen width less than or equal to 1100 (mobile view)
|
child: Stack(
|
||||||
child: ClipRRect(
|
children: [
|
||||||
borderRadius: BorderRadius.only(
|
Column(
|
||||||
bottomLeft: Radius.circular(30), // Adjust border radius as needed
|
children: [
|
||||||
bottomRight:
|
SizedBox(
|
||||||
Radius.circular(30), // Adjust border radius as needed
|
height: _size.height /
|
||||||
),
|
6.4), // Adjust the spacing between the rows
|
||||||
child: Container(
|
Row(
|
||||||
height: _size.height / 3, // One-third of the screen height
|
mainAxisAlignment: MainAxisAlignment
|
||||||
width: double.infinity, // Full width
|
.center, // Align to the center
|
||||||
color: Color(0xFF00989E), // Your desired background color
|
children: [
|
||||||
),
|
Expanded(
|
||||||
),
|
flex: Responsive.isDesktop(context) ? 10 : 12,
|
||||||
),
|
child: Align(
|
||||||
// Second half of the screen with the content
|
alignment: Responsive.isDesktop(context)
|
||||||
Container(
|
? Alignment.centerLeft
|
||||||
margin: marginInsets, // Adjust bottom margin
|
: Alignment.bottomCenter,
|
||||||
alignment: Alignment.bottomCenter,
|
child: Image.asset(
|
||||||
child: SingleChildScrollView(
|
_size.width <= 1100
|
||||||
child: Form(
|
? 'assets/mobileViewLogo.png'
|
||||||
key: _formKey,
|
: 'assets/Nhance-Logo-Final 1.png',
|
||||||
child: Column(children: [
|
width: 150,
|
||||||
Row(children: [
|
height: 150,
|
||||||
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');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 30),
|
),
|
||||||
Pinput(
|
if (!Responsive.isMobile(context) &&
|
||||||
length: 6,
|
!Responsive.isTablet(context))
|
||||||
// defaultPinTheme: defaultPinTheme,
|
Expanded(
|
||||||
// focusedPinTheme: focusedPinTheme,
|
flex: 2,
|
||||||
// submittedPinTheme: submittedPinTheme,
|
child: MouseRegion(
|
||||||
showCursor: true,
|
cursor: SystemMouseCursors.click,
|
||||||
controller: _otpController,
|
child: GestureDetector(
|
||||||
),
|
onTap: () {
|
||||||
SizedBox(height: 15),
|
// Add your navigation logic here
|
||||||
SizedBox(height: 0),
|
// For example, you can use Navigator.push to navigate to another page
|
||||||
Row(
|
Navigator.pushNamed(
|
||||||
mainAxisAlignment: MainAxisAlignment
|
context, 'hrLogin');
|
||||||
.end, // Align text to the right
|
},
|
||||||
children: [
|
child: Row(
|
||||||
_isTimerRunning
|
mainAxisAlignment: MainAxisAlignment
|
||||||
? Text(
|
.end, // Align to the end (right)
|
||||||
"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(
|
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
height: 15), // Added SizedBox
|
|
||||||
Text(
|
Text(
|
||||||
"Benefits of Login",
|
'HR Login',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
color: Color(
|
||||||
fontWeight: FontWeight.bold,
|
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,
|
Container(
|
||||||
fontSize: 9,
|
margin: marginInsets,
|
||||||
),
|
alignment: Alignment.bottomCenter,
|
||||||
children: <TextSpan>[
|
child: SingleChildScrollView(
|
||||||
TextSpan(
|
child: Form(
|
||||||
text: 'privacy policy ',
|
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(
|
style: TextStyle(
|
||||||
color: Color(0xFF00989E),
|
fontSize: 16,
|
||||||
fontSize: 9,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'and ',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'terms of use',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
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();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,8 @@ dependencies:
|
|||||||
data_tables: ^1.4.0
|
data_tables: ^1.4.0
|
||||||
universal_html: ^2.2.4
|
universal_html: ^2.2.4
|
||||||
excel: ^4.0.3
|
excel: ^4.0.3
|
||||||
|
intl: ^0.19.0
|
||||||
|
toastification: ^1.2.1
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
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>
|
<title>nhancepolicy</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<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>
|
<script>
|
||||||
// The value below is injected by flutter build, do not touch.
|
// The value below is injected by flutter build, do not touch.
|
||||||
const serviceWorkerVersion = null;
|
const serviceWorkerVersion = null;
|
||||||
</script>
|
</script>
|
||||||
<!-- This script adds the flutter initialization JS code -->
|
<!-- This script adds the flutter initialization JS code -->
|
||||||
<script src="flutter.js" defer></script>
|
<script src="flutter.js" defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body style="overflow:hidden">
|
||||||
|
<div id="loading_indicator" class="container overlay">
|
||||||
|
<img class="indicator" src="assets/nhance-loader.gif">
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('load', function(ev) {
|
window.addEventListener('load', function(ev) {
|
||||||
// Download main.dart.js
|
// Download main.dart.js
|
||||||
@ -55,5 +88,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
window.onLoad = function(){
|
||||||
|
setTimeout(function () {
|
||||||
|
var loadingIndicator = document.getElementById("loading_indicator");
|
||||||
|
if(loadingIndicator){
|
||||||
|
loadingIndicator.remove();
|
||||||
|
}
|
||||||
|
},10000);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user