Files
Neo_wallet/neowallet_mobile/lib/Register/register_data.dart
nutchayut 50fb227c52 bug fixed
2025-01-31 09:18:31 +07:00

1238 lines
47 KiB
Dart

import 'package:cathaypay_mobile/Register/camera_card_id.dart';
import 'package:cathaypay_mobile/Register/otp.dart';
import 'package:cathaypay_mobile/Register/pre_register.dart';
import 'package:cathaypay_mobile/Register/register.dart';
import 'package:cathaypay_mobile/Register/register_occupation.dart';
import 'package:cathaypay_mobile/utils/utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
import '../utils/calendar_picker.dart';
import '../utils/color_custom.dart';
TextEditingController name = TextEditingController(text: idCardFront?.nameThai ?? "");
TextEditingController email = TextEditingController();
TextEditingController username = TextEditingController();
TextEditingController phone = TextEditingController();
TextEditingController password = TextEditingController();
TextEditingController passwordConfirm = TextEditingController();
TextEditingController idCardEditText = TextEditingController(text: idCardFront?.idCard ?? "");
TextEditingController idCardBackEditText = TextEditingController(text: idCardBack ?? "");
// TextEditingController titleEditText = TextEditingController();
TextEditingController nameEnEditText = TextEditingController(text: idCardFront?.nameEng ?? "");
TextEditingController addressNow = TextEditingController(text: idCardFront?.address ?? "");
TextEditingController addressCard = TextEditingController(text: idCardFront?.address ?? "");
String occ = "";
TextEditingController jobOther = TextEditingController();
TextEditingController addressJob = TextEditingController();
TextEditingController addressJob2 = TextEditingController();
TextEditingController nationality = TextEditingController();
String dateOfBirth = "";
String prefix = "";
String? target = "";
class RegisterData extends StatefulWidget {
const RegisterData({Key? key}) : super(key: key);
@override
State<RegisterData> createState() => _RegisterDataState();
}
class _RegisterDataState extends State<RegisterData> {
List<String> listDropdown = ["Mr.".tr(), "Mrs.".tr(), "Miss".tr(), "Not specified".tr()];
List<String> listDropdownTarget = ["Pay for products and services".tr(), "Accepting payment for products and services".tr(), "Spend at participating merchants".tr()];
String? dropdownValue;
var maskFormatter = MaskTextInputFormatter(mask: '###-#######-##', filter: {"#": RegExp('[a-z A-Z 0-9]')});
var maskFormatterPhone = MaskTextInputFormatter(mask: '###-###-####', filter: {"#": RegExp('[0-9]')});
@override
void initState() {
name = TextEditingController(text: idCardFront?.nameThai ?? "");
email.clear();
username.clear();
phone.clear();
passwordConfirm.clear();
password.clear();
idCardEditText = TextEditingController(text: idCardFront?.idCard ?? "");
idCardBackEditText = TextEditingController(text: idCardBack ?? "");
nameEnEditText = TextEditingController(text: idCardFront?.nameEng ?? "");
addressNow = TextEditingController(text: idCardFront?.address ?? "");
addressCard = TextEditingController(text: idCardFront?.address ?? "");
WidgetsBinding.instance.addPostFrameCallback((_) async {
dateOfBirth = idCardFront?.birthdayThai ?? Utils.convertDateTH(DateTime.now());
});
prefix = listDropdown.last;
dropdownValue = listDropdown.last;
target = listDropdownTarget.first;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
// extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
actions: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Icons.clear,
color: Colors.grey,
),
),
],
elevation: 0,
centerTitle: true,
title: Text(
"Verify your identity".tr(),
textAlign: TextAlign.center,
style: GoogleFonts.kanit(
color: Colors.black,
fontSize: 20,
),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
register_step(index: 2),
SizedBox(
height: 10,
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"National ID card/passport number".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[a-z A-Z 0-9]'))],
maxLength: 13,
keyboardType: TextInputType.text,
textAlign: TextAlign.start,
controller: idCardEditText,
decoration: InputDecoration(
hintText: '',
counterText: "",
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
/*Expanded(
child: Text(
idCardFront?.idCard ?? "",
textAlign: TextAlign.right,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
),*/
],
),
isPassport?Container():Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Back of card number".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
inputFormatters: <TextInputFormatter>[maskFormatter],
maxLength: 15,
keyboardType: TextInputType.text,
textAlign: TextAlign.right,
controller: idCardBackEditText,
decoration: InputDecoration(
counterText: "",
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
/*Expanded(
child: Text(
idCardBack?.nameThai ?? "",
textAlign: TextAlign.right,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
),*/
],
),
],
),
/*Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"วันหมดอายุ",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: Text(
"",
textAlign: TextAlign.right,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
),
],
),*/
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 20,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
flex: 3,
child: Text(
"Title".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
),
/* Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
keyboardType: TextInputType.text,
textAlign: TextAlign.right,
controller: titleEditText,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),*/
Expanded(
flex: 2,
child: DropdownButton<String>(
value: dropdownValue,
icon: const SizedBox.shrink(),
elevation: 16,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
onChanged: (String? value) {
setState(() {
dropdownValue = value!;
prefix = value;
});
},
items: listDropdown.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
SizedBox(
width: 15,
)
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
isPassport?"Thai name/english name in passport_passport".tr(): "Thai name/english name in passport".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
SizedBox(
width: double.infinity,
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 14,
),
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[ก-๛ a-z A-Z]')), FilteringTextInputFormatter.deny(RegExp('[฿]'))],
// inputFormatters: [
// FilteringTextInputFormatter.deny(
// RegExp(r'[!@#$%^&*()+-/*,.?":{}|<>_;:]'))
// ],
keyboardType: TextInputType.text,
textAlign: TextAlign.start,
controller: name,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
/*Expanded(
child: Text(
idCardFront?.nameThai ?? "",
textAlign: TextAlign.right,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
),*/
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
isPassport? "English name_passport".tr(): "English name".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 14,
),
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[a-z A-Z]'))],
keyboardType: TextInputType.text,
textAlign: TextAlign.right,
controller: nameEnEditText,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
// Expanded(
// child: Text(
// idCardFront?.nameEng ?? "",
// textAlign: TextAlign.right,
// style: GoogleFonts.kanit(
// color: Color(0xff565656),
// fontSize: 15,
// fontWeight: FontWeight.w300,
// ),
// ),
// ),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"nationality".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 14,
),
keyboardType: TextInputType.text,
textAlign: TextAlign.right,
controller: nationality,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Date of birth".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: CalendarWidget(
callback: (value) {
// Intl.defaultLocale = "th";
// initializeDateFormatting('th_TH', "");
dateOfBirth = Utils.convertDateTH(value);
},
value: "",
)),
Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
SizedBox(
width: 18,
)
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 20,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Username".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
keyboardType: TextInputType.text,
textAlign: TextAlign.right,
controller: username,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Mobilephone number".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
inputFormatters: <TextInputFormatter>[maskFormatterPhone],
maxLength: 13,
keyboardType: TextInputType.phone,
textAlign: TextAlign.right,
controller: phone,
decoration: InputDecoration(
counterText: "",
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"E-mail",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
keyboardType: TextInputType.emailAddress,
textAlign: TextAlign.right,
controller: email,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Password",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
textAlign: TextAlign.right,
controller: password,
obscureText: true,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Confirm password",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
obscureText: true,
textAlign: TextAlign.right,
controller: passwordConfirm,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
/*Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"ที่อยู่ปัจจุบัน",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Spacer()
],
),*/
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Address as per ID card".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
/* Text(
idCardFront?.address ?? "",
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
)*/
Container(
width: double.infinity,
child: TextField(
minLines: 2,
maxLines: 2,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 14,
fontWeight: FontWeight.w300,
),
keyboardType: TextInputType.text,
textAlign: TextAlign.start,
controller: addressCard,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Current address".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Container(
width: double.infinity,
child: TextField(
minLines: 2,
maxLines: 2,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 14,
fontWeight: FontWeight.w300,
),
keyboardType: TextInputType.text,
textAlign: TextAlign.start,
controller: addressNow,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 20,
color: Color(0xfff3f3f3),
),
),
InkWell(
onTap: () async {
final result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegisterOccupation(),
),
);
if (result != null) {
print(result);
setState(() {
occ = result;
});
}
},
child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10, right: 15),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"profession".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: Row(
children: [
Expanded(
child: Text(
occ,
textAlign: TextAlign.end,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
],
),
)
],
),
),
),
(occ == "อาชีพอิสระ".tr() || occ == "เจ้าของกิจการ".tr() || occ == "อาชีพอื่นๆ".tr())
? Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"ประเภทของงาน".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
controller: jobOther,
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
],
)
: Container(),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Name of workplace".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
controller: addressJob,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Work address".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Expanded(
child: TextField(
controller: addressJob2,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Purpose of using the service".tr(),
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
),
Row(
children: [
Expanded(
child: DropdownButton<String>(
isExpanded: true,
value: target,
icon: const SizedBox.shrink(),
elevation: 16,
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
onChanged: (String? value) {
setState(() {
target = value!;
});
},
items: listDropdownTarget.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value, overflow: TextOverflow.ellipsis),
);
}).toList(),
),
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
SizedBox(
width: 15,
),
],
),
/*Expanded(
child: TextField(
style: GoogleFonts.kanit(
color: Color(0xff565656),
fontSize: 15,
),
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: '',
suffixIcon: Icon(
Icons.arrow_forward_ios_rounded,
size: 15,
color: Colors.grey,
),
border: InputBorder.none,
),
),
),*/
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 1,
color: Color(0xfff3f3f3),
),
),
InkWell(
onTap: () {
if (username.text.trim().isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}Username");
return;
}
if (email.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}Email");
return;
}
if (!Utils.emailValidate(email.text)) {
Utils.showAlertDialog(context, "Email ไม่ถูกต้อง".tr());
return;
}
if (phone.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Mobilephone number".tr()}");
return;
}
if (phone.text.trim().length != 12) {
Utils.showAlertDialog(context, "เบอร์มือถือไม่ถูกต้อง".tr());
return;
}
if (password.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}Password");
return;
}
String pattern = r'^(?=.*?[a-z])(?=.*?[0-9]).{6,}$';
RegExp regExp = RegExp(pattern);
if (!regExp.hasMatch(password.text)) {
Utils.showAlertDialog(context, "Password ต้องมีตัวเลขและตัวอักษรภาษาอังกฤษอย่างน้อย 1 ตัว".tr());
return;
}
if (password.text.length < 6) {
Utils.showAlertDialog(context, "Password ต้องมากกว่า 6 ตัว".tr());
return;
}
if (password.text != passwordConfirm.text) {
Utils.showAlertDialog(context, "Password ไม่ตรงกัน".tr());
return;
}
if (idCardEditText.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"National ID card/passport number".tr()}");
return;
}
if (idCardEditText.text.length > 13) {
Utils.showAlertDialog(context, "บัตรประชาชนไม่ถูกต้อง".tr());
return;
}
// if (idCardBackEditText.text.isEmpty) {
// Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Back of card number".tr()}");
// return;
// }
if (name.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Thai name/english name in passport".tr()}");
return;
}
if (nameEnEditText.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"English name".tr()}");
return;
}
if (nationality.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"nationality".tr()}");
return;
}
if (addressNow.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Current address".tr()}");
return;
}
if (addressCard.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Address as per ID card".tr()}");
return;
}
if (dateOfBirth.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Date of birth".tr()}");
return;
}
if (occ.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"profession".tr()}");
return;
}
if (occ == "อาชีพอิสระ" || occ == "เจ้าของกิจการ" || occ == "อาชีพอื่นๆ") {
if (jobOther.text.isEmpty) {
Utils.showAlertDialog(context, "กรุณากรอกประเภทของงาน");
return;
}
}
if (addressJob.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Name of workplace".tr()}");
return;
}
if (addressJob2.text.isEmpty) {
Utils.showAlertDialog(context, "${"Please fill in".tr()}${"Work address".tr()}");
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpPage(email: email.text, phone: phone.text),
),
);
},
child: SizedBox(
width: 374,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40),
),
child: Container(
padding: EdgeInsets.all(10),
child: Text(
"Next".tr(),
textAlign: TextAlign.center,
style: GoogleFonts.kanit(
color: ColorCustom.greyBorder,
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
),
),
),
],
),
),
),
);
}
}