2/9/2
This commit is contained in:
@@ -20,7 +20,7 @@ class LogoutCaptain extends StatelessWidget {
|
||||
MyElevatedButton(
|
||||
title: 'Log Off'.tr,
|
||||
onPressed: () {
|
||||
LogOut().logOutCaptain();
|
||||
LogOutController().logOutCaptain();
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
@@ -28,7 +28,7 @@ class LogoutCaptain extends StatelessWidget {
|
||||
MyElevatedButton(
|
||||
title: 'Delete My Account'.tr,
|
||||
onPressed: () {
|
||||
LogOut().deletecaptainAccount();
|
||||
LogOutController().deletecaptainAccount();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
|
||||
@@ -59,7 +59,7 @@ class MapMenuWidget extends StatelessWidget {
|
||||
IconWidgetMenu(
|
||||
onpressed: () {
|
||||
Get.to(
|
||||
() => const PassengerProfilePage(),
|
||||
() => PassengerProfilePage(),
|
||||
transition: Transition.zoom,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -8,16 +8,20 @@ import 'package:ride/controller/profile/profile_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.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 '../../../constant/links.dart';
|
||||
import '../../../controller/functions/crud.dart';
|
||||
import '../../../controller/functions/log_out.dart';
|
||||
|
||||
class PassengerProfilePage extends StatelessWidget {
|
||||
const PassengerProfilePage({super.key});
|
||||
|
||||
PassengerProfilePage({super.key});
|
||||
LogOutController logOutController = Get.put(LogOutController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(ProfileController());
|
||||
|
||||
return MyScafolld(
|
||||
isleading: true,
|
||||
title: 'My Profile'.tr,
|
||||
@@ -192,7 +196,7 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
child: MyElevatedButton(
|
||||
title: 'Sign Out'.tr,
|
||||
onPressed: () {
|
||||
LogOut().logOutPassenger();
|
||||
LogOutController().logOutPassenger();
|
||||
}),
|
||||
),
|
||||
Positioned(
|
||||
@@ -202,8 +206,40 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
child: MyElevatedButton(
|
||||
title: 'Delete My Account'.tr,
|
||||
onPressed: () {
|
||||
LogOut()
|
||||
.deleteMyAccount(box.read(BoxName.passengerID).toString());
|
||||
Get.defaultDialog(
|
||||
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) {
|
||||
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;
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user