Merge pull request #27 from WDI-Ideas/splash

changes
This commit is contained in:
Raj
2024-04-10 13:21:22 +05:30
committed by GitHub
13 changed files with 862 additions and 725 deletions

View File

@@ -1,6 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.traderscircuit">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.USE_BIOMETRIC"/>
<application
android:label="Traders Circuit"
android:name="${applicationName}"

View File

@@ -1,6 +1,7 @@
package com.example.traderscircuit
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterActivity() {
class MainActivity: FlutterFragmentActivity() {
// ...
}

View File

@@ -15,6 +15,9 @@ class ApiUrls {
//add details
static String AddDetails = "${base}userDetails";
//add kyc
static String AddKyc = "${base}addUserKYC";
// About API
static String aboutUsApi = "${base}aboutUs";

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

@@ -68,13 +68,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;
}
}
}

View File

@@ -0,0 +1,27 @@
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';
class AddKycAPI {
AddKycAPI(this.data);
var data;
Future<ResponseData<dynamic>> addkycApi() async {
final response = await NetworkApiServices().postApi(
// optionalpar: true,
data,
ApiUrls.AddKyc,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
print("token is $response");
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -512,6 +512,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.4"
intl:
dependency: transitive
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
js:
dependency: transitive
description:
@@ -528,6 +536,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
local_auth:
dependency: "direct main"
description:
name: local_auth
sha256: "280421b416b32de31405b0a25c3bd42dfcef2538dfbb20c03019e02a5ed55ed0"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
local_auth_android:
dependency: transitive
description:
name: local_auth_android
sha256: "3bcd732dda7c75fcb7ddaef12e131230f53dcc8c00790d0d6efb3aa0fbbeda57"
url: "https://pub.dev"
source: hosted
version: "1.0.37"
local_auth_darwin:
dependency: transitive
description:
name: local_auth_darwin
sha256: "33381a15b0de2279523eca694089393bb146baebdce72a404555d03174ebc1e9"
url: "https://pub.dev"
source: hosted
version: "1.2.2"
local_auth_platform_interface:
dependency: transitive
description:
name: local_auth_platform_interface
sha256: "1b842ff177a7068442eae093b64abe3592f816afd2a533c0ebcdbe40f9d2075a"
url: "https://pub.dev"
source: hosted
version: "1.0.10"
local_auth_windows:
dependency: transitive
description:
name: local_auth_windows
sha256: "505ba3367ca781efb1c50d3132e44a2446bccc4163427bc203b9b4d8994d97ea"
url: "https://pub.dev"
source: hosted
version: "1.0.10"
lottie:
dependency: "direct main"
description:
@@ -1095,5 +1143,7 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.13.0"
dart: ">=3.2.3 <4.0.0"
flutter: ">=3.16.6"

View File

@@ -39,9 +39,13 @@ dependencies:
firebase_core:
dio: ^5.1.2
expansion_tile_group: ^1.2.4
local_auth: ^2.2.0
scgateway_flutter_plugin: ^2.3.1
async: ^2.4.1
dev_dependencies:
flutter_test:
sdk: flutter