2/9/2
This commit is contained in:
@@ -155,6 +155,8 @@ class AppLink {
|
|||||||
static String login = "$auth/login.php";
|
static String login = "$auth/login.php";
|
||||||
static String signUp = "$auth/signup.php";
|
static String signUp = "$auth/signup.php";
|
||||||
static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
|
static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
|
||||||
|
static String passengerRemovedAccountEmail =
|
||||||
|
"$auth/passengerRemovedAccountEmail.php";
|
||||||
static String verifyEmail = "$auth/verifyEmail.php";
|
static String verifyEmail = "$auth/verifyEmail.php";
|
||||||
//===================Auth Captin============
|
//===================Auth Captin============
|
||||||
static String authCaptin = 'https://ride.mobile-app.store/auth/captin';
|
static String authCaptin = 'https://ride.mobile-app.store/auth/captin';
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class RegisterController extends GetxController {
|
|||||||
'email': emailController.text,
|
'email': emailController.text,
|
||||||
'token': randomNumber.toString(),
|
'token': randomNumber.toString(),
|
||||||
}).then((value) => print(value));
|
}).then((value) => print(value));
|
||||||
Get.to(() => VerifyEmailPage());
|
Get.to(() => const VerifyEmailPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ import 'package:ride/constant/links.dart';
|
|||||||
import 'package:ride/controller/functions/crud.dart';
|
import 'package:ride/controller/functions/crud.dart';
|
||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
import 'package:ride/onbording_page.dart';
|
import 'package:ride/onbording_page.dart';
|
||||||
import 'package:ride/views/lang/languages.dart';
|
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
import 'package:ride/views/widgets/my_textField.dart';
|
import 'package:ride/views/widgets/my_textField.dart';
|
||||||
|
|
||||||
import '../../constant/style.dart';
|
import '../../constant/style.dart';
|
||||||
|
|
||||||
class LogOut {
|
class LogOutController extends GetxController {
|
||||||
TextEditingController checkTxtController = TextEditingController();
|
TextEditingController checkTxtController = TextEditingController();
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
|
final emailTextController = TextEditingController();
|
||||||
Future deleteMyAccount(String id) async {
|
Future deleteMyAccount(String id) async {
|
||||||
await CRUD().post(link: AppLink.removeUser, payload: {'id': id}).then(
|
await CRUD().post(link: AppLink.removeUser, payload: {'id': id}).then(
|
||||||
(value) => Get.snackbar('Deleted', 'Your Account is Deleted',
|
(value) => Get.snackbar('Deleted', 'Your Account is Deleted',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class LogoutCaptain extends StatelessWidget {
|
|||||||
MyElevatedButton(
|
MyElevatedButton(
|
||||||
title: 'Log Off'.tr,
|
title: 'Log Off'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
LogOut().logOutCaptain();
|
LogOutController().logOutCaptain();
|
||||||
}),
|
}),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
@@ -28,7 +28,7 @@ class LogoutCaptain extends StatelessWidget {
|
|||||||
MyElevatedButton(
|
MyElevatedButton(
|
||||||
title: 'Delete My Account'.tr,
|
title: 'Delete My Account'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
LogOut().deletecaptainAccount();
|
LogOutController().deletecaptainAccount();
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
IconWidgetMenu(
|
IconWidgetMenu(
|
||||||
onpressed: () {
|
onpressed: () {
|
||||||
Get.to(
|
Get.to(
|
||||||
() => const PassengerProfilePage(),
|
() => PassengerProfilePage(),
|
||||||
transition: Transition.zoom,
|
transition: Transition.zoom,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,16 +8,20 @@ import 'package:ride/controller/profile/profile_controller.dart';
|
|||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
import 'package:ride/views/widgets/my_scafold.dart';
|
import 'package:ride/views/widgets/my_scafold.dart';
|
||||||
|
import 'package:ride/views/widgets/my_textField.dart';
|
||||||
import 'package:ride/views/widgets/mycircular.dart';
|
import 'package:ride/views/widgets/mycircular.dart';
|
||||||
|
|
||||||
|
import '../../../constant/links.dart';
|
||||||
|
import '../../../controller/functions/crud.dart';
|
||||||
import '../../../controller/functions/log_out.dart';
|
import '../../../controller/functions/log_out.dart';
|
||||||
|
|
||||||
class PassengerProfilePage extends StatelessWidget {
|
class PassengerProfilePage extends StatelessWidget {
|
||||||
const PassengerProfilePage({super.key});
|
PassengerProfilePage({super.key});
|
||||||
|
LogOutController logOutController = Get.put(LogOutController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(ProfileController());
|
Get.put(ProfileController());
|
||||||
|
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
isleading: true,
|
isleading: true,
|
||||||
title: 'My Profile'.tr,
|
title: 'My Profile'.tr,
|
||||||
@@ -192,7 +196,7 @@ class PassengerProfilePage extends StatelessWidget {
|
|||||||
child: MyElevatedButton(
|
child: MyElevatedButton(
|
||||||
title: 'Sign Out'.tr,
|
title: 'Sign Out'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
LogOut().logOutPassenger();
|
LogOutController().logOutPassenger();
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
@@ -202,8 +206,40 @@ class PassengerProfilePage extends StatelessWidget {
|
|||||||
child: MyElevatedButton(
|
child: MyElevatedButton(
|
||||||
title: 'Delete My Account'.tr,
|
title: 'Delete My Account'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
LogOut()
|
Get.defaultDialog(
|
||||||
.deleteMyAccount(box.read(BoxName.passengerID).toString());
|
title: 'Are you sure to delete your account?'.tr,
|
||||||
|
content: GetBuilder<LogOutController>(
|
||||||
|
builder: (logOutController) {
|
||||||
|
return Form(
|
||||||
|
child: MyTextForm(
|
||||||
|
controller: logOutController.emailTextController,
|
||||||
|
label: 'Type your Email'.tr,
|
||||||
|
hint: 'Type your Email'.tr,
|
||||||
|
type: TextInputType.emailAddress,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'Delete My Account'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
if (logOutController.formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
LogOutController().deleteMyAccount(
|
||||||
|
box.read(BoxName.passengerID).toString());
|
||||||
|
await CRUD().post(
|
||||||
|
link: AppLink.passengerRemovedAccountEmail,
|
||||||
|
payload: {
|
||||||
|
'email': box.read(BoxName.email).text,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
cancel: MyElevatedButton(
|
||||||
|
title: 'No I want'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
logOutController.emailTextController.clear();
|
||||||
|
logOutController.update();
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ class MyTextForm extends StatelessWidget {
|
|||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return 'Please enter $label.'.tr;
|
return 'Please enter $label.'.tr;
|
||||||
}
|
}
|
||||||
|
if (type == TextInputType.emailAddress) {
|
||||||
|
return 'Please enter Valid email.'.tr;
|
||||||
|
} else if (type == TextInputType.phone) {
|
||||||
|
return 'Please enter Valid Phone.'.tr;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user