login apis, models & forgot password screen added.
parent
bf08417bfa
commit
f1beefbc46
@ -0,0 +1,34 @@
|
||||
class PostParamsModel {
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? mobileType;
|
||||
String? logInTokenID;
|
||||
String? tokenID;
|
||||
|
||||
PostParamsModel({this.versionID, this.channel, this.languageID, this.mobileType, this.logInTokenID, this.tokenID});
|
||||
|
||||
PostParamsModel.fromJson(Map<String, dynamic> json) {
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
mobileType = json['MobileType'];
|
||||
logInTokenID = json['LogInTokenID'];
|
||||
tokenID = json['TokenID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['MobileType'] = this.mobileType;
|
||||
data['LogInTokenID'] = this.logInTokenID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
return data;
|
||||
}
|
||||
|
||||
set setLogInTokenID(String? token) => logInTokenID = token;
|
||||
|
||||
set setTokenID(String? token) => tokenID = token;
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
import 'package:easy_localization/src/public_ext.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/login_api_client.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/dialogs/otp_dialog.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
|
||||
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||
import 'package:mohem_flutter_app/widgets/input_widget.dart';
|
||||
|
||||
class ForgotPasswordScreen extends StatefulWidget {
|
||||
ForgotPasswordScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ForgotPasswordScreenState createState() {
|
||||
return _ForgotPasswordScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
||||
TextEditingController employeeId = TextEditingController();
|
||||
BasicMemberInformationModel? _basicMemberInformation;
|
||||
GenericResponseModel? genericResponseModel;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void performLogin() async {
|
||||
// Utils.showLoading(context);
|
||||
try {
|
||||
_basicMemberInformation = await LoginApiClient().getBasicUserInformation("CS", employeeId.text);
|
||||
genericResponseModel = await LoginApiClient().sendPublicActivationCode(_basicMemberInformation?.pMOBILENUMBER, employeeId.text);
|
||||
OtpDialog(
|
||||
context,
|
||||
1,
|
||||
int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""),
|
||||
(value) async {
|
||||
GenericResponseModel? genericResponseModel = await LoginApiClient().checkPublicActivationCode(value, employeeId.text);
|
||||
if (genericResponseModel?.errorMessage != null) {
|
||||
Utils.showToast(genericResponseModel?.errorMessage ?? "");
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.pushNamed(context, AppRoutes.newPassword);
|
||||
// this.checkActivationCode(value: value);
|
||||
},
|
||||
() => {
|
||||
Navigator.pop(context),
|
||||
},
|
||||
).displayDialog(context);
|
||||
} catch (ex) {
|
||||
print(ex);
|
||||
Utils.handleException(ex, null);
|
||||
// Utils.hideLoading(context);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
//const SizedBox(height: 23),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(21.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
LocaleKeys.forgotPassword.tr().toText24(isBold: true),
|
||||
LocaleKeys.loginCodeWillSentToMobileNumber.tr().toText16(),
|
||||
16.height,
|
||||
InputWidget(LocaleKeys.employeeId.tr(), "123456", employeeId),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
DefaultButton(LocaleKeys.changePassword.tr(), () async {
|
||||
//Navigator.pushNamed(context, AppRoutes.verifyLogin);
|
||||
})
|
||||
.insideContainer
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue