This commit is contained in:
Rajshinde046
2024-04-10 13:14:49 +05:30
parent b08848730b
commit 07617c49b3
13 changed files with 858 additions and 726 deletions

View File

@@ -94,21 +94,6 @@ class _AddDetailsState extends State<AddDetails> {
if (resp.status == ResponseStatus.SUCCESS) {
Get.back();
Get.toNamed(RouteName.kyc);
// SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.setString('accessToken', resp.data["data"]["access-token"]);
// await prefs.setString('productType',
// resp.data["data"]["nature_of_business_id"].toString());
// naturebusiness =
// resp.data["data"]["nature_of_business_id"].toString();
// ProfileApi().GetProfileApi().then(
// (value) {
// Get.toNamed(RouteName.mainscreen);
// },
// );
// Get.to(() => CustomBottomBar(pageIndex: 0));
} else if (resp.status == ResponseStatus.PRIVATE) {
Get.back();
String? message = resp.data['message'];

File diff suppressed because it is too large Load Diff

View File

@@ -66,13 +66,16 @@ class _VerifyOTPState extends State<VerifyOTP> {
// ProfileApi().GetProfileApi().then(
// (value) {
isProfileUpdated == 0
? Get.toNamed(RouteName.adddetails)
: isKycUpdated == 0
? Get.toNamed(RouteName.kyc)
: isriskProfileUpdated == 0
? Get.toNamed(RouteName.updateriskprofile)
: Get.toNamed(RouteName.mainscreen);
Get.toNamed(RouteName.secureaccess);
// // isProfileUpdated == 0
// // ? Get.toNamed(RouteName.adddetails)
// // : isKycUpdated == 0
// // ? Get.toNamed(RouteName.kyc)
// // : isriskProfileUpdated == 0
// // ? Get.toNamed(RouteName.updateriskprofile)
// // : Get.toNamed(RouteName.mainscreen);
// Get.toNamed(RouteName.mainscreen);
// },
// );

View File

@@ -4,8 +4,10 @@ import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view/secureAccess.dart/faceIdScreen.dart';
class Faceid extends StatefulWidget {
const Faceid({super.key});
@@ -55,8 +57,14 @@ class _FaceidState extends State<Faceid> {
),
CommonBtn(
text: "Setup",
onTap: () {
Get.toNamed(RouteName.adddetails);
onTap: () async {
bool result = await LocalAuth.authenticate();
// Get.toNamed(RouteName.adddetails);
if (result) {
Get.toNamed(RouteName.adddetails);
} else {
Utils.showToast("msg");
}
},
)
],

View File

@@ -6,6 +6,7 @@ import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:local_auth/local_auth.dart';
class Fingerprint extends StatefulWidget {
const Fingerprint({super.key});
@@ -17,6 +18,40 @@ class Fingerprint extends StatefulWidget {
class _FingerprintState extends State<Fingerprint> {
Color primaryColor = Colors.transparent.withOpacity(0.2);
Color secondaryColor = Colors.grey.shade800;
bool? _hasBioSensor;
LocalAuthentication authentication = LocalAuthentication();
Future<void> _checkBio() async {
try {
_hasBioSensor = await authentication.canCheckBiometrics;
// print(_hasBioSensor);
if (_hasBioSensor!) {
_getAuth();
}
// ignore: empty_catches
} catch (e) {}
}
Future<void> _getAuth() async {
bool isAuth = false;
try {
isAuth = await authentication.authenticate(
localizedReason: 'localizedReason',
options: const AuthenticationOptions(
// biometricOnly: true,
useErrorDialogs: true,
stickyAuth: true,
),
);
if (isAuth) {
Get.toNamed(RouteName.adddetails);
}
print(isAuth);
// ignore: empty_catches
} catch (e) {}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -53,7 +88,8 @@ class _FingerprintState extends State<Fingerprint> {
CommonBtn(
text: "Setup",
onTap: () {
Get.toNamed(RouteName.adddetails);
_checkBio();
// Get.toNamed(RouteName.adddetails);
},
)
],

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@@ -7,6 +9,7 @@ import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view/secureAccess.dart/faceIdScreen.dart';
class SecureAccess extends StatefulWidget {
const SecureAccess({super.key});
@@ -42,212 +45,220 @@ class _SecureAccessState extends State<SecureAccess> {
SizedBox(
height: 30.h,
),
InkWell(
onTap: () {
Get.toNamed(RouteName.faceid);
},
child: GlassmorphicContainer(
width: double.infinity,
height: 80.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
border: 0,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff9A0000).withOpacity(0.5),
Color(0xFFffffff).withOpacity(0.5),
],
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SizedBox(
width: 10.w,
),
Image.asset(
"assets/images/png/face-id.png",
height: 40.h,
width: 40.w,
),
SizedBox(
width: 20.w,
),
text20W400(
"Face ID",
),
Platform.isIOS
? InkWell(
onTap: () {
// Get.to(LocalAuth());
Get.toNamed(RouteName.faceid);
},
child: GlassmorphicContainer(
width: double.infinity,
height: 80.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
border: 0,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff9A0000).withOpacity(0.5),
Color(0xFFffffff).withOpacity(0.5),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
SizedBox(
width: 20.w,
),
],
)
],
),
),
),
),
child: Center(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SizedBox(
width: 10.w,
),
Image.asset(
"assets/images/png/face-id.png",
height: 40.h,
width: 40.w,
),
SizedBox(
width: 20.w,
),
text20W400(
"Face ID",
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
SizedBox(
width: 20.w,
),
],
)
],
),
),
),
)
: SizedBox(),
SizedBox(
height: 20.h,
),
InkWell(
onTap: () {
Get.toNamed(RouteName.fingerprint);
},
child: GlassmorphicContainer(
width: double.infinity,
height: 80.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
border: 0,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff9A0000).withOpacity(0.5),
Color(0xFFffffff).withOpacity(0.5),
],
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SizedBox(
width: 10.w,
),
Image.asset(
"assets/images/png/fingerprint.png",
height: 40.h,
width: 40.w,
),
SizedBox(
width: 20.w,
),
text20W400("Fingerprint"),
Platform.isAndroid
? InkWell(
onTap: () {
Get.toNamed(RouteName.fingerprint);
},
child: GlassmorphicContainer(
width: double.infinity,
height: 80.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
border: 0,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff9A0000).withOpacity(0.5),
Color(0xFFffffff).withOpacity(0.5),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
SizedBox(
width: 20.w,
)
],
)
],
),
),
),
),
child: Center(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SizedBox(
width: 10.w,
),
Image.asset(
"assets/images/png/fingerprint.png",
height: 40.h,
width: 40.w,
),
SizedBox(
width: 20.w,
),
text20W400("Fingerprint"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
SizedBox(
width: 20.w,
)
],
)
],
),
),
),
)
: SizedBox(),
SizedBox(
height: 20.h,
),
InkWell(
onTap: () {
Get.toNamed(RouteName.pin);
},
child: GlassmorphicContainer(
width: double.infinity,
height: 80.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
]),
border: 0,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff9A0000).withOpacity(0.5),
Color(0xFFffffff).withOpacity(0.5),
],
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SizedBox(
width: 10.w,
),
Image.asset(
"assets/images/png/pin.png",
height: 40.h,
width: 40.w,
),
SizedBox(
width: 20.w,
),
text20W400("4 Digit Pin"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons.arrow_forward_ios,
color: Colors.white,
),
SizedBox(
width: 20.w,
)
],
),
],
),
),
),
),
// InkWell(
// onTap: () {
// Get.toNamed(RouteName.pin);
// },
// child: GlassmorphicContainer(
// width: double.infinity,
// height: 80.h,
// borderRadius: 8,
// linearGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Colors.white.withOpacity(0.1),
// Color(0xFFFFFFFF).withOpacity(0.05),
// ],
// stops: [
// 0.1,
// 1,
// ]),
// border: 0,
// blur: 10,
// borderGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Color(0xff9A0000).withOpacity(0.5),
// Color(0xFFffffff).withOpacity(0.5),
// ],
// ),
// child: Center(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Row(
// children: [
// SizedBox(
// width: 10.w,
// ),
// Image.asset(
// "assets/images/png/pin.png",
// height: 40.h,
// width: 40.w,
// ),
// SizedBox(
// width: 20.w,
// ),
// text20W400("4 Digit Pin"),
// ],
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// Icon(
// Icons.arrow_forward_ios,
// color: Colors.white,
// ),
// SizedBox(
// width: 20.w,
// )
// ],
// ),
// ],
// ),
// ),
// ),
// ),
SizedBox(
height: 250.h,
),

View File

@@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
class LocalAuth {
static final _auth = LocalAuthentication();
static Future<bool> _canAthenticate() async =>
await _auth.canCheckBiometrics || await _auth.isDeviceSupported();
static Future<bool> authenticate() async {
try {
if (!await _canAthenticate()) return false;
return await _auth.authenticate(
localizedReason: 'Use Fingerprint or Face Id to authenticate',
options: const AuthenticationOptions(
biometricOnly: true,
useErrorDialogs: true,
stickyAuth: true,
),
// authMessages: <AuthMessages>[
// AndroidAuthMessages(
// signInTitle: 'Oops! Biometric authentication required!',
// cancelButton: 'No thanks',
// ),
// IOSAuthMessages(
// cancelButton: 'No thanks',
// ),
// ],
);
// final bool didAuthenticate = await _auth.authenticate(
// localizedReason: 'Please authenticate to show account balance',
// authMessages: const <AuthMessages>[
// AndroidAuthMessages(
// signInTitle: 'Oops! Biometric authentication required!',
// cancelButton: 'No thanks',
// ),
// IOSAuthMessages(
// cancelButton: 'No thanks',
// ),
// ]);
} catch (e) {
debugPrint('error $e');
return false;
}
}
}