From c3219c13f08172cd09f1d793870365998253b4ca Mon Sep 17 00:00:00 2001 From: orangdeso Date: Tue, 13 May 2025 22:23:21 +0700 Subject: [PATCH] Feat: This feature is not used --- android/app/src/main/AndroidManifest.xml | 19 ++-- assets/icons/ic_phone.svg | 3 + lib/_core/component/icons/icons_library.dart | 1 + lib/_core/component/text/custom_text.dart | 23 ++++ lib/_core/validators/validators.dart | 7 ++ lib/main.dart | 48 ++++++++ .../profile/pages/change_email_screen.dart | 103 ++++++++++++++++++ pubspec.yaml | 1 + 8 files changed, 194 insertions(+), 11 deletions(-) create mode 100644 assets/icons/ic_phone.svg create mode 100644 lib/_core/component/text/custom_text.dart create mode 100644 lib/presentation/screens/profile/pages/change_email_screen.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 94ef3c5..b0e5ded 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,10 +22,6 @@ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> - + + + + + - - diff --git a/assets/icons/ic_phone.svg b/assets/icons/ic_phone.svg new file mode 100644 index 0000000..3d22f19 --- /dev/null +++ b/assets/icons/ic_phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/_core/component/icons/icons_library.dart b/lib/_core/component/icons/icons_library.dart index cf52e61..b0110e5 100644 --- a/lib/_core/component/icons/icons_library.dart +++ b/lib/_core/component/icons/icons_library.dart @@ -53,6 +53,7 @@ class CustomeIcons { static SvgPicture RemoveOutline({double? size, Color? color}) => getIcon('ic_remove', color: color); static SvgPicture UploadOutline({double? size, Color? color}) => getIcon('ic_upload', color: color); static SvgPicture ScrollOutline({double? size, Color? color}) => getIcon('ic_scroll_outline', color: color); + static SvgPicture PhoneOutline({double? size, Color? color}) => getIcon('ic_phone', color: color); static SvgPicture ScrollFilled({double? size, Color? color}) => getIcon('ic_scroll_filled', color: color); static SvgPicture FlightSeatFilled({double? size, Color? color}) => getIcon('ic_flight_seat_filled', color: color); diff --git a/lib/_core/component/text/custom_text.dart b/lib/_core/component/text/custom_text.dart new file mode 100644 index 0000000..6b2fe35 --- /dev/null +++ b/lib/_core/component/text/custom_text.dart @@ -0,0 +1,23 @@ +import 'package:e_porter/_core/constants/colors.dart'; +import 'package:e_porter/_core/constants/typography.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class CustomText { + CustomText._(); + + static Widget textPadding8( + String text, { + Color? color, + FontWeight? fontWeight, + }) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: TypographyStyles.body( + text, + color: color ?? GrayColors.gray800, + fontWeight: fontWeight ?? FontWeight.w500, + ), + ); + } +} diff --git a/lib/_core/validators/validators.dart b/lib/_core/validators/validators.dart index adf35c6..94dac2c 100644 --- a/lib/_core/validators/validators.dart +++ b/lib/_core/validators/validators.dart @@ -8,6 +8,13 @@ class Validators { return null; } + static String? validatorPhone(String? value) { + if (value == null || value.isEmpty) { + return 'Nomor Telepon tidak boleh kosong'; + } + return null; + } + static String? validatorPassword(String? value) { if (value == null || value.isEmpty) { return 'Password tidak boleh kosong'; diff --git a/lib/main.dart b/lib/main.dart index 107c63d..daf6a1b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,12 @@ +// ignore_for_file: deprecated_member_use +// import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; +// import 'package:e_porter/presentation/controllers/profil_controller.dart'; +// import 'package:firebase_auth/firebase_auth.dart'; import 'dart:developer'; import 'package:e_porter/domain/bindings/app_binding.dart'; import 'package:e_porter/presentation/screens/routes/app_rountes.dart'; import 'package:firebase_core/firebase_core.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -11,6 +16,7 @@ void main() async { await Firebase.initializeApp(); log("Firebase Initialized Successfully!"); + log(">>> Firebase project: ${Firebase.app().options.projectId}"); runApp(MyApp(initialRoute: Routes.SPLASH)); } @@ -34,3 +40,45 @@ class MyApp extends StatelessWidget { ); } } + +// @override +// void initState() { +// super.initState(); +// _initDynamicLinks(); +// } + +// void _initDynamicLinks() async { +// final PendingDynamicLinkData? data = await FirebaseDynamicLinks.instance.getInitialLink(); +// _handleLink(data); + +// FirebaseDynamicLinks.instance.onLink.listen((data) { +// _handleLink(data); +// }).onError((e) { +// // ignore +// }); +// } + +// void _handleLink(PendingDynamicLinkData? data) { +// final Uri? deepLink = data?.link; +// if (deepLink == null) return; + +// final mode = deepLink.queryParameters['mode']; +// final oobCode = deepLink.queryParameters['oobCode']; +// if (mode == 'verifyEmail' && oobCode != null) { +// FirebaseAuth.instance.applyActionCode(oobCode).then((_) async { +// // 1) informasikan sukses +// Get.snackbar("Sukses", "Email baru Anda telah terverifikasi."); + +// // 2) reload profile agar UI dan prefs ter-update +// final profilC = Get.find(); +// await profilC.reloadProfile(); + +// // 3) (opsional) kembali ke layar Informasi Biodata +// if (Get.currentRoute != Routes.INFORMATIONS) { +// Get.toNamed(Routes.INFORMATIONS); +// } +// }).catchError((err) { +// Get.snackbar("Gagal Verifikasi", err.toString()); +// }); +// } +// } \ No newline at end of file diff --git a/lib/presentation/screens/profile/pages/change_email_screen.dart b/lib/presentation/screens/profile/pages/change_email_screen.dart new file mode 100644 index 0000000..00217b2 --- /dev/null +++ b/lib/presentation/screens/profile/pages/change_email_screen.dart @@ -0,0 +1,103 @@ +import 'package:e_porter/_core/component/appbar/appbar_component.dart'; +import 'package:e_porter/_core/component/button/button_fill.dart'; +import 'package:e_porter/_core/component/card/custome_shadow_cotainner.dart'; +import 'package:e_porter/_core/component/text/custom_text.dart'; +import 'package:e_porter/_core/constants/colors.dart'; +import 'package:e_porter/_core/validators/validators.dart'; +import 'package:e_porter/presentation/controllers/profil_controller.dart'; +import 'package:e_porter/presentation/screens/auth/component/Input_form.dart'; +import 'package:e_porter/presentation/screens/auth/component/Input_password.dart'; +import 'package:e_porter/presentation/screens/profile/component/header_information.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +class ChangeEmailScreen extends StatefulWidget { + const ChangeEmailScreen({super.key}); + + @override + State createState() => _ChangeEmailScreenState(); +} + +class _ChangeEmailScreenState extends State { + // final _authController = Get.find(); + final _formKey = GlobalKey(); + final _oldPassword = TextEditingController(); + final _newEmail = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: GrayColors.gray50, + appBar: DefaultAppbarComponent( + title: 'Ganti Email', + textColor: Colors.white, + backgroundColors: PrimaryColors.primary800, + onTab: () { + Get.back(); + }, + ), + body: SafeArea( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h), + child: SingleChildScrollView( + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + HeaderInformation( + title: + 'Apakah anda yakin ingin mengganti email akun?. Silahkan masukkan password lama anda sebagai konfirmasi dan masukkan email baru anda', + ), + SizedBox(height: 32.h), + CustomText.textPadding8('Password Lama'), + SizedBox(height: 16.h), + InputPassword( + controller: _oldPassword, + hintText: '••••••••••', + svgIconPath: 'assets/icons/ic_padlock.svg', + validator: Validators.validatorPassword, + ), + SizedBox(height: 20.h), + CustomText.textPadding8('Email Baru'), + SizedBox(height: 16.h), + InputForm( + controller: _newEmail, + hintText: 'example@gmail.com', + svgIconPath: 'assets/icons/ic_email.svg', + validator: Validators.validatorEmail, + textInputType: TextInputType.emailAddress, + ), + ], + ), + ), + ), + ), + ), + // bottomNavigationBar: Obx(() { + // return CustomeShadowCotainner( + // child: _authController.isChangingEmail.value + // ? Center( + // child: CircularProgressIndicator(color: PrimaryColors.primary800), + // ) + // : ButtonFill( + // text: 'Simpan', + // textColor: Colors.white, + // onTap: () async { + // if (!_formKey.currentState!.validate()) return; + // await _authController.changeEmailFlow( + // oldPassword: _oldPassword.text, + // newEmail: _newEmail.text.trim(), + // ); + // // if (success) { + // // _oldPassword.clear(); + // // _newEmail.clear(); + // // FocusScope.of(context).unfocus(); + // // } + // }, + // )); + // }), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index f0fa0f9..8855311 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,6 +61,7 @@ dependencies: mobile_scanner: ^6.0.10 pdf: ^3.11.3 printing: ^5.14.2 + # firebase_dynamic_links: ^6.1.5 # workmanager: ^0.5.2 # pin_code_fields: ^8.0.1