add swipe and forget password functionality ready for initial test

main_design2.1
WaseemAbbasi22 1 year ago
parent 9c4151a0fc
commit d1e8760e90

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

@ -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);

@ -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<String>(
// //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<UserProvider>(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<UserProvider>(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<String,dynamic> data={};
ForgetPasswordVerifyOtpView({Key key,this.employeeId}) : super(key: key);
ForgetPasswordVerifyOtpView({Key key,@required this.data}) : super(key: key);
@override
State<ForgetPasswordVerifyOtpView> createState() => _ForgetPasswordVerifyOtpViewState();
@ -213,7 +86,7 @@ class _ForgetPasswordVerifyOtpViewState extends State<ForgetPasswordVerifyOtpVie
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),
'${context.translation.pleaseEnterTheOtpSentTo} ${widget.data['phoneNumber']}'.bodyText2(context).custom(color: AppColor.white20, fontWeight: FontWeight.w500),
40.height,
Center(
child: Pinput(
@ -229,6 +102,7 @@ class _ForgetPasswordVerifyOtpViewState extends State<ForgetPasswordVerifyOtpVie
otp = pin;
});
verifyOtp();
},
),
),
@ -240,7 +114,7 @@ class _ForgetPasswordVerifyOtpViewState extends State<ForgetPasswordVerifyOtpVie
onTap: _remainingSeconds == 0
? () async {
UserProvider _userProvider = Provider.of<UserProvider>(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<ForgetPasswordVerifyOtpVie
UserProvider _userProvider = Provider.of<UserProvider>(context, listen: false);
GeneralResponseModel generalResponseModel = await _userProvider.forgetPasswordValidateOtp(
context: context,
employeeId:widget.employeeId,
employeeId:widget.data['employeeId'],
otp: otp,
);
if (generalResponseModel.isSuccess) {

@ -197,40 +197,28 @@ class _LandPageState extends State<LandPage> {
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),
],
),
],
),
),
),),
),
),
],

@ -135,7 +135,7 @@ class _LoginPageState extends State<LoginPage> {
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);

@ -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<CircularAnimatedContainer>
with SingleTickerProviderStateMixin {
AnimationController _controller;
Animation<double> _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(

Loading…
Cancel
Save