Files
Regroup/lib/onboarding/Signup/View/signupscreen.dart
2024-07-09 13:10:40 +05:30

399 lines
19 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:regroup/Utils/Common/CommonDropdown.dart';
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
import 'package:regroup/Utils/Common/CustomNextButton.dart';
import 'package:regroup/Utils/Common/sized_box.dart';
import 'package:regroup/Utils/dialogs.dart';
import 'package:regroup/Utils/texts.dart';
import 'package:regroup/resources/routes/route_name.dart';
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
class SignupScreen extends StatefulWidget {
const SignupScreen({super.key});
@override
State<SignupScreen> createState() => _SignupScreenState();
}
class _SignupScreenState extends State<SignupScreen> {
TextEditingController emailidcontroller = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController confirmpasscontroller = TextEditingController();
List<String> _dropdownProductItems = [
'Individual',
'Business',
];
String _selectedAccountType = '';
void _onItemSelected(String value) {
setState(() {
_selectedAccountType = value;
});
}
void _Signincheck() async {
if (emailidcontroller.text.isBlank! ||
passwordController.text.isBlank! ||
confirmpasscontroller.text.isBlank!) {
Get.snackbar(
'Error',
'Enter your credentials',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
} else if (!emailidcontroller.text.isEmail) {
Get.snackbar(
'Error',
'Enter a valid e-mail address',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
} else if (_selectedAccountType == 'Individual') {
print('individual selected');
Get.toNamed(RouteName.verifyusercreen, arguments: _selectedAccountType);
} else if (_selectedAccountType == 'Business') {
print('business selected');
Get.toNamed(RouteName.verifyusercreen, arguments: _selectedAccountType);
} else {
utils.showToast('Please select an account type');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color.fromARGB(255, 18, 32, 47),
body: Stack(
children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/png/Choice screen.png"),
fit: BoxFit.fill)),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 150.h),
child: Center(child: text22400white('Create account')),
),
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 30.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16400white('Email address'),
sizedBoxHeight(10.h),
CustomTextFormField(
textEditingController: emailidcontroller,
hintText: "Enter your email address",
leadingIcon:
// const Icon(Icons.mail_outline),
SizedBox(
width: 22.w,
height: 17.h,
child: Image.asset(
'assets/images/png/mail.png',
width: 22.w,
height: 17.h,
),
),
// validatorText: "Email Id",
validator: (value) {
if (value!.isEmpty) {
return 'Enter your e-mail address';
}
if (!RegExp(
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
.hasMatch(value)) {
return 'Enter a valid e-mail address';
}
return null;
},
inputFormatters: [
LengthLimitingTextInputFormatter(20),
RemoveEmojiInputFormatter()
],
),
sizedBoxHeight(10.h),
text16400white('Password'),
sizedBoxHeight(10.h),
CustomTextFormField(
isInputPassword: true,
textEditingController: passwordController,
hintText: 'Enter your password',
leadingIcon: Image.asset(
'assets/images/png/lock.png',
width: 22.w,
height: 17.h,
),
// const Icon(Icons.lock_outline),
// validationMessage: "Enter your password",
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter your password';
}
return null;
},
inputFormatters: [
LengthLimitingTextInputFormatter(20),
RemoveEmojiInputFormatter()
],
),
sizedBoxHeight(10.h),
text16400white('Confirm password'),
sizedBoxHeight(10.h),
CustomTextFormField(
isInputPassword: true,
textEditingController: confirmpasscontroller,
hintText: "Enter your password",
leadingIcon: Image.asset(
'assets/images/png/lock.png',
width: 22.w,
height: 17.h,
),
// const Icon(Icons.lock_outline),
// validatorText: "Enter your password",
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter your password';
}
if (val != passwordController.text) {
return 'Password does not match';
}
return null;
},
inputFormatters: [
LengthLimitingTextInputFormatter(20),
RemoveEmojiInputFormatter()
],
),
sizedBoxHeight(10.h),
Row(
children: [
text16400white('Account type'),
sizedBoxWidth(5.w),
Image.asset(
'assets/images/png/informationicon.png')
],
),
sizedBoxHeight(10.h),
CustomDropDownRadio(
header: 'Select account type',
title: '',
listData: [
'Individual',
'Business',
],
onItemSelected: _onItemSelected,
leadingImage: Image.asset(
'assets/images/png/user.png',
),
),
sizedBoxHeight(30.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 320.w,
height: 42.h,
child: Text.rich(
TextSpan(
children: [
TextSpan(
text:
'By signing up to ReGroup you agree to our ',
style: TextStyle(
color: const Color(0xCCFCFCFC),
fontSize: 14.sp,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w400,
),
),
TextSpan(
text: 'Terms and Conditions',
style: TextStyle(
color: const Color(0xCCFCFCFC),
fontSize: 14.sp,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w700,
decoration: TextDecoration.underline,
decorationColor:
const Color(0xffFCFCFC)
.withOpacity(0.80),
),
),
TextSpan(
text: ' and ',
style: TextStyle(
color: const Color(0xCCFCFCFC),
fontSize: 14.sp,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w400,
),
),
TextSpan(
text: 'Privacy Policy',
style: TextStyle(
color: const Color(0xCCFCFCFC),
fontSize: 14.sp,
fontFamily: 'Helvetica',
fontWeight: FontWeight.w700,
decoration: TextDecoration.underline,
decorationColor:
const Color(0xffFCFCFC)
.withOpacity(0.80),
),
),
],
),
textAlign: TextAlign.center,
),
),
],
),
sizedBoxHeight(20.h),
CustomButton(
text: "Continue",
onPressed: () {
_Signincheck();
}),
sizedBoxHeight(20.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 160,
decoration: const ShapeDecoration(
shape: RoundedRectangleBorder(
side: BorderSide(
width: 0.50,
strokeAlign: BorderSide.strokeAlignCenter,
color: Color(0xFF434A53),
),
),
),
),
sizedBoxWidth(6.w),
text14400white('Or'),
sizedBoxWidth(6.w),
Container(
width: 160,
decoration: const ShapeDecoration(
shape: RoundedRectangleBorder(
side: BorderSide(
width: 0.50,
strokeAlign: BorderSide.strokeAlignCenter,
color: Color(0xFF434A53),
),
),
),
),
],
),
sizedBoxHeight(20.h),
Center(
child: SizedBox(
width: 220.w,
child: Row(
children: [
Container(
width: 55,
height: 55,
decoration: ShapeDecoration(
gradient: LinearGradient(
begin: const Alignment(0.71, -0.70),
end: const Alignment(-0.71, 0.7),
colors: [
Colors.white.withOpacity(
0.07999999821186066),
Colors.white.withOpacity(
0.12999999523162842)
],
),
shape: const OvalBorder(
side: BorderSide(
width: 0.50,
color: Color(0xFF434A53)),
),
image: const DecorationImage(
image: AssetImage(
'assets/images/png/login2.png'))),
),
const Spacer(),
Container(
width: 55,
height: 55,
decoration: ShapeDecoration(
gradient: LinearGradient(
begin: const Alignment(0.71, -0.70),
end: const Alignment(-0.71, 0.7),
colors: [
Colors.white.withOpacity(
0.07999999821186066),
Colors.white.withOpacity(
0.12999999523162842)
],
),
shape: const OvalBorder(
side: BorderSide(
width: 0.50,
color: Color(0xFF434A53)),
),
image: const DecorationImage(
image: AssetImage(
'assets/images/png/login3.png'))),
),
const Spacer(),
Container(
width: 55,
height: 55,
decoration: ShapeDecoration(
gradient: LinearGradient(
begin: const Alignment(0.71, -0.70),
end: const Alignment(-0.71, 0.7),
colors: [
Colors.white.withOpacity(
0.07999999821186066),
Colors.white.withOpacity(
0.12999999523162842)
],
),
shape: const OvalBorder(
side: BorderSide(
width: 0.50,
color: Color(0xFF434A53)),
),
image: const DecorationImage(
image: AssetImage(
'assets/images/png/login4.png'))),
),
],
),
),
),
sizedBoxHeight(20.h),
],
),
),
),
)
],
),
],
));
}
}