From 6b79c0bbc0d2741ae074338c5881f0bdc7477228 Mon Sep 17 00:00:00 2001 From: PUNEETH KUMAR Date: Thu, 12 Dec 2024 19:18:43 +0530 Subject: [PATCH] fix:profileimage rendering fixed in onboarding screen --- lib/controllers/onboarding_controller.dart | 8 +- .../screens/email_verification_screen.dart | 159 +++++++++--------- lib/views/screens/onboarding_screen.dart | 5 + 3 files changed, 92 insertions(+), 80 deletions(-) diff --git a/lib/controllers/onboarding_controller.dart b/lib/controllers/onboarding_controller.dart index d3ef14dd..2edd0f43 100644 --- a/lib/controllers/onboarding_controller.dart +++ b/lib/controllers/onboarding_controller.dart @@ -9,6 +9,7 @@ import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; import 'package:resonate/controllers/authentication_controller.dart'; import 'package:resonate/routes/app_routes.dart'; +import 'package:resonate/themes/theme_controller.dart'; import 'package:resonate/utils/constants.dart'; import 'package:resonate/utils/enums/log_type.dart'; import 'package:resonate/views/widgets/snackbar.dart'; @@ -18,6 +19,7 @@ import 'auth_state_controller.dart'; class OnboardingController extends GetxController { final ImagePicker _imagePicker = ImagePicker(); AuthStateController authStateController = Get.find(); + ThemeController themeController = Get.find(); AuthenticationController authController = Get.find(); late final Storage storage; @@ -41,6 +43,8 @@ class OnboardingController extends GetxController { super.onInit(); storage = Storage(authStateController.client); databases = Databases(authStateController.client); + imageController = TextEditingController( + text: themeController.userProfileImagePlaceholderUrl); } Future chooseDate() async { @@ -125,7 +129,9 @@ class OnboardingController extends GetxController { "Your user profile is successfully created.", LogType.success, ); - + nameController.dispose(); + usernameController.dispose(); + imageController.dispose(); SemanticsService.announce( "Your user profile is successfully created.", ui.TextDirection.ltr, diff --git a/lib/views/screens/email_verification_screen.dart b/lib/views/screens/email_verification_screen.dart index 747c68bd..a45ffbf4 100644 --- a/lib/views/screens/email_verification_screen.dart +++ b/lib/views/screens/email_verification_screen.dart @@ -81,100 +81,101 @@ class EmailVerificationScreen extends StatelessWidget { flex: 1, child: SizedBox( height: UiSizes.height_60, - ), - OtpTextField( - autoFocus: true, - numberOfFields: 6, - showFieldAsBox: true, - keyboardType: TextInputType.number, - filled: true, - fillColor: Theme.of(context).colorScheme.secondary, - borderWidth: 1, - contentPadding: EdgeInsets.zero, - borderColor: Colors.transparent, - enabledBorderColor: Colors.transparent, - focusedBorderColor: Theme.of(context).colorScheme.primary, - // runs when every text-field is filled - onSubmit: (String verificationCode) async { - loadingDialog(context); - emailVerifyController.isVerifying.value = true; - await emailVerifyController.verifyOTP(verificationCode); - - if (emailVerifyController.responseVerify.responseBody == - '{"message":"null"}') { - String result = - await emailVerifyController.checkVerificationStatus(); - if (result == "true") { - customSnackbar( - "Verification Complete", - "Congratulations you have verified your Email", - LogType.success, - ); + child: OtpTextField( + autoFocus: true, + numberOfFields: 6, + showFieldAsBox: true, + keyboardType: TextInputType.number, + filled: true, + fillColor: Theme.of(context).colorScheme.secondary, + borderWidth: 1, + contentPadding: EdgeInsets.zero, + borderColor: Colors.transparent, + enabledBorderColor: Colors.transparent, + focusedBorderColor: Theme.of(context).colorScheme.primary, + // runs when every text-field is filled + onSubmit: (String verificationCode) async { + loadingDialog(context); + emailVerifyController.isVerifying.value = true; + await emailVerifyController.verifyOTP(verificationCode); - SemanticsService.announce( - "Congratulations you have verified your Email", - TextDirection.ltr, - ); - await emailVerifyController.setVerified(); - if (emailVerifyController - .responseSetVerified.responseBody == + if (emailVerifyController.responseVerify.responseBody == '{"message":"null"}') { - emailVerifyController.isVerifying.value = false; + String result = await emailVerifyController + .checkVerificationStatus(); + if (result == "true") { + customSnackbar( + "Verification Complete", + "Congratulations you have verified your Email", + LogType.success, + ); + + SemanticsService.announce( + "Congratulations you have verified your Email", + TextDirection.ltr, + ); + await emailVerifyController.setVerified(); + if (emailVerifyController + .responseSetVerified.responseBody == + '{"message":"null"}') { + emailVerifyController.isVerifying.value = false; - // Close loading dialog - Get.back(); + // Close loading dialog + Get.back(); - controller.authStateController.setUserProfileData(); - Get.offAllNamed(AppRoutes.tabview); - } else { - emailVerifyController.isVerifying.value = false; + controller.authStateController.setUserProfileData(); + Get.offAllNamed(AppRoutes.tabview); + } else { + emailVerifyController.isVerifying.value = false; + + // Close loading dialog + Get.back(); + + customSnackbar( + 'Oops', + emailVerifyController + .responseSetVerified.responseBody, + LogType.error, + ); + + SemanticsService.announce( + emailVerifyController + .responseSetVerified.responseBody, + TextDirection.ltr, + ); + } + } else { + emailVerifyController.isVerifying.value = false; - // Close loading dialog - Get.back(); + // Close loading dialog + Get.back(); + customSnackbar( + "Verification Failed", + "OTP mismatch occurred please try again", + LogType.error, + ); + + SemanticsService.announce( + "OTP mismatch occurred please try again", + TextDirection.ltr, + ); + } + } else { customSnackbar( 'Oops', - emailVerifyController - .responseSetVerified.responseBody, + emailVerifyController.responseVerify.responseBody, LogType.error, ); SemanticsService.announce( - emailVerifyController - .responseSetVerified.responseBody, + emailVerifyController.responseVerify.responseBody, TextDirection.ltr, ); } - } else { - emailVerifyController.isVerifying.value = false; - - // Close loading dialog - Get.back(); - - customSnackbar( - "Verification Failed", - "OTP mismatch occurred please try again", - LogType.error, - ); - - SemanticsService.announce( - "OTP mismatch occurred please try again", - TextDirection.ltr, - ); - } - } else { - customSnackbar( - 'Oops', - emailVerifyController.responseVerify.responseBody, - LogType.error, - ); - - SemanticsService.announce( - emailVerifyController.responseVerify.responseBody, - TextDirection.ltr, - ); - } - }, + }, + ), + ), ), SizedBox( height: UiSizes.height_60, diff --git a/lib/views/screens/onboarding_screen.dart b/lib/views/screens/onboarding_screen.dart index 9bf6057e..a5c069d8 100644 --- a/lib/views/screens/onboarding_screen.dart +++ b/lib/views/screens/onboarding_screen.dart @@ -20,6 +20,11 @@ class OnBoardingScreen extends StatefulWidget { class _OnBoardingScreenState extends State { final debouncer = Debouncer(milliseconds: 800); + @override + void dispose() { + super.dispose(); + } + @override Widget build(BuildContext context) { return GetBuilder(