diff --git a/assets/images/done_dummy.jpeg b/assets/images/done_dummy.jpeg new file mode 100644 index 00000000..31829913 Binary files /dev/null and b/assets/images/done_dummy.jpeg differ diff --git a/assets/images/nfc_dummy.png b/assets/images/nfc_dummy.png new file mode 100644 index 00000000..cf7e289f Binary files /dev/null and b/assets/images/nfc_dummy.png differ diff --git a/lib/new_views/app_style/app_color.dart b/lib/new_views/app_style/app_color.dart index 92bfaa11..9533abfd 100644 --- a/lib/new_views/app_style/app_color.dart +++ b/lib/new_views/app_style/app_color.dart @@ -10,6 +10,8 @@ class AppColor { static const Color primary50 = Color(0xff4A8DB7); static const Color primary60 = Color(0xff3B7097); static const Color primary70 = Color(0xff163A51); + //#3DA5E5 + static const Color primary80 = Color(0xff3DA5E5); //texts static const Color neutral10 = Color(0xffBCBCBC); diff --git a/lib/new_views/forget_password_module/forget_passwod_verify_otp.dart b/lib/new_views/forget_password_module/forget_passwod_verify_otp.dart index 7f25d7b0..cc841dcb 100644 --- a/lib/new_views/forget_password_module/forget_passwod_verify_otp.dart +++ b/lib/new_views/forget_password_module/forget_passwod_verify_otp.dart @@ -1,131 +1,4 @@ -// import 'package:flutter/material.dart'; -// import 'package:pinput/pinput.dart'; -// import 'package:provider/provider.dart'; -// import 'package:test_sa/controllers/providers/api/user_provider.dart'; -// import 'package:test_sa/extensions/context_extension.dart'; -// import 'package:test_sa/extensions/int_extensions.dart'; -// import 'package:test_sa/extensions/text_extensions.dart'; -// import 'package:test_sa/extensions/widget_extensions.dart'; -// import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; -// import 'package:test_sa/new_views/forget_password_module/models/general_response_model.dart'; -// import 'package:test_sa/new_views/app_style/app_color.dart'; -// import 'package:test_sa/new_views/forget_password_module/reset_password_view.dart'; -// -// class ForgetPasswordVerifyOtpView extends StatelessWidget { -// static const String routeName = "/verify_otp"; -// String otp = ''; -// ForgetPasswordVerifyOtpView({Key key}) : super(key: key); -// @override -// Widget build(BuildContext context) { -// final defaultPinTheme = PinTheme( -// width: 68.toScreenWidth, -// height: 86.toScreenHeight, -// textStyle: const TextStyle( -// fontSize: 22, -// color: Colors.black, -// ), -// decoration: BoxDecoration( -// color: AppColor.white, -// borderRadius: BorderRadius.circular(15), -// border: Border.all(color: AppColor.white10, width: 1), -// ), -// ); -// return Scaffold( -// body: Column( -// children: [ -// SingleChildScrollView( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// context.translation.otpVerification.heading2(context).custom(color: AppColor.neutral80, fontWeight: FontWeight.w500), -// 8.height, -// '${context.translation.pleaseEnterTheOtpSentTo} 8997987979879'.bodyText2(context).custom(color: AppColor.white20, fontWeight: FontWeight.w500), -// 40.height, -// Center( -// child: Pinput( -// length: 4, -// defaultPinTheme: defaultPinTheme, -// focusedPinTheme: defaultPinTheme.copyWith( -// decoration: defaultPinTheme.decoration?.copyWith( -// border: Border.all(color: AppColor.white10, width: 1), -// ), -// ), -// onCompleted: (pin) async { -// otp = pin; -// }, -// ), -// ), -// -// Row( -// children: [ -// 'resend'.bodyText2(context).custom(color: AppColor.black35), -// 7.width, -// ValueListenableBuilder( -// //add actual timer value... -// valueListenable: ValueNotifier("0:00"), -// builder: (context, value, _) { -// return Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// value.bodyText2(context).custom( -// color: context.isDark ? AppColor.neutral10 : AppColor.neutral10, -// ), -// ], -// ); -// }, -// ), -// 7.width, -// InkWell( -// onTap: () async { -// UserProvider _userProvider = Provider.of(context, listen: false); -// String employeeId = ''; -// if (_userProvider.user != null && _userProvider.user.userName != null) { -// employeeId = _userProvider.user.userName; -// } else { -// employeeId = 'OUT3893'; -// } -// GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: employeeId); -// // if(response.isSuccess){ -// // Navigator.push(context, MaterialPageRoute(builder: (context)=>ForgetPasswordVerifyOtpView())); -// // // Navigator.push(context, ForgetPasswordVerifyOtpView.routeName); -// // }else{ -// // Fluttertoast.showToast(msg: response?.message ?? context.translation.failedToCompleteRequest); -// // } -// print('response of send otp i got is ${response.toJson()}'); -// }, -// child: Text( -// 'resend', -// style: TextStyle( -// color: AppColor.primary30, -// fontWeight: FontWeight.w500, -// fontSize: 12.toScreenWidth, -// decorationColor: AppColor.primary30, -// decoration: TextDecoration.underline, -// ), -// ), -// ), -// ], -// ), -// ], -// ), -// ).center.expanded, -// AppFilledButton(label: context.translation.verify, maxWidth: true, onPressed: () async { -// if(otp.isNotEmpty){ -// UserProvider _userProvider = Provider.of(context, listen: false); -// GeneralResponseModel generalResponseModel = await _userProvider.forgetPasswordValidateOtp(context: context, employeeId: 'OUT3893', otp: otp); -// if (generalResponseModel.isSuccess) { -// Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => ResetPasswordView())); -// } -// } -// -// }), -// ], -// ).paddingOnly(start: 20,end: 20,bottom: 16), -// ); -// } -// } + import 'dart:async'; import 'package:flutter/material.dart'; @@ -143,9 +16,9 @@ import 'package:test_sa/new_views/forget_password_module/reset_password_view.dar class ForgetPasswordVerifyOtpView extends StatefulWidget { static const String routeName = "/verify_otp"; - String employeeId = ''; + Map data={}; - ForgetPasswordVerifyOtpView({Key key,this.employeeId}) : super(key: key); + ForgetPasswordVerifyOtpView({Key key,@required this.data}) : super(key: key); @override State createState() => _ForgetPasswordVerifyOtpViewState(); @@ -213,7 +86,7 @@ class _ForgetPasswordVerifyOtpViewState extends State(context, listen: false); - String employeeId = widget.employeeId; + String employeeId = widget.data['employeeId']; GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp( context: context, employeeId: employeeId, @@ -285,7 +159,7 @@ class _ForgetPasswordVerifyOtpViewState extends State(context, listen: false); GeneralResponseModel generalResponseModel = await _userProvider.forgetPasswordValidateOtp( context: context, - employeeId:widget.employeeId, + employeeId:widget.data['employeeId'], otp: otp, ); if (generalResponseModel.isSuccess) { diff --git a/lib/new_views/pages/land_page/land_page.dart b/lib/new_views/pages/land_page/land_page.dart index 30e3a0f1..24cfb523 100644 --- a/lib/new_views/pages/land_page/land_page.dart +++ b/lib/new_views/pages/land_page/land_page.dart @@ -197,40 +197,28 @@ class _LandPageState extends State { isNfcSupported = await NfcManager.instance.isAvailable(); SwipeGeneralUtils.showSwipeTypeBottomSheetSheet(context: context, isNfcSupported: isNfcSupported); }, - child: CircularAnimationWithProgressIndicator( - child: Container( - width: 100.toScreenWidth, - height: 100.toScreenHeight, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: AppColor.white, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 'swipe'.toSvgAsset(width: 32, height: 32), - 8.height, - Text( - ("${context.translation.checkIn}\n${userProvider.swipeTransactionModel != null && userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime) : '--:--'}"), - style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral80, fontWeight: FontWeight.w500, fontFamily: "Poppins"), - ), + child: CircularAnimatedContainer(child: Container( + width: 100.toScreenWidth, + height: 100.toScreenHeight, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.white, + border: Border.all(color: AppColor.primary80.withOpacity(0.5), width: 2), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 'swipe'.toSvgAsset(width: 32, height: 32), + 8.height, + Text( + ("${context.translation.checkIn}\n${userProvider.swipeTransactionModel != null && userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime) : '--:--'}"), + style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral80, fontWeight: FontWeight.w500, fontFamily: "Poppins"), + ), - // (context.translation.checkIn + - // "\n" + - // (userProvider.swipeTransactionModel != null && userProvider.swipeTransactionModel.swipeTime != null - // ? SwipeGeneralUtils.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime) - // : '--:--')) - // .bodyText2(context) - // .custom(color: AppColor.neutral80), - // 8.height, - // userProvider.swipeTransactionModel != null && userProvider.swipeTransactionModel.swipeTime != null - // ? SwipeGeneralUtils.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime).bodyText2(context).custom(color: AppColor.neutral80) - // : '--:--'.bodyText(context).custom(color: AppColor.neutral80), - ], - ), + ], ), - ), + ),), ), ), ], diff --git a/lib/new_views/pages/login_page.dart b/lib/new_views/pages/login_page.dart index 06ce38b3..7eea1566 100644 --- a/lib/new_views/pages/login_page.dart +++ b/lib/new_views/pages/login_page.dart @@ -135,7 +135,7 @@ class _LoginPageState extends State { if(userNameController.text.isNotEmpty){ GeneralResponseModel response = await _userProvider.sendForgetPasswordOtp(context: context, employeeId: userNameController.text); if(response.isSuccess){ - Navigator.push(context, MaterialPageRoute(builder: (context)=>ForgetPasswordVerifyOtpView(employeeId:userNameController.text,))); + Navigator.push(context, MaterialPageRoute(builder: (context)=>ForgetPasswordVerifyOtpView(data: {'employeeId':userNameController.text,'phoneNumber':response.data},))); // Navigator.push(context, ForgetPasswordVerifyOtpView.routeName); }else{ Fluttertoast.showToast(msg: response?.message ?? context.translation.failedToCompleteRequest); diff --git a/lib/new_views/swipe_module/swipe_success_view.dart b/lib/new_views/swipe_module/swipe_success_view.dart index 8de8d847..a5bd91f1 100644 --- a/lib/new_views/swipe_module/swipe_success_view.dart +++ b/lib/new_views/swipe_module/swipe_success_view.dart @@ -95,6 +95,98 @@ class _CircularAnimationWithProgressIndicatorState } } +class CircularAnimatedContainer extends StatefulWidget { + Widget child; + + CircularAnimatedContainer({Key key, @required this.child}) : super(key: key); + @override + _CircularAnimatedContainerState createState() => _CircularAnimatedContainerState(); +} + +class _CircularAnimatedContainerState extends State + with SingleTickerProviderStateMixin { + AnimationController _controller; + Animation _animation; + + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: const Duration(seconds: 2), + vsync: this, + )..repeat(); + + _animation = CurvedAnimation( + parent: _controller, + curve: Curves.easeInOut, // Applies the ease-in-out effect + ); + // Repeats animation + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Stack( + alignment: Alignment.center, + children: [ + widget.child, + AnimatedBuilder( + animation: _animation, + builder: (context, child) { + return CustomPaint( + painter: CircularProgressPainter( + progress: _animation.value), + size: Size(100.toScreenHeight, 100.toScreenWidth), + ); + }, + ), + ], + ), + ); + } +} + +class CircularProgressPainter extends CustomPainter { + final double progress; + + CircularProgressPainter({@required this.progress}); + + @override + void paint(Canvas canvas, Size size) { + final Paint paint = Paint() + ..color = AppColor.primary80 + ..style = PaintingStyle.stroke + ..strokeWidth = 3 + ..strokeCap = StrokeCap.round; + + final center = Offset(size.width / 2, size.height / 2); + final radius = size.width / 2.05; + // final double startAngle = 2 * 3.141592653589793 * progress; + final double sweepAngle = 2 * 3.141592653589793 * progress; + const double startAngle = -90 * (3.141592653589793 / 180); + // final double sweepAngle = 2.05 * 3.141592653589793 * progress; + + canvas.drawArc( + Rect.fromCircle(center: center, radius: radius), + startAngle, + sweepAngle, + false, + paint, + ); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; + } +} // ClipOval( // child: Container(