9/15/1
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/auth/register_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/my_dialog.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../controller/local/phone_intel/intl_phone_field.dart';
|
||||
import '../../print.dart';
|
||||
// import 'package:intl_phone_field/intl_phone_field.dart';
|
||||
|
||||
class SmsSignupEgypt extends StatelessWidget {
|
||||
SmsSignupEgypt({super.key});
|
||||
|
||||
@@ -17,7 +22,6 @@ class SmsSignupEgypt extends StatelessWidget {
|
||||
body: [
|
||||
GetBuilder<RegisterController>(builder: (registerController) {
|
||||
return ListView(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Logo at the top
|
||||
Padding(
|
||||
@@ -38,54 +42,59 @@ class SmsSignupEgypt extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
// Enter phone number text
|
||||
// Phone number input field with country code dropdown
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Text(
|
||||
'Enter your phone number'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: IntlPhoneField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Phone Number'.tr,
|
||||
border: const OutlineInputBorder(
|
||||
borderSide: BorderSide(),
|
||||
),
|
||||
),
|
||||
initialCountryCode: 'EG',
|
||||
onChanged: (phone) {
|
||||
// Properly concatenate country code and number
|
||||
registerController.phoneController.text =
|
||||
phone.completeNumber.toString();
|
||||
Log.print(' phone.number: ${phone.number}');
|
||||
print(
|
||||
"Formatted phone number: ${registerController.phoneController.text}");
|
||||
},
|
||||
validator: (phone) {
|
||||
// Check if the phone number is not null and is valid
|
||||
if (phone == null || phone.completeNumber.isEmpty) {
|
||||
return 'Please enter your phone number';
|
||||
}
|
||||
|
||||
// Extract the phone number (excluding the country code)
|
||||
final number = phone.completeNumber.toString();
|
||||
|
||||
// Check if the number length is exactly 11 digits
|
||||
if (number.length != 13) {
|
||||
return 'Phone number must be exactly 11 digits long';
|
||||
}
|
||||
|
||||
// If all validations pass, return null
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
// Phone number input field
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: !registerController.isSent
|
||||
? Form(
|
||||
key: registerController.formKey3,
|
||||
child: MyTextForm(
|
||||
controller: registerController.phoneController,
|
||||
label: 'Enter your phone number'.tr,
|
||||
hint: 'Enter your phone number'.tr,
|
||||
type: TextInputType.phone),
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
registerController.phoneController.text,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if (registerController.isSent)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: registerController.isSent
|
||||
? Form(
|
||||
key: registerController.formKey3,
|
||||
child: MyTextForm(
|
||||
controller: registerController.verifyCode,
|
||||
label: '5 digit'.tr,
|
||||
hint: '5 digit'.tr,
|
||||
type: TextInputType.number),
|
||||
)
|
||||
: const SizedBox()),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
key: registerController.formKey3,
|
||||
child: MyTextForm(
|
||||
controller: registerController.verifyCode,
|
||||
label: '5 digit'.tr,
|
||||
hint: '5 digit'.tr,
|
||||
type: TextInputType.number),
|
||||
),
|
||||
),
|
||||
// Submit button
|
||||
MyElevatedButton(
|
||||
onPressed: () async {
|
||||
|
||||
Reference in New Issue
Block a user