229 lines
10 KiB
Dart
229 lines
10 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
|
import 'package:sefer_driver/constant/colors.dart';
|
|
import 'package:sefer_driver/constant/style.dart';
|
|
import 'package:sefer_driver/controller/auth/captin/register_captin_controller.dart';
|
|
import 'package:sefer_driver/views/widgets/elevated_btn.dart';
|
|
import 'package:sefer_driver/views/widgets/my_scafold.dart';
|
|
import 'package:sefer_driver/views/widgets/my_textField.dart';
|
|
import 'package:sefer_driver/views/widgets/mycircular.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:sefer_driver/views/widgets/mydialoug.dart';
|
|
|
|
import '../../../../controller/functions/crud.dart';
|
|
import '../../../../controller/functions/encrypt_decrypt.dart';
|
|
import '../../../../print.dart';
|
|
import '../../../Rate/rate_app_page.dart';
|
|
|
|
class SmsSignupEgypt extends StatelessWidget {
|
|
SmsSignupEgypt({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(RegisterCaptainController());
|
|
return MyScafolld(
|
|
title: 'Phone Check'.tr,
|
|
body: [
|
|
GetBuilder<RegisterCaptainController>(
|
|
builder: (registerCaptainController) {
|
|
return ListView(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Logo at the top
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 20.0),
|
|
child: Image.asset(
|
|
'assets/images/logo.gif', // Make sure you have a logo image in your assets folder
|
|
height: 100,
|
|
),
|
|
),
|
|
// Message to the driver
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
|
child: Text(
|
|
'We need your phone number to contact you and to help you receive orders.'
|
|
.tr,
|
|
textAlign: TextAlign.center,
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
// Enter phone number text
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
|
child: Text(
|
|
'Enter your phone number'.tr,
|
|
textAlign: TextAlign.center,
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
// Phone number input field
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: !registerCaptainController.isSent
|
|
? Form(
|
|
key: registerCaptainController.formKey3,
|
|
child: MyTextForm(
|
|
controller:
|
|
registerCaptainController.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(
|
|
registerCaptainController.phoneController.text,
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
)),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: registerCaptainController.isSent
|
|
? Form(
|
|
key: registerCaptainController.formKey3,
|
|
child: MyTextForm(
|
|
controller: registerCaptainController.verifyCode,
|
|
label: '5 digit'.tr,
|
|
hint: '5 digit'.tr,
|
|
type: TextInputType.number),
|
|
)
|
|
: const SizedBox()),
|
|
// Submit button
|
|
registerCaptainController.isLoading
|
|
? const MyCircularProgressIndicator()
|
|
: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: MyElevatedButton(
|
|
onPressed: () async {
|
|
!registerCaptainController.isSent
|
|
? await registerCaptainController.sendOtpMessage()
|
|
: await registerCaptainController.verifySMSCode();
|
|
},
|
|
title: 'Submit'.tr,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: MyElevatedButton(
|
|
kolor: AppColor.yellowColor,
|
|
title: "Rate Our App".tr,
|
|
onPressed: () {
|
|
Get.to(RatingScreen());
|
|
}),
|
|
),
|
|
|
|
// IconButton(
|
|
// onPressed: () async {
|
|
// // final plainText =
|
|
// // 'https://server.sefer.live/sefer.click/sefer';
|
|
// // debugPrint('Plain Text: $plainText');
|
|
|
|
// // Encrypt the data
|
|
// // final encryptedData = encryptionHelper.encryptData(plainText);
|
|
// // debugPrint('Encrypted: $encryptedData');
|
|
|
|
// // Decrypt the data
|
|
// // final decryptedData = encryptionHelper.decryptData(
|
|
// // '2unGmj8jSMFBfxqH8+GN'); // Use the encryptedData variable
|
|
// // debugPrint('Decrypted: $decryptedData');
|
|
// // box.remove('DriversSecure');
|
|
// var drivers0 = await CRUD().get(
|
|
// link:
|
|
// 'https://server.sefer.live/sefer.click/sefer/auth/captin/getAllDriverSecure.php',
|
|
// payload: {});
|
|
// var decodedDriver;
|
|
// if (drivers0 != 'failure') {
|
|
// decodedDriver = jsonDecode(drivers0);
|
|
|
|
// // // // box.write('DriversSecure', decodedDriver['message']);
|
|
// }
|
|
// var drivers = decodedDriver['message'];
|
|
// Log.print('drivers.length: ${drivers.length}');
|
|
// for (var i = 0; i < drivers.length; i++) {
|
|
// Log.print('id: ${drivers[i]['id']}');
|
|
// var payload = {
|
|
// "phone": encryptionHelper
|
|
// .encryptData(drivers[i]['phone'].toString()),
|
|
// "email": encryptionHelper
|
|
// .encryptData(drivers[i]['email'].toString()),
|
|
// "gender": encryptionHelper
|
|
// .encryptData(drivers[i]['gender'] ?? 'unknown'),
|
|
// "birthdate": encryptionHelper
|
|
// .encryptData(drivers[i]['birthdate'].toString()),
|
|
// "first_name": encryptionHelper
|
|
// .encryptData(drivers[i]['first_name'].toString()),
|
|
// "last_name": encryptionHelper
|
|
// .encryptData(drivers[i]['last_name'].toString()),
|
|
// "sosPhone": encryptionHelper
|
|
// .encryptData(drivers[i]['sosPhone'].toString()),
|
|
// // "name_english": encryptionHelper
|
|
// // .encryptData(drivers[i]['name_english'].toString()),
|
|
// // "last_name": encryptionHelper
|
|
// // .encryptData(drivers[i]['last_name'].toString()),
|
|
// // "sosPhone": encryptionHelper
|
|
// // .encryptData(drivers[i]['sosPhone'].toString()),
|
|
// // "address": encryptionHelper
|
|
// // .encryptData(drivers[i]['address'].toString()),
|
|
// // "card_id": encryptionHelper
|
|
// // .encryptData(drivers[i]['card_id'].toString()),
|
|
// // "occupation": encryptionHelper
|
|
// // .encryptData(drivers[i]['occupation'].toString()),
|
|
// // "religion": encryptionHelper
|
|
// // .encryptData(drivers[i]['religion'].toString()),
|
|
// // "site": encryptionHelper
|
|
// // .encryptData(drivers[i]['site'].toString()),
|
|
// // "education": encryptionHelper
|
|
// // .encryptData(drivers[i]['education'].toString()),
|
|
// // "accountBank": encryptionHelper
|
|
// // .encryptData(drivers[i]['accountBank'].toString()),
|
|
// // "employmentType": encryptionHelper
|
|
// // .encryptData(drivers[i]['employmentType'].toString()),
|
|
// // "maritalStatus": (drivers[i]['maritalStatus'].toString()),
|
|
// // "fullNameMaritial": encryptionHelper.encryptData(
|
|
// // drivers[i]['fullNameMaritial'].toString()),
|
|
// 'id': drivers[i]['id'].toString()
|
|
// };
|
|
// // print(drivers[i]['idn']);
|
|
// // if (drivers[i]['id'].toString() !=
|
|
// // '01002165502a9sHC1tbrUrUw') {
|
|
// var result = await CRUD().post(
|
|
// link:
|
|
// 'https://server.sefer.live/sefer.click/sefer/auth/captin/updateDriverSecure.php',
|
|
// payload: payload);
|
|
// if (result != 'failure') {
|
|
// print(result);
|
|
// } else {
|
|
// print('failure');
|
|
// }
|
|
// // Future.delayed(Duration(microseconds: 200));
|
|
// // }
|
|
// }
|
|
// MyDialog().getDialog('title', 'midTitle', () {
|
|
// Get.back();
|
|
// });
|
|
// },
|
|
// icon: const Icon(
|
|
// FontAwesome5.grin_tears,
|
|
// size: 29,
|
|
// color: AppColor.blueColor,
|
|
// ),
|
|
// ),
|
|
],
|
|
);
|
|
}),
|
|
],
|
|
isleading: false,
|
|
);
|
|
}
|
|
}
|