bug fix
This commit is contained in:
parent
3b323b4ce2
commit
bf169e6c88
@ -1,4 +1,3 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
@ -64,7 +63,6 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
|||||||
dynamic emp_status;
|
dynamic emp_status;
|
||||||
dynamic fCMToken;
|
dynamic fCMToken;
|
||||||
late String verificationId;
|
late String verificationId;
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
late String _verificationId;
|
late String _verificationId;
|
||||||
@ -101,6 +99,11 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
|||||||
|
|
||||||
void verifyOTP(String otp) async {
|
void verifyOTP(String otp) async {
|
||||||
try {
|
try {
|
||||||
|
if(otp.isEmpty){
|
||||||
|
ToastHelper.showErrorToast(context, 'Please enter OTP');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Map<String, dynamic> payload = (widget.type == 'mobile')
|
final Map<String, dynamic> payload = (widget.type == 'mobile')
|
||||||
? {'otp': _otpController.text, 'mobile_no': widget.value}
|
? {'otp': _otpController.text, 'mobile_no': widget.value}
|
||||||
: {'otp': _otpController.text, 'email': widget.value};
|
: {'otp': _otpController.text, 'email': widget.value};
|
||||||
@ -240,33 +243,42 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
|||||||
'hrLogin',
|
'hrLogin',
|
||||||
(route) => false,
|
(route) => false,
|
||||||
);
|
);
|
||||||
} else if (response.statusCode == 403) {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
await tokenService.clearAll(); // 🔐 clears flutter_secure_storage
|
|
||||||
|
|
||||||
ToastHelper.showErrorToast(context, 'Session Out');
|
|
||||||
if (!context.mounted) return;
|
|
||||||
Navigator.pushNamedAndRemoveUntil(
|
|
||||||
context,
|
|
||||||
'hrLogin',
|
|
||||||
(route) => false,
|
|
||||||
);
|
|
||||||
} else if (response.statusCode == 451) {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
final body = jsonDecode(response.body);
|
|
||||||
final message = body['message'];
|
|
||||||
ToastHelper.showWarningToast(context, message);
|
|
||||||
} else if (response.statusCode == 429) {
|
} else if (response.statusCode == 429) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
final body = jsonDecode(response.body);
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
final message = body['message'];
|
if (data.containsKey('error')) {
|
||||||
ToastHelper.showWarningToast(context, message);
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
|
} else if (response.statusCode == 403) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
if (data.containsKey('error')) {
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
|
} else if (response.statusCode == 451) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
if (data.containsKey('error')) {
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
@ -444,6 +456,20 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
|
|||||||
ToastHelper.showErrorToast(context, message);
|
ToastHelper.showErrorToast(context, message);
|
||||||
logDebug('Invalid mobile number');
|
logDebug('Invalid mobile number');
|
||||||
}
|
}
|
||||||
|
} else if (response.statusCode == 403) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else if (response.statusCode == 451) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
} else {
|
} else {
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
throw Exception('Failed to verify mobile number');
|
throw Exception('Failed to verify mobile number');
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
import 'package:firebase_core/firebase_core.dart';
|
|
||||||
|
|
||||||
const firebaseConfig = {
|
|
||||||
'apiKey': "AIzaSyAg0e5u7Piy6sWfgKl0C6D2XYyOakGB4wg",
|
|
||||||
'authDomain': "push-notification-enrollment.firebaseapp.com",
|
|
||||||
'projectId': "push-notification-enrollment",
|
|
||||||
'storageBucket': "push-notification-enrollment.appspot.com",
|
|
||||||
'messagingSenderId': "203846206303",
|
|
||||||
'appId': "1:203846206303:web:292619fd22c24ff99b6cea",
|
|
||||||
};
|
|
||||||
|
|
||||||
Future<void> initializeFirebase() async {
|
|
||||||
await Firebase.initializeApp(
|
|
||||||
options: FirebaseOptions(
|
|
||||||
apiKey: firebaseConfig['apiKey']!,
|
|
||||||
authDomain: firebaseConfig['authDomain']!,
|
|
||||||
projectId: firebaseConfig['projectId']!,
|
|
||||||
storageBucket: firebaseConfig['storageBucket']!,
|
|
||||||
messagingSenderId: firebaseConfig['messagingSenderId']!,
|
|
||||||
appId: firebaseConfig['appId']!,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@ -35,9 +34,6 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
bool _isCheckingToken = false;
|
bool _isCheckingToken = false;
|
||||||
dynamic empMobileNo;
|
dynamic empMobileNo;
|
||||||
dynamic empEmailid;
|
dynamic empEmailid;
|
||||||
|
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
|
||||||
|
|
||||||
late String _verificationId;
|
late String _verificationId;
|
||||||
int? _resendToken;
|
int? _resendToken;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
@ -166,8 +162,37 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
if (data.containsKey('error')) {
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
final message = data['message'];
|
final message = data['message'];
|
||||||
ToastHelper.showErrorToast(context, message);
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
|
} else if (response.statusCode == 403) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
if (data.containsKey('error')) {
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
|
} else if (response.statusCode == 451) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
if (data.containsKey('error')) {
|
||||||
|
final message = data['error']['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
} else {
|
||||||
|
final message = data['message'];
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import 'package:nhancepolicy/empDetails.dart';
|
|||||||
import 'package:nhancepolicy/presentation/preFileUpload.dart';
|
import 'package:nhancepolicy/presentation/preFileUpload.dart';
|
||||||
import 'package:nhancepolicy/hrHome.dart';
|
import 'package:nhancepolicy/hrHome.dart';
|
||||||
import 'package:nhancepolicy/hrVerify.dart';
|
import 'package:nhancepolicy/hrVerify.dart';
|
||||||
import 'package:nhancepolicy/phone.dart';
|
|
||||||
import 'package:nhancepolicy/presentation/excelVerification.dart';
|
import 'package:nhancepolicy/presentation/excelVerification.dart';
|
||||||
import 'package:nhancepolicy/presentation/postFileUpload.dart';
|
import 'package:nhancepolicy/presentation/postFileUpload.dart';
|
||||||
import 'package:nhancepolicy/presentation/cdList.dart';
|
import 'package:nhancepolicy/presentation/cdList.dart';
|
||||||
@ -16,14 +15,13 @@ import 'package:nhancepolicy/presentation/nonEBClaimsList.dart';
|
|||||||
import 'package:nhancepolicy/presentation/policies.dart';
|
import 'package:nhancepolicy/presentation/policies.dart';
|
||||||
import 'package:nhancepolicy/service/session/session_service.dart';
|
import 'package:nhancepolicy/service/session/session_service.dart';
|
||||||
import 'package:nhancepolicy/service/token_storage_service.dart';
|
import 'package:nhancepolicy/service/token_storage_service.dart';
|
||||||
import 'package:nhancepolicy/verify.dart';
|
|
||||||
import 'package:nhancepolicy/home.dart';
|
import 'package:nhancepolicy/home.dart';
|
||||||
import 'package:nhancepolicy/presentation/hrDashboard.dart';
|
import 'package:nhancepolicy/presentation/hrDashboard.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:nhancepolicy/hrLogin.dart';
|
import 'package:nhancepolicy/hrLogin.dart';
|
||||||
import 'package:nhancepolicy/presentation/hrPolicyDetails.dart';
|
import 'package:nhancepolicy/presentation/hrPolicyDetails.dart';
|
||||||
import 'package:nhancepolicy/oldPolicy.dart';
|
import 'package:nhancepolicy/oldPolicy.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
// import 'package:firebase_core/firebase_core.dart';
|
||||||
|
|
||||||
import 'presentation/cdTransactionDetails.dart';
|
import 'presentation/cdTransactionDetails.dart';
|
||||||
import 'config/environment.dart';
|
import 'config/environment.dart';
|
||||||
@ -55,12 +53,12 @@ Future<void> startApp() async {
|
|||||||
// Initialize token storage
|
// Initialize token storage
|
||||||
await TokenStorageService().initialize();
|
await TokenStorageService().initialize();
|
||||||
|
|
||||||
await Firebase.initializeApp(
|
// await Firebase.initializeApp(
|
||||||
options: const FirebaseOptions(
|
// options: const FirebaseOptions(
|
||||||
apiKey: 'AIzaSyCSvDM5fG2blDBE69Cae3S-iYRwwNBy7xo',
|
// apiKey: 'AIzaSyCSvDM5fG2blDBE69Cae3S-iYRwwNBy7xo',
|
||||||
appId: '1:1084115316849:web:ce28f12a426f285d6c6bd0',
|
// appId: '1:1084115316849:web:ce28f12a426f285d6c6bd0',
|
||||||
messagingSenderId: '1084115316849',
|
// messagingSenderId: '1084115316849',
|
||||||
projectId: 'nhance-ee8d1'));
|
// projectId: 'nhance-ee8d1'));
|
||||||
// await dotenv.load(fileName: Environment.fileName);
|
// await dotenv.load(fileName: Environment.fileName);
|
||||||
|
|
||||||
// runApp(MaterialApp(
|
// runApp(MaterialApp(
|
||||||
@ -215,17 +213,10 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, WidgetBuilder> appRoutes = {
|
final Map<String, WidgetBuilder> appRoutes = {
|
||||||
'phone': (context) => MyPhone(),
|
|
||||||
'mailVerify': (context) => MyEmailVerify(
|
'mailVerify': (context) => MyEmailVerify(
|
||||||
type: '',
|
type: '',
|
||||||
value: '',
|
value: '',
|
||||||
),
|
),
|
||||||
'verify': (context) => MyVerify(
|
|
||||||
verificationId: '',
|
|
||||||
mobileNumber: '',
|
|
||||||
resendToken: null,
|
|
||||||
onResendCode: (String, int) {},
|
|
||||||
),
|
|
||||||
'home': (context) => MyApp(),
|
'home': (context) => MyApp(),
|
||||||
'hrLogin': (context) => MyHrLogin(),
|
'hrLogin': (context) => MyHrLogin(),
|
||||||
// 'hrVerify': (context) => MyHrVerify(
|
// 'hrVerify': (context) => MyHrVerify(
|
||||||
|
|||||||
769
lib/phone.dart
769
lib/phone.dart
@ -1,769 +0,0 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
import 'package:nhancepolicy/responsive.dart';
|
|
||||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
|
||||||
import 'package:nhancepolicy/verify.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
import 'package:flutter_animated_button/flutter_animated_button.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
|
||||||
|
|
||||||
import 'config/environment.dart';
|
|
||||||
import 'package:nhancepolicy/logger.dart';
|
|
||||||
|
|
||||||
class MyPhone extends StatefulWidget {
|
|
||||||
const MyPhone({Key? key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MyPhone> createState() => _MyPhoneState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyPhoneState extends State<MyPhone> {
|
|
||||||
TextEditingController countryController = TextEditingController();
|
|
||||||
TextEditingController mobileController = TextEditingController();
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
|
||||||
|
|
||||||
late String _verificationId;
|
|
||||||
int? _resendToken;
|
|
||||||
bool _isLoading = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
countryController.text = "+91";
|
|
||||||
super.initState();
|
|
||||||
checkTokenAvailability();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> checkTokenAvailability() async {
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
final String? token = prefs.getString('token');
|
|
||||||
|
|
||||||
if (token != null && token.isNotEmpty) {
|
|
||||||
// Token available, navigate to home page
|
|
||||||
Navigator.pushReplacementNamed(context, 'empDetails',
|
|
||||||
arguments: {'mobile': ''});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleLoginType() {
|
|
||||||
Navigator.pushNamed(context, 'hrLogin'); // Navigate to another page
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> verifyMobileNumber() async {
|
|
||||||
try {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
// var enteredMobileNumber = countryController.text + mobileController.text;
|
|
||||||
var enteredMobileNumber = mobileController.text;
|
|
||||||
final response = await http.post(
|
|
||||||
Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
|
||||||
body: json.encode({'mobile_number': enteredMobileNumber}),
|
|
||||||
headers: {
|
|
||||||
'APP-SIGNATURE':
|
|
||||||
'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
|
||||||
bool userVerification = data['data']['user_verification'];
|
|
||||||
String message = data['data']['message'];
|
|
||||||
if (userVerification) {
|
|
||||||
// ToastHelper.showSuccessToast(context, message);
|
|
||||||
_verifyPhoneNumber();
|
|
||||||
// Navigator.pushNamed(context, 'verify',
|
|
||||||
// arguments: enteredMobileNumber);
|
|
||||||
} else {
|
|
||||||
ToastHelper.showErrorToast(context, message);
|
|
||||||
logDebug('Invalid mobile number');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
|
||||||
throw Exception('Failed to verify mobile number');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
|
||||||
logDebug('Error: $e');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _verifyPhoneNumber() async {
|
|
||||||
var enteredMobileNumber = mobileController.text;
|
|
||||||
var countryCode = countryController.text;
|
|
||||||
logDebug('${countryCode + enteredMobileNumber}');
|
|
||||||
await _auth.verifyPhoneNumber(
|
|
||||||
phoneNumber: '${countryCode + enteredMobileNumber}',
|
|
||||||
timeout: const Duration(seconds: 60),
|
|
||||||
verificationCompleted: (PhoneAuthCredential credential) async {
|
|
||||||
await _auth.signInWithCredential(credential);
|
|
||||||
ToastHelper.showSuccessToast(context, 'Verified Successfully!');
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
verificationFailed: (FirebaseAuthException e) {
|
|
||||||
ToastHelper.showSuccessToast(context, 'Verification Failed!');
|
|
||||||
if (e.code == 'invalid-phone-number') {
|
|
||||||
logDebug('The provided phone number is not valid.');
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
codeSent: (String verificationId, int? resendToken) {
|
|
||||||
setState(() {
|
|
||||||
_verificationId = verificationId;
|
|
||||||
_resendToken = resendToken;
|
|
||||||
});
|
|
||||||
ToastHelper.showSuccessToast(
|
|
||||||
context, 'Verification code sent to ${enteredMobileNumber}');
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => MyVerify(
|
|
||||||
verificationId: _verificationId,
|
|
||||||
mobileNumber: enteredMobileNumber,
|
|
||||||
resendToken: _resendToken,
|
|
||||||
onResendCode: _resendCode, // Pass the phone number
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
codeAutoRetrievalTimeout: (String verificationId) {
|
|
||||||
setState(() {
|
|
||||||
_verificationId = verificationId;
|
|
||||||
});
|
|
||||||
ToastHelper.showSuccessToast(context, 'Code auto-retrieval timed out.');
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _resendCode(String mobileNumber, int? resendToken) async {
|
|
||||||
await _auth.verifyPhoneNumber(
|
|
||||||
phoneNumber: '${countryController.text + mobileNumber}',
|
|
||||||
timeout: const Duration(seconds: 60),
|
|
||||||
forceResendingToken: resendToken,
|
|
||||||
verificationCompleted: (PhoneAuthCredential credential) async {
|
|
||||||
await _auth.signInWithCredential(credential);
|
|
||||||
},
|
|
||||||
verificationFailed: (FirebaseAuthException e) {
|
|
||||||
if (e.code == 'invalid-phone-number') {
|
|
||||||
logDebug('The provided phone number is not valid.');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
codeSent: (String verificationId, int? resendToken) {
|
|
||||||
setState(() {
|
|
||||||
_verificationId = verificationId;
|
|
||||||
_resendToken = resendToken;
|
|
||||||
});
|
|
||||||
ToastHelper.showSuccessToast(
|
|
||||||
context, 'Verification code resent to ${mobileNumber}');
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => MyVerify(
|
|
||||||
verificationId: _verificationId,
|
|
||||||
mobileNumber: mobileNumber,
|
|
||||||
resendToken: _resendToken,
|
|
||||||
onResendCode: _resendCode,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
codeAutoRetrievalTimeout: (String verificationId) {
|
|
||||||
setState(() {
|
|
||||||
_verificationId = verificationId;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Size _size = MediaQuery.of(context).size;
|
|
||||||
EdgeInsets marginInsets = EdgeInsets.zero;
|
|
||||||
|
|
||||||
if (Responsive.isDesktop(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
top: 0,
|
|
||||||
);
|
|
||||||
} else if (Responsive.isMobile(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 25, // Example value for mobile
|
|
||||||
right: 25, // Example value for mobile
|
|
||||||
bottom: 0, // Example value for mobile
|
|
||||||
top: 0, // Example value for mobile
|
|
||||||
);
|
|
||||||
} else if (Responsive.isTablet(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 25, //// Example value for mobile
|
|
||||||
right: 25, // Example value for mobile
|
|
||||||
bottom: 0, // Example value for mobile
|
|
||||||
top: 0, // Example value for mobile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Scaffold(
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
|
||||||
child: Container(
|
|
||||||
height: _size.height,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Visibility(
|
|
||||||
visible: _size.width <= 1100,
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
bottomLeft: Radius.circular(30),
|
|
||||||
bottomRight: Radius.circular(30),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
height: _size.height / 3,
|
|
||||||
width: double.infinity,
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
// 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 /
|
|
||||||
8.0), // 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(
|
|
||||||
'assets/mobileViewLogo.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
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: marginInsets,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: _size.width < 1100 ? 6 : 12,
|
|
||||||
child: Container(
|
|
||||||
margin: _size.width > 1100
|
|
||||||
? EdgeInsets.only(left: 20, right: 20)
|
|
||||||
: EdgeInsets.only(left: 0, right: 0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
if (!Responsive.isMobile(context) &&
|
|
||||||
!Responsive.isTablet(context))
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 10,
|
|
||||||
child: Align(
|
|
||||||
alignment: Responsive.isDesktop(
|
|
||||||
context)
|
|
||||||
? Alignment.topLeft
|
|
||||||
: Alignment
|
|
||||||
.bottomCenter, // Align to the start
|
|
||||||
child: _size.width <= 1100
|
|
||||||
? Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final-mobile.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
)
|
|
||||||
: _size.width > 1100
|
|
||||||
? Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
)
|
|
||||||
: Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: AnimatedButton(
|
|
||||||
animatedOn:
|
|
||||||
AnimatedOn.onHover,
|
|
||||||
onPress: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, 'hrLogin');
|
|
||||||
},
|
|
||||||
onChanges: (change) {},
|
|
||||||
height: 30,
|
|
||||||
width: 150,
|
|
||||||
text: 'HR Login',
|
|
||||||
isReverse: true,
|
|
||||||
selectedTextColor:
|
|
||||||
Colors.black,
|
|
||||||
transitionType: TransitionType
|
|
||||||
.LEFT_CENTER_ROUNDER,
|
|
||||||
textStyle:
|
|
||||||
GoogleFonts.poppins(
|
|
||||||
fontSize: 16,
|
|
||||||
letterSpacing: 0,
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontWeight: FontWeight.w300,
|
|
||||||
),
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
selectedBackgroundColor:
|
|
||||||
Color(0xFF00989E),
|
|
||||||
borderColor:
|
|
||||||
Color(0xFF00989E),
|
|
||||||
borderWidth: 1,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 80),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Welcome to Nhance",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
"Login with your mobile number and OTP to review and enroll for exciting health benefits for you and your family",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF000000)),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 55,
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
width: 1, color: Colors.grey),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 40,
|
|
||||||
child: TextField(
|
|
||||||
controller: countryController,
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.number,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"|",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 33,
|
|
||||||
color: Colors.grey),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: mobileController,
|
|
||||||
keyboardType: TextInputType.phone,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
hintText:
|
|
||||||
"Enter your mobile number",
|
|
||||||
),
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null ||
|
|
||||||
value.isEmpty) {
|
|
||||||
return 'Please enter your mobile number';
|
|
||||||
}
|
|
||||||
if (value.length != 10) {
|
|
||||||
return 'Mobile number must be 10 digits';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
inputFormatters: <TextInputFormatter>[
|
|
||||||
FilteringTextInputFormatter
|
|
||||||
.digitsOnly,
|
|
||||||
LengthLimitingTextInputFormatter(
|
|
||||||
10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
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: _isLoading
|
|
||||||
? null
|
|
||||||
: verifyMobileNumber,
|
|
||||||
child: _isLoading
|
|
||||||
? CircularProgressIndicator(
|
|
||||||
valueColor:
|
|
||||||
AlwaysStoppedAnimation<
|
|
||||||
Color>(
|
|
||||||
Color(0xFF00989E)),
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
"Login With OTP",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
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: GoogleFonts.poppins(
|
|
||||||
// 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: Responsive.isDesktop(context)
|
|
||||||
? _size.height * 0.3
|
|
||||||
: _size.height * 0.2,
|
|
||||||
),
|
|
||||||
// SizedBox(
|
|
||||||
// height: _size.height * 0.1,
|
|
||||||
// ),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: Container(
|
|
||||||
width: double
|
|
||||||
.infinity, // Make the footer full width
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
padding:
|
|
||||||
EdgeInsets.symmetric(vertical: 8),
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
text:
|
|
||||||
'By continuing, you agree with our ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
children: <TextSpan>[
|
|
||||||
TextSpan(
|
|
||||||
text: 'privacy policy ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'and ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'terms of use',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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.cover,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return SizedBox();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:csv/csv.dart';
|
import 'package:csv/csv.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
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';
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'dart:convert';
|
|||||||
import 'package:csv/csv.dart';
|
import 'package:csv/csv.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:dropdown_search/dropdown_search.dart';
|
import 'package:dropdown_search/dropdown_search.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
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';
|
||||||
@ -196,6 +195,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
getClaimPoliciesApi = Map<String, dynamic>.from(response['data']);
|
getClaimPoliciesApi = Map<String, dynamic>.from(response['data']);
|
||||||
});
|
});
|
||||||
|
logDebug('getClaimPoliciesApi $getClaimPoliciesApi');
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@ -312,8 +312,8 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
|
|
||||||
// Header
|
// Header
|
||||||
rows.add([
|
rows.add([
|
||||||
'Emp Name',
|
|
||||||
'Emp Code',
|
'Emp Code',
|
||||||
|
'Emp Name',
|
||||||
'Insured Name',
|
'Insured Name',
|
||||||
'Policy Type',
|
'Policy Type',
|
||||||
'Client Policy No',
|
'Client Policy No',
|
||||||
@ -327,8 +327,8 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
// Data rows
|
// Data rows
|
||||||
for (var item in data) {
|
for (var item in data) {
|
||||||
rows.add([
|
rows.add([
|
||||||
item['emp_name'] ?? '',
|
|
||||||
item['emp_code'] ?? '',
|
item['emp_code'] ?? '',
|
||||||
|
item['emp_name'] ?? '',
|
||||||
item['insured_name'] ?? '',
|
item['insured_name'] ?? '',
|
||||||
item['policy_type'] ?? '',
|
item['policy_type'] ?? '',
|
||||||
item['client_policy_no'] ?? '',
|
item['client_policy_no'] ?? '',
|
||||||
|
|||||||
@ -520,6 +520,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
|
|
||||||
// Header
|
// Header
|
||||||
rows.add([
|
rows.add([
|
||||||
|
'Emp Code',
|
||||||
'Name',
|
'Name',
|
||||||
'UHID',
|
'UHID',
|
||||||
'Relationship',
|
'Relationship',
|
||||||
@ -533,6 +534,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
// Data rows
|
// Data rows
|
||||||
for (var item in data) {
|
for (var item in data) {
|
||||||
rows.add([
|
rows.add([
|
||||||
|
item['emp_code'] ?? '',
|
||||||
item['name'] ?? '',
|
item['name'] ?? '',
|
||||||
item['uhid'] ?? '',
|
item['uhid'] ?? '',
|
||||||
item['relationship'] ?? '',
|
item['relationship'] ?? '',
|
||||||
@ -544,6 +546,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert to CSV string
|
// Convert to CSV string
|
||||||
String csvData = const ListToCsvConverter().convert(rows);
|
String csvData = const ListToCsvConverter().convert(rows);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'dart:convert';
|
|||||||
import 'package:csv/csv.dart';
|
import 'package:csv/csv.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:dropdown_search/dropdown_search.dart';
|
import 'package:dropdown_search/dropdown_search.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
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';
|
||||||
|
|||||||
@ -382,8 +382,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
Future<void> downloadPostSampleFile(String apiParam) async {
|
Future<void> downloadPostSampleFile(String apiParam) async {
|
||||||
logDebug("fun Sam f - in");
|
logDebug("fun Sam f - in");
|
||||||
|
|
||||||
final post_file_name = apiParam + '_sample_file.xlsx';
|
|
||||||
logDebug("fun Sam f - name $post_file_name");
|
|
||||||
final apiurl = Environment.apiUrlPost;
|
final apiurl = Environment.apiUrlPost;
|
||||||
final String url = '$apiurl/downloadSampleExcel/$apiParam';
|
final String url = '$apiurl/downloadSampleExcel/$apiParam';
|
||||||
final token = localToken;
|
final token = localToken;
|
||||||
@ -403,16 +401,38 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
try {
|
try {
|
||||||
logDebug("fun sam f - ${response.statusCode}");
|
logDebug("fun sam f - ${response.statusCode}");
|
||||||
|
|
||||||
|
final apiContentType = response.headers['content-type'] ?? '';
|
||||||
|
final contentDisposition = response.headers['content-disposition'] ?? '';
|
||||||
|
final excelContentType =
|
||||||
|
apiContentType.contains('spreadsheetml') ||
|
||||||
|
apiContentType.contains('ms-excel')
|
||||||
|
? apiContentType
|
||||||
|
: 'application/vnd.ms-excel';
|
||||||
|
final utf8FileNameMatch = RegExp(
|
||||||
|
"filename\\*=UTF-8''([^;]+)",
|
||||||
|
caseSensitive: false,
|
||||||
|
).firstMatch(contentDisposition);
|
||||||
|
final plainFileNameMatch = RegExp(
|
||||||
|
'filename="?([^";]+)"?',
|
||||||
|
caseSensitive: false,
|
||||||
|
).firstMatch(contentDisposition);
|
||||||
|
final rawFileName =
|
||||||
|
utf8FileNameMatch?.group(1) ?? plainFileNameMatch?.group(1);
|
||||||
|
final fileName =
|
||||||
|
rawFileName != null && rawFileName.trim().isNotEmpty
|
||||||
|
? Uri.decodeComponent(rawFileName.trim())
|
||||||
|
: '${apiParam}_sample_file.xlsx';
|
||||||
|
|
||||||
// ✅ Create a blob from the response body bytes
|
// ✅ Create a blob from the response body bytes
|
||||||
final blob = html.Blob([response.bodyBytes]);
|
final blob = html.Blob([response.bodyBytes], excelContentType);
|
||||||
|
|
||||||
// ✅ Generate a download URL
|
// ✅ Generate a download URL
|
||||||
final url = html.Url.createObjectUrlFromBlob(blob);
|
final url = html.Url.createObjectUrlFromBlob(blob);
|
||||||
|
|
||||||
// ✅ Trigger file download automatically
|
// ✅ Trigger file download with API-provided filename
|
||||||
final anchor = html.AnchorElement(href: url)
|
final anchor = html.AnchorElement(href: url);
|
||||||
..setAttribute('download', '$post_file_name')
|
anchor.setAttribute('download', fileName);
|
||||||
..click();
|
anchor.click();
|
||||||
|
|
||||||
// ✅ Revoke the URL to free memory
|
// ✅ Revoke the URL to free memory
|
||||||
html.Url.revokeObjectUrl(url);
|
html.Url.revokeObjectUrl(url);
|
||||||
@ -428,6 +448,60 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Future<void> downloadPostSampleFile(String apiParam) async {
|
||||||
|
// logDebug("fun Sam f - in");
|
||||||
|
//
|
||||||
|
// final apiurl = Environment.apiUrlPost;
|
||||||
|
// final String url = '$apiurl/downloadSampleExcel/$apiParam';
|
||||||
|
// final token = localToken;
|
||||||
|
//
|
||||||
|
// final response = await http.get(
|
||||||
|
// Uri.parse(url),
|
||||||
|
// headers: {
|
||||||
|
// 'APP-SIGNATURE':
|
||||||
|
// 'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
||||||
|
// 'Authorization': 'Bearer $token',
|
||||||
|
// 'Content-Type': 'application/json',
|
||||||
|
// // 'app-signature': 'ts-traveltool-2025-signature-123456',
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (response.statusCode == 200) {
|
||||||
|
// try {
|
||||||
|
// logDebug("fun sam f - ${response.statusCode}");
|
||||||
|
//
|
||||||
|
// final apiContentType = response.headers['content-type'] ?? '';
|
||||||
|
// final excelContentType =
|
||||||
|
// apiContentType.contains('spreadsheetml') ||
|
||||||
|
// apiContentType.contains('ms-excel')
|
||||||
|
// ? apiContentType
|
||||||
|
// : 'application/vnd.ms-excel';
|
||||||
|
//
|
||||||
|
// // ✅ Create a blob from the response body bytes
|
||||||
|
// final blob = html.Blob([response.bodyBytes], excelContentType);
|
||||||
|
//
|
||||||
|
// // ✅ Generate a download URL
|
||||||
|
// final url = html.Url.createObjectUrlFromBlob(blob);
|
||||||
|
//
|
||||||
|
// // ✅ Trigger file download without assigning filename
|
||||||
|
// final anchor = html.AnchorElement(href: url);
|
||||||
|
// anchor.setAttribute('download', '');
|
||||||
|
// anchor.click();
|
||||||
|
//
|
||||||
|
// // ✅ Revoke the URL to free memory
|
||||||
|
// html.Url.revokeObjectUrl(url);
|
||||||
|
//
|
||||||
|
// ToastHelper.showSuccessToast(context, 'File Downloaded Successfully');
|
||||||
|
// } catch (e) {
|
||||||
|
// logDebug("fun sam f - fail");
|
||||||
|
// throw Exception('Error parsing response: $e');
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// ToastHelper.showErrorToast(context, 'Failed to download');
|
||||||
|
// logDebug("Download failed with status: ${response.statusCode}");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
void _uploadFile() async {
|
void _uploadFile() async {
|
||||||
logDebug('Test');
|
logDebug('Test');
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
@ -585,7 +659,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
request.fields['file_action'] = selectedKey!;
|
request.fields['file_action'] = selectedKey!;
|
||||||
// request.fields['status'] = selectedKey!;
|
// request.fields['status'] = selectedKey!;
|
||||||
request.fields['created_by'] = empPrimaryId;
|
request.fields['created_by'] = empPrimaryId;
|
||||||
request.fields['policy_id'] = localClientBranchId;
|
request.fields['policy_id'] = localClientPolicyId;
|
||||||
// "client_id": 1,
|
// "client_id": 1,
|
||||||
// "client_branch_id": 2,
|
// "client_branch_id": 2,
|
||||||
// "policy_no": "POL123456",
|
// "policy_no": "POL123456",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
// import 'package:flutter/cupertino.dart';
|
// 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';
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:csv/csv.dart';
|
import 'package:csv/csv.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
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';
|
||||||
|
|||||||
824
lib/verify.dart
824
lib/verify.dart
@ -1,824 +0,0 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
|
||||||
import 'package:pinput/pinput.dart';
|
|
||||||
import 'dart:async';
|
|
||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
import 'package:nhancepolicy/responsive.dart';
|
|
||||||
import 'package:jwt_decode/jwt_decode.dart';
|
|
||||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
|
||||||
|
|
||||||
import 'config/environment.dart';
|
|
||||||
import 'package:nhancepolicy/logger.dart';
|
|
||||||
|
|
||||||
class MyVerify extends StatefulWidget {
|
|
||||||
final String verificationId;
|
|
||||||
final String mobileNumber;
|
|
||||||
final int? resendToken;
|
|
||||||
final Function(String, int?) onResendCode;
|
|
||||||
|
|
||||||
const MyVerify({
|
|
||||||
Key? key,
|
|
||||||
required this.verificationId,
|
|
||||||
required this.mobileNumber,
|
|
||||||
required this.resendToken,
|
|
||||||
required this.onResendCode,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MyVerify> createState() => _MyVerifyState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyVerifyState extends State<MyVerify> {
|
|
||||||
TextEditingController _otpController = TextEditingController();
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
|
||||||
late Timer _timer;
|
|
||||||
int _secondsRemaining = 30;
|
|
||||||
bool _isTimerRunning = false;
|
|
||||||
dynamic empCodeString;
|
|
||||||
dynamic empPrimaryId;
|
|
||||||
dynamic gpaEmpName;
|
|
||||||
dynamic client_id;
|
|
||||||
dynamic _token;
|
|
||||||
dynamic clientName;
|
|
||||||
dynamic clientLogo;
|
|
||||||
dynamic empClientBranchId;
|
|
||||||
late String verificationId;
|
|
||||||
late String mobileNumber;
|
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
|
||||||
bool _isLoading = false;
|
|
||||||
late String _verificationId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
checkTokenAvailability();
|
|
||||||
// Start the timer when the widget is initialized
|
|
||||||
verificationId = widget.verificationId;
|
|
||||||
mobileNumber = widget.mobileNumber;
|
|
||||||
logDebug('Received verificationId: $verificationId');
|
|
||||||
logDebug('Received mobileNumber: $mobileNumber');
|
|
||||||
if (verificationId.isEmpty) {
|
|
||||||
// Handle the case where verificationId is not provided
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
startTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_timer.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void startTimer() {
|
|
||||||
_isTimerRunning = true;
|
|
||||||
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
|
||||||
setState(() {
|
|
||||||
if (_secondsRemaining > 0) {
|
|
||||||
_secondsRemaining--;
|
|
||||||
} else {
|
|
||||||
_isTimerRunning = false;
|
|
||||||
_timer.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> checkTokenAvailability() async {
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
final String? token = prefs.getString('token');
|
|
||||||
|
|
||||||
if (token != null && token.isNotEmpty) {
|
|
||||||
// Token available, navigate to home page
|
|
||||||
Navigator.pushReplacementNamed(context, 'empDetails',
|
|
||||||
arguments: {'mobile': ''});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> resendOTP(String mobileNumber) async {
|
|
||||||
logDebug(mobileNumber);
|
|
||||||
// Update the UI as needed
|
|
||||||
setState(() {
|
|
||||||
_secondsRemaining = 30;
|
|
||||||
_isTimerRunning = true;
|
|
||||||
});
|
|
||||||
startTimer();
|
|
||||||
try {
|
|
||||||
final response = await http.post(
|
|
||||||
Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
|
||||||
body: json.encode({'mobile_number': mobileNumber}),
|
|
||||||
headers: {
|
|
||||||
'APP-SIGNATURE':
|
|
||||||
'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
// Handle successful response
|
|
||||||
ToastHelper.showSuccessToast(context, 'OTP resent successfully');
|
|
||||||
} else {
|
|
||||||
// Handle other response status codes
|
|
||||||
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
|
||||||
throw Exception('Failed to resend OTP');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Handle API call errors
|
|
||||||
logDebug('Error: $e');
|
|
||||||
ToastHelper.showErrorToast(
|
|
||||||
context, 'Failed to resend OTP. Please try again.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateToken(bool otpVerifyStatus) async {
|
|
||||||
// Retrieve the passed mobile number value
|
|
||||||
|
|
||||||
try {
|
|
||||||
final response = await http.post(
|
|
||||||
Uri.parse(Environment.apiUrl + 'getVerifiedUserData'),
|
|
||||||
body: json.encode({
|
|
||||||
'mobile_number': mobileNumber,
|
|
||||||
'otp_verification': otpVerifyStatus
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'APP-SIGNATURE':
|
|
||||||
'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
|
||||||
logDebug(data);
|
|
||||||
_token = data['data'];
|
|
||||||
String status = data['status'];
|
|
||||||
logDebug(status);
|
|
||||||
if (status == 'success') {
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.setString('token', data['data']);
|
|
||||||
|
|
||||||
// Decode the JWT token received from the API response
|
|
||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
|
||||||
logDebug(decodedToken);
|
|
||||||
empClientBranchId = decodedToken['client_branch_id'];
|
|
||||||
prefs.setString('empClientBranchId', empClientBranchId);
|
|
||||||
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);
|
|
||||||
|
|
||||||
getClientLogoAndDetails();
|
|
||||||
|
|
||||||
logDebug('Successfully Login');
|
|
||||||
|
|
||||||
// Redirect to another page
|
|
||||||
final token = prefs.getString('token');
|
|
||||||
if (token != null && token.isNotEmpty) {
|
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
|
||||||
Navigator.pushReplacementNamed(context, 'empDetails',
|
|
||||||
arguments: {'mobile': ''});
|
|
||||||
} else {
|
|
||||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
|
||||||
// For now, let's navigate to the login screen
|
|
||||||
ToastHelper.showErrorToast(context, 'Session Out');
|
|
||||||
Navigator.pushReplacementNamed(context, 'phone');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
|
||||||
// Show a Snackbar if the OTP is invalid
|
|
||||||
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
|
||||||
logDebug('Invalid OTP. Please try again');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToastHelper.showWarningToast(context, 'Something went wrong');
|
|
||||||
throw Exception('Failed to verify OTP');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
logDebug('Error: $e');
|
|
||||||
ToastHelper.showWarningToast(context, 'Something went wrong');
|
|
||||||
// Show a Snackbar if there's an error while verifying OTP
|
|
||||||
// ToastHelper.showErrorToast(
|
|
||||||
// context, 'Failed to verify OTP. Please try again.');
|
|
||||||
logDebug('Failed to verify OTP. Please try again.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void verifyOTP(String otp) async {
|
|
||||||
try {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = true;
|
|
||||||
});
|
|
||||||
PhoneAuthCredential credential = PhoneAuthProvider.credential(
|
|
||||||
verificationId: verificationId,
|
|
||||||
smsCode: otp,
|
|
||||||
);
|
|
||||||
|
|
||||||
await FirebaseAuth.instance
|
|
||||||
.signInWithCredential(credential)
|
|
||||||
.then((user) async {
|
|
||||||
if (user != null) {
|
|
||||||
// Handle successful verification
|
|
||||||
// ToastHelper.showSuccessToast(context, 'Successfully Login...!');
|
|
||||||
bool otpVerifyStatus = true;
|
|
||||||
generateToken(otpVerifyStatus);
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
logDebug('Error: $e');
|
|
||||||
ToastHelper.showErrorToast(
|
|
||||||
context, 'Failed to verify OTP. Please try again.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _resendOTP() {
|
|
||||||
setState(() {
|
|
||||||
_secondsRemaining = 60;
|
|
||||||
_isTimerRunning = true;
|
|
||||||
});
|
|
||||||
startTimer();
|
|
||||||
widget.onResendCode(widget.mobileNumber, widget.resendToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getClientLogoAndDetails() async {
|
|
||||||
var url = Uri.parse(Environment.apiUrl +
|
|
||||||
'getClientDetails?client_id=$client_id&emp_code=$empCodeString&client_branch_id=$empClientBranchId');
|
|
||||||
try {
|
|
||||||
var response = await http.get(
|
|
||||||
url,
|
|
||||||
headers: {
|
|
||||||
'APP-SIGNATURE':
|
|
||||||
'nhance-2025-signature-T8f6gV9k5fK2wf5V5c4vId3b0J8z6cAm2x8Y',
|
|
||||||
'Authorization':
|
|
||||||
'Bearer $_token', // Add token to the Authorization header
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
// logDebug('response.statusCode == 200');
|
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
|
||||||
// logDebug(data);
|
|
||||||
|
|
||||||
if (data.containsKey('data')) {
|
|
||||||
dynamic clientDetails = data['data'];
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.setString('clientLogo', clientDetails['client']['client_logo']);
|
|
||||||
prefs.setString('clientName', clientDetails['client']['client_name']);
|
|
||||||
setState(() {
|
|
||||||
// dynamic clientDetails = data['data'];
|
|
||||||
// logDebug(clientDetails);
|
|
||||||
clientName = clientDetails['client']['client_name'];
|
|
||||||
logDebug(clientName);
|
|
||||||
clientLogo = clientDetails['client']['client_logo'];
|
|
||||||
logDebug(clientLogo);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Handle other status messages if needed
|
|
||||||
// ToastHelper.showErrorToast(
|
|
||||||
// context, 'API request failed with status: ${data['status']}');
|
|
||||||
logDebug('API request failed with status: ${data['status']}');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Handle other status codes
|
|
||||||
// ToastHelper.showErrorToast(
|
|
||||||
// context, 'Request failed with status: ${response.statusCode}');
|
|
||||||
logDebug('Request failed with status: ${response.statusCode}');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Handle exceptions
|
|
||||||
logDebug('Exception occurred: $e');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// Retrieve the passed mobile number value
|
|
||||||
// final String mobileNumber =
|
|
||||||
// ModalRoute.of(context)!.settings.arguments as String;
|
|
||||||
Size _size = MediaQuery.of(context).size;
|
|
||||||
EdgeInsets marginInsets = EdgeInsets.zero;
|
|
||||||
if (Responsive.isDesktop(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
top: 0,
|
|
||||||
);
|
|
||||||
} else if (Responsive.isMobile(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 25, // Example value for mobile
|
|
||||||
right: 25, // Example value for mobile
|
|
||||||
bottom: 0, // Example value for mobile
|
|
||||||
top: 0, // Example value for mobile
|
|
||||||
);
|
|
||||||
} else if (Responsive.isTablet(context)) {
|
|
||||||
marginInsets = const EdgeInsets.only(
|
|
||||||
left: 25, // Example value for mobile
|
|
||||||
right: 25, // Example value for mobile
|
|
||||||
bottom: 0, // Example value for mobile
|
|
||||||
top: 0, // Example value for mobile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final defaultPinTheme = PinTheme(
|
|
||||||
width: 56,
|
|
||||||
height: 56,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: Color.fromRGBO(30, 60, 87, 1),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Color.fromRGBO(234, 239, 243, 1)),
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final focusedPinTheme = defaultPinTheme.copyDecorationWith(
|
|
||||||
border: Border.all(color: Color.fromRGBO(114, 178, 238, 1)),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
);
|
|
||||||
|
|
||||||
final submittedPinTheme = defaultPinTheme.copyWith(
|
|
||||||
decoration: defaultPinTheme.decoration?.copyWith(
|
|
||||||
color: Color.fromRGBO(234, 239, 243, 1),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
|
||||||
child: Container(
|
|
||||||
height: _size.height,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Visibility(
|
|
||||||
visible: _size.width <= 1100,
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
bottomLeft: Radius.circular(30),
|
|
||||||
bottomRight: Radius.circular(30),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
height: _size.height / 3,
|
|
||||||
width: double.infinity,
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: _size.height /
|
|
||||||
8.0), // 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(
|
|
||||||
'assets/mobileViewLogo.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: GoogleFonts.poppins(
|
|
||||||
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
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: marginInsets,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: _size.width < 1100 ? 6 : 12,
|
|
||||||
child: Container(
|
|
||||||
margin: _size.width > 1100
|
|
||||||
? EdgeInsets.only(left: 20, right: 20)
|
|
||||||
: EdgeInsets.only(left: 0, right: 0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
if (!Responsive.isMobile(context) &&
|
|
||||||
!Responsive.isTablet(context))
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 10,
|
|
||||||
child: Align(
|
|
||||||
alignment: Responsive.isDesktop(
|
|
||||||
context)
|
|
||||||
? Alignment.topLeft
|
|
||||||
: Alignment
|
|
||||||
.bottomCenter, // Align to the start
|
|
||||||
child: _size.width <= 1100
|
|
||||||
? Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final-mobile.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
)
|
|
||||||
: _size.width > 1100
|
|
||||||
? Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
)
|
|
||||||
: Image.asset(
|
|
||||||
'assets/Nhance-Logo-Final 1.png',
|
|
||||||
width: 150,
|
|
||||||
height: 70,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 80),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Welcome to Nhance",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
text:
|
|
||||||
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
height: 1.5,
|
|
||||||
color: Color(0xFF000000)),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: " (Change Number)",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(
|
|
||||||
0xFFE26728)), // Change color as desired
|
|
||||||
recognizer: TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
// Navigate to the page where the user can change the phone number
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, 'phone');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 15),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Pinput(
|
|
||||||
length: 6,
|
|
||||||
// defaultPinTheme: defaultPinTheme,
|
|
||||||
// focusedPinTheme: focusedPinTheme,
|
|
||||||
// submittedPinTheme: submittedPinTheme,
|
|
||||||
showCursor: true,
|
|
||||||
controller: _otpController,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment
|
|
||||||
.end, // Align text to the right
|
|
||||||
children: [
|
|
||||||
_isTimerRunning
|
|
||||||
? Text(
|
|
||||||
"Resend OTP in $_secondsRemaining seconds",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.black),
|
|
||||||
)
|
|
||||||
: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
_resendOTP();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
"Resend OTP",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
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: GoogleFonts.poppins(
|
|
||||||
color: Color(0xFFFFFFFF)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// _size.width > 1100
|
|
||||||
// ? Container(
|
|
||||||
// margin: EdgeInsets.symmetric(
|
|
||||||
// horizontal: 150),
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// SizedBox(height: 20),
|
|
||||||
// Text(
|
|
||||||
// "Benefits of Login",
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// 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",
|
|
||||||
// style: GoogleFonts
|
|
||||||
// .poppins()),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// padding: EdgeInsets
|
|
||||||
// .symmetric(
|
|
||||||
// vertical:
|
|
||||||
// 12),
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// Icon(Icons.edit,
|
|
||||||
// color: Color(
|
|
||||||
// 0xFFE26728)),
|
|
||||||
// SizedBox(
|
|
||||||
// height: 10),
|
|
||||||
// Text(
|
|
||||||
// "Manage Claims",
|
|
||||||
// style: GoogleFonts
|
|
||||||
// .poppins()),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : SizedBox(
|
|
||||||
// height:
|
|
||||||
// Responsive.isDesktop(context)
|
|
||||||
// ? _size.height * 0.1
|
|
||||||
// : _size.height * 0.2,
|
|
||||||
// ),
|
|
||||||
SizedBox(
|
|
||||||
height: Responsive.isDesktop(context)
|
|
||||||
? _size.height * 0.3
|
|
||||||
: _size.height * 0.2,
|
|
||||||
),
|
|
||||||
// SizedBox(
|
|
||||||
// height: _size.height * 0.1,
|
|
||||||
// ),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: Container(
|
|
||||||
width: double
|
|
||||||
.infinity, // Make the footer full width
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
padding:
|
|
||||||
EdgeInsets.symmetric(vertical: 8),
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
text:
|
|
||||||
'By continuing, you agree with our ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
children: <TextSpan>[
|
|
||||||
TextSpan(
|
|
||||||
text: 'privacy policy ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'and ',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'terms of use',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Color(0xFF00989E),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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.cover,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return SizedBox();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,10 +6,7 @@ import FlutterMacOS
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import file_picker
|
import file_picker
|
||||||
import firebase_auth
|
|
||||||
import firebase_core
|
|
||||||
import flutter_secure_storage_darwin
|
import flutter_secure_storage_darwin
|
||||||
import google_sign_in_ios
|
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
import smart_auth
|
import smart_auth
|
||||||
@ -17,10 +14,7 @@ import url_launcher_macos
|
|||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
|
||||||
FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin"))
|
FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin"))
|
||||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
|
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
|
||||||
|
|||||||
@ -54,9 +54,6 @@ dependencies:
|
|||||||
spreadsheet_decoder: ^2.2.0
|
spreadsheet_decoder: ^2.2.0
|
||||||
url_launcher: ^6.2.6
|
url_launcher: ^6.2.6
|
||||||
font_awesome_flutter: ^10.7.0
|
font_awesome_flutter: ^10.7.0
|
||||||
firebase_auth: ^5.1.2
|
|
||||||
google_sign_in: ^6.2.1
|
|
||||||
firebase_auth_web: ^5.12.4
|
|
||||||
archive: ^3.4.9
|
archive: ^3.4.9
|
||||||
dropdown_search: ^6.0.2
|
dropdown_search: ^6.0.2
|
||||||
flutter_secure_storage: ^10.0.0
|
flutter_secure_storage: ^10.0.0
|
||||||
|
|||||||
@ -93,30 +93,6 @@
|
|||||||
<div id="loading_indicator" class="container overlay">
|
<div id="loading_indicator" class="container overlay">
|
||||||
<img class="indicator" src="assets/nhance-loader.gif">
|
<img class="indicator" src="assets/nhance-loader.gif">
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
|
||||||
// Import the functions you need from the SDKs you need
|
|
||||||
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.4/firebase-app.js";
|
|
||||||
// TODO: Add SDKs for Firebase products that you want to use
|
|
||||||
// https://firebase.google.com/docs/web/setup#available-libraries
|
|
||||||
|
|
||||||
// Your web app's Firebase configuration
|
|
||||||
const firebaseConfig = {
|
|
||||||
apiKey: "AIzaSyCSvDM5fG2blDBE69Cae3S-iYRwwNBy7xo",
|
|
||||||
authDomain: "nhance-ee8d1.firebaseapp.com",
|
|
||||||
projectId: "nhance-ee8d1",
|
|
||||||
storageBucket: "nhance-ee8d1.firebasestorage.app",
|
|
||||||
messagingSenderId: "1084115316849",
|
|
||||||
appId: "1:1084115316849:web:ce28f12a426f285d6c6bd0"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize Firebase
|
|
||||||
const app = initializeApp(firebaseConfig);
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize Firebase
|
|
||||||
const app = initializeApp(firebaseConfig);
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('load', function(ev) {
|
window.addEventListener('load', function(ev) {
|
||||||
// Download main.dart.js
|
// Download main.dart.js
|
||||||
|
|||||||
@ -6,17 +6,11 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <firebase_auth/firebase_auth_plugin_c_api.h>
|
|
||||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
#include <smart_auth/smart_auth_plugin.h>
|
#include <smart_auth/smart_auth_plugin.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
FirebaseAuthPluginCApiRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi"));
|
|
||||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||||
SmartAuthPluginRegisterWithRegistrar(
|
SmartAuthPluginRegisterWithRegistrar(
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
firebase_auth
|
|
||||||
firebase_core
|
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
smart_auth
|
smart_auth
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user