login flow inprogress
parent
61d10068ca
commit
ba2c8327fe
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@ -0,0 +1,136 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||||
|
|
||||||
|
class QuickLogin extends StatefulWidget {
|
||||||
|
final VoidCallback onPressed;
|
||||||
|
final bool isDone;
|
||||||
|
|
||||||
|
const QuickLogin({super.key, required this.onPressed, this.isDone = false});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_QuickLogin createState() => _QuickLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QuickLogin extends State<QuickLogin> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(24),
|
||||||
|
topRight: Radius.circular(24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
widget.isDone
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
},
|
||||||
|
child: Utils.buildSvgWithAssets(icon: AppAssets.cross_circle)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Utils.showLottie(context: context, assetPath: AppAnimations.checkmark, width: 120, height: 120, repeat: true),
|
||||||
|
LocaleKeys.allSet.tr().toText16(textAlign:
|
||||||
|
TextAlign.center, weight: FontWeight.w500)
|
||||||
|
// Text(
|
||||||
|
// ' TranslationBase.of(context).allSet',
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// style: context.dynamicTextStyle(
|
||||||
|
// fontSize: 16,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// color: Colors.black,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
AppAssets.lockIcon,
|
||||||
|
height: 101,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
LocaleKeys.enableQuickLogin.tr().toText26(isBold: true),
|
||||||
|
// Text(
|
||||||
|
// ' TranslationBase.of(context).enableQuickLogin',
|
||||||
|
// style: context.dynamicTextStyle(
|
||||||
|
// fontSize: 26,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// color: Colors.black,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
LocaleKeys.enableQuickLogin.tr().toText16(color: AppColors.quickLoginColor),
|
||||||
|
// Description
|
||||||
|
// Text(
|
||||||
|
// 'TranslationBase.of(context).enableMsg',
|
||||||
|
// style: context.dynamicTextStyle(
|
||||||
|
// fontSize: 16,
|
||||||
|
// color: Color(0xFF666666),
|
||||||
|
// height: 1.5,
|
||||||
|
// ),
|
||||||
|
//),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
// Buttons
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
text:LocaleKeys.enableQuickLogin.tr(),
|
||||||
|
onPressed: () {
|
||||||
|
widget.onPressed();
|
||||||
|
},
|
||||||
|
backgroundColor: Color(0xffED1C2B),
|
||||||
|
borderColor: Color(0xffED1C2B),
|
||||||
|
textColor: Colors.white,
|
||||||
|
icon:AppAssets.apple_finder,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
text: LocaleKeys.notNow.tr(),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
},
|
||||||
|
backgroundColor: Color(0xffFEE9EA),
|
||||||
|
borderColor: Color(0xffFEE9EA),
|
||||||
|
textColor: Colors.red,
|
||||||
|
// icon: "assets/images/svg/apple-finder.svg",
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
|
||||||
|
class WelcomeWidget extends StatelessWidget {
|
||||||
|
final String name;
|
||||||
|
final String imageUrl;
|
||||||
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
const WelcomeWidget({
|
||||||
|
super.key,
|
||||||
|
required this.name,
|
||||||
|
required this.imageUrl,
|
||||||
|
this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// Profile image
|
||||||
|
|
||||||
|
Image.asset(imageUrl, width: 40, height: 40),
|
||||||
|
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
|
||||||
|
// Text column
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
|
||||||
|
"Welcome".toText14(color: AppColors.greyTextColor),
|
||||||
|
|
||||||
|
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
|
||||||
|
name.toText16(isBold: true),
|
||||||
|
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
const Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.black),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
import 'package:local_auth/local_auth.dart';
|
||||||
|
|
||||||
|
import 'logger_service.dart';
|
||||||
|
|
||||||
|
class LocalAuthService {
|
||||||
|
final LocalAuthentication localAuth;
|
||||||
|
final LoggerService loggerService;
|
||||||
|
LocalAuthService({required this.localAuth, required this.loggerService});
|
||||||
|
|
||||||
|
Future<bool> authenticate() async {
|
||||||
|
try {
|
||||||
|
bool isAuthenticated = await localAuth.authenticate(
|
||||||
|
localizedReason: 'Please authenticate to proceed',
|
||||||
|
options: const AuthenticationOptions(
|
||||||
|
biometricOnly: true,
|
||||||
|
stickyAuth: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return isAuthenticated;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> canCheckBiometrics() async {
|
||||||
|
try {
|
||||||
|
return await localAuth.canCheckBiometrics;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<BiometricType>> getAvailableBiometrics() async {
|
||||||
|
try {
|
||||||
|
return await localAuth.getAvailableBiometrics();
|
||||||
|
} catch (e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue