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