Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:profileimage rendering fixed in onboarding screen #414

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/controllers/onboarding_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -18,6 +19,7 @@ import 'auth_state_controller.dart';
class OnboardingController extends GetxController {
final ImagePicker _imagePicker = ImagePicker();
AuthStateController authStateController = Get.find<AuthStateController>();
ThemeController themeController = Get.find<ThemeController>();
AuthenticationController authController =
Get.find<AuthenticationController>();
late final Storage storage;
Expand All @@ -41,6 +43,8 @@ class OnboardingController extends GetxController {
super.onInit();
storage = Storage(authStateController.client);
databases = Databases(authStateController.client);
imageController = TextEditingController(
text: themeController.userProfileImagePlaceholderUrl);
}

Future<void> chooseDate() async {
Expand Down Expand Up @@ -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,
Expand Down
159 changes: 80 additions & 79 deletions lib/views/screens/email_verification_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions lib/views/screens/onboarding_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class OnBoardingScreen extends StatefulWidget {
class _OnBoardingScreenState extends State<OnBoardingScreen> {
final debouncer = Debouncer(milliseconds: 800);

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
return GetBuilder<OnboardingController>(
Expand Down