282 lines
11 KiB
Dart
282 lines
11 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:glassmorphism/glassmorphism.dart';
|
|
import 'package:pin_code_fields/pin_code_fields.dart';
|
|
import 'package:regroup/Common/base_manager.dart';
|
|
|
|
import 'package:regroup/Global.dart';
|
|
|
|
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
|
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
|
import 'package:regroup/Utils/Common/blureffect.dart';
|
|
import 'package:regroup/Utils/Common/sized_box.dart';
|
|
import 'package:regroup/Utils/dialogs.dart';
|
|
import 'package:regroup/Utils/texts.dart';
|
|
|
|
import 'package:regroup/onboarding/Signup/view_model/postmethod.dart';
|
|
import 'package:regroup/resources/routes/route_name.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:timer_button/timer_button.dart';
|
|
|
|
class VerifyuserScreenState extends StatefulWidget {
|
|
const VerifyuserScreenState({super.key});
|
|
|
|
@override
|
|
State<VerifyuserScreenState> createState() => _VerifyuserScreenStateState();
|
|
}
|
|
|
|
class _VerifyuserScreenStateState extends State<VerifyuserScreenState> {
|
|
// String accounttype = Get.arguments;
|
|
|
|
TextEditingController pincode = TextEditingController();
|
|
|
|
String email = Get.arguments['emailid'];
|
|
String userpassword = Get.arguments['password'];
|
|
String accounttype = Get.arguments['accounttype'];
|
|
int accounttypenumber = Get.arguments["accountypenumber"];
|
|
|
|
Uploadata() async {
|
|
utils.loader();
|
|
Map<String, dynamic> updata = {
|
|
"email_address": email,
|
|
"password": userpassword,
|
|
"account_type": accounttypenumber,
|
|
"otp": pincode.text
|
|
};
|
|
final data = await Onboard().Postverifyregisteration(updata);
|
|
if (data.status == ResponseStatus.SUCCESS) {
|
|
Get.back();
|
|
print("verification done");
|
|
|
|
if (accounttype == 'Individual') {
|
|
print('individual selected');
|
|
Get.toNamed(RouteName.tellusindividualscreen,
|
|
// arguments: {
|
|
// 'pageroute' : "nextscreen"
|
|
// }
|
|
);
|
|
} else if (accounttype == 'Business') {
|
|
print('business selected');
|
|
Get.toNamed(RouteName.tellusbusinessscreen,
|
|
// arguments: {
|
|
// 'pageroute' : "nextscreen"
|
|
// }
|
|
);
|
|
}
|
|
|
|
return utils.showToast(data.message);
|
|
}
|
|
else {
|
|
// btnController.error();
|
|
// btnController.reset();
|
|
Get.snackbar(
|
|
"Error!",
|
|
data.data['message'],
|
|
duration: Duration(seconds: 2),
|
|
colorText: Colors.white,
|
|
backgroundColor: Colors.red,
|
|
margin: EdgeInsets.all(8),
|
|
snackStyle: SnackStyle.FLOATING,
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
);
|
|
}
|
|
// else {
|
|
// Get.back();
|
|
// print("verification not done");
|
|
// return utils.showToast(data.message);
|
|
// }
|
|
}
|
|
|
|
Uploadataresendotp() async {
|
|
utils.loader();
|
|
Map<String, dynamic> updata = {
|
|
"email_address": email,
|
|
"password": userpassword,
|
|
"account_type": accounttypenumber,
|
|
};
|
|
final data = await Onboard().Postregisteration(updata);
|
|
if (data.status == ResponseStatus.SUCCESS) {
|
|
Get.back();
|
|
print("resend up done");
|
|
return utils.showToast(data.message);
|
|
} else {
|
|
Get.back();
|
|
print("resend not done");
|
|
return utils.showToast(data.message);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Color.fromARGB(255, 18, 32, 47),
|
|
appBar: CommonAppbar(
|
|
titleTxt: '',
|
|
),
|
|
body: Stack(
|
|
children: [
|
|
// CommonBlurLeftSecond(),
|
|
Positioned(top: 150, right: -30, child: CommonBlurRightSecond()),
|
|
Positioned(top: 350, left: -30, child: CommonBlurLeftBlue()),
|
|
GlassmorphicContainer(
|
|
width: MediaQuery.of(context).size.width,
|
|
height:
|
|
// 500.h,
|
|
MediaQuery.of(context).size.height,
|
|
borderRadius: 2,
|
|
blur: 6,
|
|
alignment: Alignment.bottomLeft,
|
|
border: 2,
|
|
linearGradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
],
|
|
),
|
|
borderGradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
// Color.fromARGB(255, 18, 32, 47).withOpacity(0.50),
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
|
|
Color(0XFF222935).withOpacity(0.60),
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
sizedBoxHeight(20.h),
|
|
text22400white('Check your email'),
|
|
sizedBoxHeight(10.h),
|
|
text14400white(
|
|
'Enter the verification code that we sent to $email'),
|
|
sizedBoxHeight(40.h),
|
|
text16400white('Enter code'),
|
|
sizedBoxHeight(20.h),
|
|
PinCodeTextField(
|
|
validator: (value) {
|
|
if (value != null && value.isEmpty) {
|
|
return "Please Enter verification code";
|
|
} else if (value != null && value.length < 4) {
|
|
return "OTP length should be at least 4";
|
|
}
|
|
return null;
|
|
},
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
|
],
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
length: 4,
|
|
obscureText: false,
|
|
animationType: AnimationType.fade,
|
|
pinTheme: PinTheme(
|
|
selectedFillColor: Color(0xFF434A53),
|
|
inactiveFillColor: Color(0xFF434A53),
|
|
inactiveColor: Color(0xFF434A53),
|
|
activeColor: Color(0xFF434A53),
|
|
selectedColor: Color(0xFF434A53),
|
|
shape: PinCodeFieldShape.underline,
|
|
borderRadius: BorderRadius.circular(5),
|
|
fieldHeight: 70,
|
|
fieldWidth: 70,
|
|
activeFillColor:
|
|
// Colors.white
|
|
Color(0xFF303030).withOpacity(0.4),
|
|
// textStyle: TextStyle(color: Colors.white, fontSize: 20), // Change text color and font size
|
|
),
|
|
animationDuration: Duration(milliseconds: 300),
|
|
enableActiveFill: true,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
controller: pincode,
|
|
onCompleted: (v) {
|
|
print("Completed");
|
|
},
|
|
onChanged: (value) {
|
|
print(value);
|
|
setState(() {
|
|
// currentText = value;
|
|
});
|
|
},
|
|
cursorColor: Colors.white,
|
|
textStyle: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 20.sp,
|
|
fontFamily: 'Helvetica',
|
|
),
|
|
beforeTextPaste: (text) {
|
|
print("Allowing to paste $text");
|
|
return true;
|
|
},
|
|
appContext: context,
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
Center(
|
|
child: TimerButton(
|
|
disabledTextStyle: TextStyle(color: Colors.red),
|
|
activeTextStyle: TextStyle(color: Colors.white),
|
|
disabledColor: Color(0XFF222935).withOpacity(0.10),
|
|
buttonType: ButtonType.textButton,
|
|
label: "Resend OTP",
|
|
timeOutInSeconds: 120,
|
|
//mobile.text.isEmpty ? 1 : 60,
|
|
onPressed: () {
|
|
setState(() {
|
|
Uploadataresendotp();
|
|
});
|
|
},
|
|
// disabledColor: Colors.white,
|
|
color: Color(0XFF222935).withOpacity(0.10),
|
|
),
|
|
),
|
|
const Spacer(
|
|
flex: 3,
|
|
),
|
|
CustomButton(
|
|
text: 'Continue',
|
|
onPressed: () {
|
|
if (pincode.text.isEmpty) {
|
|
utils.showToast('Pin field is empty');
|
|
} else if (pincode.text.length < 4) {
|
|
utils.showToast(
|
|
'Pin field must be at least 4 characters long');
|
|
} else {
|
|
Uploadata();
|
|
|
|
// if (accounttype == 'Individual') {
|
|
// print('individual selected');
|
|
// Get.toNamed(RouteName.tellusindividualscreen);
|
|
// } else if (accounttype == 'Business') {
|
|
// print('business selected');
|
|
// Get.toNamed(RouteName.tellusbusinessscreen);
|
|
// }
|
|
}
|
|
}),
|
|
const Spacer(
|
|
// flex: 2,
|
|
),
|
|
],
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|