105 lines
3.1 KiB
Dart
105 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
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/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});
|
|
|
|
@override
|
|
State<Fingerprint> createState() => _FingerprintState();
|
|
}
|
|
|
|
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(
|
|
appBar: CommonAppbar(titleTxt: "Secure your access"),
|
|
backgroundColor: Colors.black,
|
|
extendBody: true,
|
|
body: Stack(
|
|
children: [
|
|
CommonBlurLeft(),
|
|
CommonBlurRight(),
|
|
Stack(
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
child: ListView(
|
|
physics: BouncingScrollPhysics(),
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
text18W400("Quickly set up Fingerprint for secure access."),
|
|
SizedBox(
|
|
height: 180.h,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset("assets/images/png/fingerprint.png"),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 180.h,
|
|
),
|
|
CommonBtn(
|
|
text: "Setup",
|
|
onTap: () {
|
|
_checkBio();
|
|
// Get.toNamed(RouteName.adddetails);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|