|
|
|
|
@ -33,8 +33,8 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
email = widget.uEmail ?? "";
|
|
|
|
|
phoneNo = widget.uPhoneNo?? "";
|
|
|
|
|
extensionNo = widget.uExtensionNo?? "";
|
|
|
|
|
phoneNo = widget.uPhoneNo ?? "";
|
|
|
|
|
extensionNo = widget.uExtensionNo ?? "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -101,7 +101,6 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
|
|
|
|
|
buttonColor: AppColor.neutral50,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
FocusManager.instance.primaryFocus!.unfocus();
|
|
|
|
|
|
|
|
|
|
if (email.isEmpty || !Validator.isEmail(email)) {
|
|
|
|
|
"Please enter valid email".showToast;
|
|
|
|
|
return;
|
|
|
|
|
@ -119,7 +118,7 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (status) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
widget.onUpdate(email!, phoneNo!, extensionNo!);
|
|
|
|
|
widget.onUpdate(email, phoneNo, extensionNo);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -127,111 +126,3 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// class UpdateUserContactInfoBottomSheet extends StatelessWidget {
|
|
|
|
|
// final String userID;
|
|
|
|
|
// final String? uEmail;
|
|
|
|
|
// final String? uPhoneNo;
|
|
|
|
|
// final String? uExtensionNo;
|
|
|
|
|
// final Function(String, String, String) onUpdate;
|
|
|
|
|
//
|
|
|
|
|
// UpdateUserContactInfoBottomSheet(this.userID, {super.key, this.uEmail = "", this.uPhoneNo = "", this.uExtensionNo = "", required this.onUpdate});
|
|
|
|
|
//
|
|
|
|
|
// TextEditingController? email;
|
|
|
|
|
// TextEditingController? phoneNo;
|
|
|
|
|
// TextEditingController? extensionNo;
|
|
|
|
|
//
|
|
|
|
|
// @override
|
|
|
|
|
// Widget build(BuildContext context) {
|
|
|
|
|
// email ??= TextEditingController(text: uEmail);
|
|
|
|
|
// phoneNo ??= TextEditingController(text: uPhoneNo);
|
|
|
|
|
// extensionNo ??= TextEditingController(text: uExtensionNo);
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// 8.height,
|
|
|
|
|
// Align(
|
|
|
|
|
// alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
// child: "Update Information".bottomSheetHeadingTextStyle(context),
|
|
|
|
|
// ),
|
|
|
|
|
// 16.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: "Email",
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// initialValue: uEmail,
|
|
|
|
|
// controller: email,
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// textInputType: TextInputType.emailAddress,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// // email = value;
|
|
|
|
|
// },
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// ),
|
|
|
|
|
// 12.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: "Phone Number",
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// initialValue: uPhoneNo,
|
|
|
|
|
// controller: phoneNo,
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// textInputType: TextInputType.phone,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// // phoneNo = value;
|
|
|
|
|
// },
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// ),
|
|
|
|
|
// 12.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: "Extension No",
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// initialValue: uExtensionNo,
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// controller: extensionNo,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// textInputType: const TextInputType.numberWithOptions(decimal: true),
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// // extensionNo = value;
|
|
|
|
|
// },
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// ),
|
|
|
|
|
// 12.height,
|
|
|
|
|
// AppFilledButton(
|
|
|
|
|
// label: "Update",
|
|
|
|
|
// buttonColor: AppColor.neutral50,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// FocusManager.instance.primaryFocus!.unfocus();
|
|
|
|
|
// print("email!.text:${email!.text}");
|
|
|
|
|
// print("phoneNo!.text:${phoneNo!.text}");
|
|
|
|
|
// print("extensionNo!.text:${extensionNo!.text}");
|
|
|
|
|
//
|
|
|
|
|
// if (email!.text.isEmpty || !Validator.isEmail(email!.text)) {
|
|
|
|
|
// "Please enter valid email".showToast;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (phoneNo!.text.isEmpty || phoneNo!.text.length != 10) {
|
|
|
|
|
// "Please enter valid phone number".showToast;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (extensionNo!.text.isEmpty) {
|
|
|
|
|
// "Please enter valid phone number".showToast;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
// bool status = await context.userProvider.updateContactInfo(userID, email!.text, phoneNo!.text, extensionNo!.text);
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// if (status) {
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// onUpdate(email!.text, phoneNo!.text, extensionNo!.text);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|