Skip to content

Commit 6b79c0b

Browse files
fix:profileimage rendering fixed in onboarding screen
1 parent 84b74ba commit 6b79c0b

File tree

3 files changed

+92
-80
lines changed

3 files changed

+92
-80
lines changed

lib/controllers/onboarding_controller.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:image_picker/image_picker.dart';
99
import 'package:intl/intl.dart';
1010
import 'package:resonate/controllers/authentication_controller.dart';
1111
import 'package:resonate/routes/app_routes.dart';
12+
import 'package:resonate/themes/theme_controller.dart';
1213
import 'package:resonate/utils/constants.dart';
1314
import 'package:resonate/utils/enums/log_type.dart';
1415
import 'package:resonate/views/widgets/snackbar.dart';
@@ -18,6 +19,7 @@ import 'auth_state_controller.dart';
1819
class OnboardingController extends GetxController {
1920
final ImagePicker _imagePicker = ImagePicker();
2021
AuthStateController authStateController = Get.find<AuthStateController>();
22+
ThemeController themeController = Get.find<ThemeController>();
2123
AuthenticationController authController =
2224
Get.find<AuthenticationController>();
2325
late final Storage storage;
@@ -41,6 +43,8 @@ class OnboardingController extends GetxController {
4143
super.onInit();
4244
storage = Storage(authStateController.client);
4345
databases = Databases(authStateController.client);
46+
imageController = TextEditingController(
47+
text: themeController.userProfileImagePlaceholderUrl);
4448
}
4549

4650
Future<void> chooseDate() async {
@@ -125,7 +129,9 @@ class OnboardingController extends GetxController {
125129
"Your user profile is successfully created.",
126130
LogType.success,
127131
);
128-
132+
nameController.dispose();
133+
usernameController.dispose();
134+
imageController.dispose();
129135
SemanticsService.announce(
130136
"Your user profile is successfully created.",
131137
ui.TextDirection.ltr,

lib/views/screens/email_verification_screen.dart

+80-79
Original file line numberDiff line numberDiff line change
@@ -81,100 +81,101 @@ class EmailVerificationScreen extends StatelessWidget {
8181
flex: 1,
8282
child: SizedBox(
8383
height: UiSizes.height_60,
84-
),
85-
OtpTextField(
86-
autoFocus: true,
87-
numberOfFields: 6,
88-
showFieldAsBox: true,
89-
keyboardType: TextInputType.number,
90-
filled: true,
91-
fillColor: Theme.of(context).colorScheme.secondary,
92-
borderWidth: 1,
93-
contentPadding: EdgeInsets.zero,
94-
borderColor: Colors.transparent,
95-
enabledBorderColor: Colors.transparent,
96-
focusedBorderColor: Theme.of(context).colorScheme.primary,
97-
// runs when every text-field is filled
98-
onSubmit: (String verificationCode) async {
99-
loadingDialog(context);
100-
emailVerifyController.isVerifying.value = true;
101-
await emailVerifyController.verifyOTP(verificationCode);
102-
103-
if (emailVerifyController.responseVerify.responseBody ==
104-
'{"message":"null"}') {
105-
String result =
106-
await emailVerifyController.checkVerificationStatus();
107-
if (result == "true") {
108-
customSnackbar(
109-
"Verification Complete",
110-
"Congratulations you have verified your Email",
111-
LogType.success,
112-
);
84+
child: OtpTextField(
85+
autoFocus: true,
86+
numberOfFields: 6,
87+
showFieldAsBox: true,
88+
keyboardType: TextInputType.number,
89+
filled: true,
90+
fillColor: Theme.of(context).colorScheme.secondary,
91+
borderWidth: 1,
92+
contentPadding: EdgeInsets.zero,
93+
borderColor: Colors.transparent,
94+
enabledBorderColor: Colors.transparent,
95+
focusedBorderColor: Theme.of(context).colorScheme.primary,
96+
// runs when every text-field is filled
97+
onSubmit: (String verificationCode) async {
98+
loadingDialog(context);
99+
emailVerifyController.isVerifying.value = true;
100+
await emailVerifyController.verifyOTP(verificationCode);
113101

114-
SemanticsService.announce(
115-
"Congratulations you have verified your Email",
116-
TextDirection.ltr,
117-
);
118-
await emailVerifyController.setVerified();
119-
if (emailVerifyController
120-
.responseSetVerified.responseBody ==
102+
if (emailVerifyController.responseVerify.responseBody ==
121103
'{"message":"null"}') {
122-
emailVerifyController.isVerifying.value = false;
104+
String result = await emailVerifyController
105+
.checkVerificationStatus();
106+
if (result == "true") {
107+
customSnackbar(
108+
"Verification Complete",
109+
"Congratulations you have verified your Email",
110+
LogType.success,
111+
);
112+
113+
SemanticsService.announce(
114+
"Congratulations you have verified your Email",
115+
TextDirection.ltr,
116+
);
117+
await emailVerifyController.setVerified();
118+
if (emailVerifyController
119+
.responseSetVerified.responseBody ==
120+
'{"message":"null"}') {
121+
emailVerifyController.isVerifying.value = false;
123122

124-
// Close loading dialog
125-
Get.back();
123+
// Close loading dialog
124+
Get.back();
126125

127-
controller.authStateController.setUserProfileData();
128-
Get.offAllNamed(AppRoutes.tabview);
129-
} else {
130-
emailVerifyController.isVerifying.value = false;
126+
controller.authStateController.setUserProfileData();
127+
Get.offAllNamed(AppRoutes.tabview);
128+
} else {
129+
emailVerifyController.isVerifying.value = false;
130+
131+
// Close loading dialog
132+
Get.back();
133+
134+
customSnackbar(
135+
'Oops',
136+
emailVerifyController
137+
.responseSetVerified.responseBody,
138+
LogType.error,
139+
);
140+
141+
SemanticsService.announce(
142+
emailVerifyController
143+
.responseSetVerified.responseBody,
144+
TextDirection.ltr,
145+
);
146+
}
147+
} else {
148+
emailVerifyController.isVerifying.value = false;
131149

132-
// Close loading dialog
133-
Get.back();
150+
// Close loading dialog
151+
Get.back();
134152

153+
customSnackbar(
154+
"Verification Failed",
155+
"OTP mismatch occurred please try again",
156+
LogType.error,
157+
);
158+
159+
SemanticsService.announce(
160+
"OTP mismatch occurred please try again",
161+
TextDirection.ltr,
162+
);
163+
}
164+
} else {
135165
customSnackbar(
136166
'Oops',
137-
emailVerifyController
138-
.responseSetVerified.responseBody,
167+
emailVerifyController.responseVerify.responseBody,
139168
LogType.error,
140169
);
141170

142171
SemanticsService.announce(
143-
emailVerifyController
144-
.responseSetVerified.responseBody,
172+
emailVerifyController.responseVerify.responseBody,
145173
TextDirection.ltr,
146174
);
147175
}
148-
} else {
149-
emailVerifyController.isVerifying.value = false;
150-
151-
// Close loading dialog
152-
Get.back();
153-
154-
customSnackbar(
155-
"Verification Failed",
156-
"OTP mismatch occurred please try again",
157-
LogType.error,
158-
);
159-
160-
SemanticsService.announce(
161-
"OTP mismatch occurred please try again",
162-
TextDirection.ltr,
163-
);
164-
}
165-
} else {
166-
customSnackbar(
167-
'Oops',
168-
emailVerifyController.responseVerify.responseBody,
169-
LogType.error,
170-
);
171-
172-
SemanticsService.announce(
173-
emailVerifyController.responseVerify.responseBody,
174-
TextDirection.ltr,
175-
);
176-
}
177-
},
176+
},
177+
),
178+
),
178179
),
179180
SizedBox(
180181
height: UiSizes.height_60,

lib/views/screens/onboarding_screen.dart

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class OnBoardingScreen extends StatefulWidget {
2020
class _OnBoardingScreenState extends State<OnBoardingScreen> {
2121
final debouncer = Debouncer(milliseconds: 800);
2222

23+
@override
24+
void dispose() {
25+
super.dispose();
26+
}
27+
2328
@override
2429
Widget build(BuildContext context) {
2530
return GetBuilder<OnboardingController>(

0 commit comments

Comments
 (0)