|
|
|
|
@ -3,10 +3,12 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:car_provider_app/api/client/user_api_client.dart';
|
|
|
|
|
import 'package:car_provider_app/classes/app_state.dart';
|
|
|
|
|
import 'package:car_provider_app/classes/utils.dart';
|
|
|
|
|
import 'package:car_provider_app/config/routes.dart';
|
|
|
|
|
import 'package:car_provider_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:car_provider_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:car_provider_app/models/m_response.dart';
|
|
|
|
|
import 'package:car_provider_app/models/user/verify_email.dart';
|
|
|
|
|
import 'package:car_provider_app/models/user/verify_email_otp.dart';
|
|
|
|
|
import 'package:car_provider_app/utils/navigator.dart';
|
|
|
|
|
@ -52,7 +54,7 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset("assets/images/ic_mobile.svg"),
|
|
|
|
|
"Change Mobile".toText12(),
|
|
|
|
|
"Verified".toText12(),
|
|
|
|
|
"Verify".toText12(),
|
|
|
|
|
RaisedButton(
|
|
|
|
|
onPressed: (){
|
|
|
|
|
navigateWithName(context, AppRoutes.changeMobilePage);
|
|
|
|
|
@ -71,11 +73,14 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
children: [
|
|
|
|
|
Icon(Icons.email, color: Colors.blue,),
|
|
|
|
|
"Change Email".toText12(),
|
|
|
|
|
InkWell(
|
|
|
|
|
child: "Verify".toText12(),
|
|
|
|
|
onTap:() {
|
|
|
|
|
verifyEmail(context);
|
|
|
|
|
},
|
|
|
|
|
InkWell(
|
|
|
|
|
child:((AppState().getUser.data!.userInfo!.isEmailVerified??false)?"Verified" :"Verify").toText12(),
|
|
|
|
|
onTap:
|
|
|
|
|
(AppState().getUser.data!.userInfo!.isEmailVerified??false) ?
|
|
|
|
|
null
|
|
|
|
|
:(){
|
|
|
|
|
verifyEmail(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
RaisedButton(
|
|
|
|
|
onPressed: (){
|
|
|
|
|
@ -120,20 +125,22 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
onClick: (String code) async {
|
|
|
|
|
pop(context);
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
VerifyEmailOTP otpCompare = await UserApiClent().EmailVerifyOTPVerify(otpRequest.data!.userToken ?? "", code);
|
|
|
|
|
MResponse otpCompare = await UserApiClent().EmailVerifyOTPVerify(otpRequest.data!.userToken ?? "", code);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (otpCompare.success == true) {
|
|
|
|
|
showMDialog(
|
|
|
|
|
context,
|
|
|
|
|
child: MessageDialog(
|
|
|
|
|
title: "Email is Verified",
|
|
|
|
|
onClick: () {
|
|
|
|
|
Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (otpCompare.messageStatus == 1) {
|
|
|
|
|
Utils.showToast("Email is verified successfully");
|
|
|
|
|
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
|
|
|
|
|
// showMDialog(
|
|
|
|
|
// context,
|
|
|
|
|
// child: MessageDialog(
|
|
|
|
|
// title: "Email is Verified",
|
|
|
|
|
// onClick: () {
|
|
|
|
|
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(otpCompare.errors ?? "");
|
|
|
|
|
Utils.showToast(otpCompare.message ?? "");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
|