This repository has been archived on 2024-10-18. You can view files and clone it, but cannot push or open issues or pull requests.
ftc_patient_app/lib/controllers/profile/view_profile_screen_control...

95 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/dialogs/app_dialogs.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
import '../../models/profile_screen_model.dart';
class ViewProfileScreenController extends GetxController {
final nameTEC = TextEditingController();
final emailTEC = TextEditingController();
final phoneTEC = TextEditingController();
final addressTEC = TextEditingController();
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
final dashboardController = DashboardScreenController.instance;
final viewProfileClient = false.obs;
final covidCheck = false.obs;
final isEditable = false.obs;
final detail = Rx<StaffMembers?>(null);
void removeFocus() {
FocusScope.of(screenKey.currentContext!).unfocus();
}
@override
void onInit() {
// FrequentFunctions.profileDataModelNew = ProfileDataModel.fromJson(
// json.decode(LocalStorageManager.getSessionToken(
// tokenKey: LocalStorageKeys.kProfileModelKey)));
detail.listen((d) {
nameTEC.text = d?.user?.displayName ?? "";
emailTEC.text = d?.user!.email ?? "";
phoneTEC.text = d?.user?.phoneNumber ?? "";
addressTEC.text = d?.user?.modelId?.homeAddress ?? "";
});
// detail.value = dashboardController.myProfileData();
super.onInit();
}
@override
onReady() {
// getProfileDetail();
super.onReady();
}
// getProfileDetail() async {
// final resp = await ClientService().getUserDetails().showLoader();
//
// if (resp is ProfileDataModel) {
// detail.value = resp.data?.staffMembers?.firstOrNull;
// covidCheck.value =
// resp.data?.staffMembers?.firstOrNull?.covidCheck ?? false;
// } else {
// if (resp.isNotNullOrEmpty()) {
// FrequentFunctions.showToast(message: resp);
// }
// }
// }
void logoutPressed() {
AppDialog.alertAndLogout(() {
FrequentFunctions().logoutButtonPressed(screenKey.currentState!.context);
});
// showDialog(
// context: screenKey.currentState!.context,
// builder: (BuildContext context) {
// return CustomForgetPasswordDialog(
// dialogButtonCloseText: "Cancel",
// dialogButtonAcceptText: "YES",
// dialogMessageText: "",
// dialogMessageTextBold: "Are you Sure You want to logout?",
// headingText: "Confirmation",
// showTextField: false,
// acceptFunction: () async{
// FrequentFunctions().logoutButtonPressed(screenKey.currentState!.context);
// },
// );
// },
// );
}
@override
void dispose() {
nameTEC.dispose();
emailTEC.dispose();
phoneTEC.dispose();
addressTEC.dispose();
Get.delete<ViewProfileScreenController>();
super.dispose();
}
}