|
|
|
|
@ -1,5 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:car_provider_app/api/client/user_api_client.dart';
|
|
|
|
|
@ -19,8 +17,6 @@ import 'package:car_provider_app/widgets/dialog/otp_dialog.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EditAccountPage extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
State<EditAccountPage> createState() => _EditAccountPageState();
|
|
|
|
|
@ -44,7 +40,7 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
ListTile(
|
|
|
|
|
leading: SvgPicture.asset("assets/images/ic_lock.svg"),
|
|
|
|
|
title: "Change Password".toText12(),
|
|
|
|
|
onTap: (){
|
|
|
|
|
onTap: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.changePassword);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -56,46 +52,55 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
"Change Mobile".toText12(),
|
|
|
|
|
"Verify".toText12(),
|
|
|
|
|
RaisedButton(
|
|
|
|
|
onPressed: (){
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.changeMobilePage);
|
|
|
|
|
},
|
|
|
|
|
child: Text("Change",
|
|
|
|
|
style: TextStyle(fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,),),color:Colors.blue,
|
|
|
|
|
child: Text(
|
|
|
|
|
"Change",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)
|
|
|
|
|
)
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(Icons.email, color: Colors.blue,),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.email,
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
),
|
|
|
|
|
"Change Email".toText12(),
|
|
|
|
|
InkWell(
|
|
|
|
|
child:((AppState().getUser.data!.userInfo!.isEmailVerified??false)?"Verified" :"Verify").toText12(),
|
|
|
|
|
onTap:
|
|
|
|
|
(AppState().getUser.data!.userInfo!.isEmailVerified??false) ?
|
|
|
|
|
null
|
|
|
|
|
:(){
|
|
|
|
|
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: (){
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.changeEmailPage);
|
|
|
|
|
},
|
|
|
|
|
child: Text("Change",
|
|
|
|
|
style: TextStyle(fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,),),color:Colors.blue,
|
|
|
|
|
child: Text(
|
|
|
|
|
"Change",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)
|
|
|
|
|
)
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8))
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ListTile(
|
|
|
|
|
// leading: SvgPicture.asset("assets/images/ic_mobile.svg"),
|
|
|
|
|
// title: "Change Mobile".toText12(),
|
|
|
|
|
@ -128,11 +133,10 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
MResponse otpCompare = await UserApiClent().EmailVerifyOTPVerify(otpRequest.data!.userToken ?? "", code);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (otpCompare.messageStatus == 1) {
|
|
|
|
|
AppState().getUser.data!.userInfo!.isEmailVerified=true;
|
|
|
|
|
setState(() {
|
|
|
|
|
});
|
|
|
|
|
AppState().getUser.data!.userInfo!.isEmailVerified = true;
|
|
|
|
|
setState(() {});
|
|
|
|
|
Utils.showToast("Email is verified successfully");
|
|
|
|
|
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
|
|
|
|
|
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
|
|
|
|
|
// showMDialog(
|
|
|
|
|
// context,
|
|
|
|
|
// child: MessageDialog(
|
|
|
|
|
@ -151,6 +155,4 @@ class _EditAccountPageState extends State<EditAccountPage> {
|
|
|
|
|
Utils.showToast(otpRequest.message ?? "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|