You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.6 KiB
Dart
133 lines
4.6 KiB
Dart
import 'dart:async';
|
|
import 'package:car_customer_app/classes/consts.dart';
|
|
import 'package:car_customer_app/extensions/int_extensions.dart';
|
|
import 'package:car_customer_app/extensions/string_extensions.dart';
|
|
import 'package:car_customer_app/generated/locale_keys.g.dart';
|
|
|
|
import 'package:car_customer_app/utils/utils.dart';
|
|
import 'package:car_customer_app/view_models/user_view_model.dart';
|
|
import 'package:car_customer_app/widgets/app_bar.dart';
|
|
import 'package:car_customer_app/widgets/button/show_image_button.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class LoginVerificationPage extends StatefulWidget {
|
|
const LoginVerificationPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LoginVerificationPage> createState() => _LoginVerificationPageState();
|
|
}
|
|
|
|
class _LoginVerificationPageState extends State<LoginVerificationPage> {
|
|
String userToken = "";
|
|
|
|
late UserVM userVM;
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
scheduleMicrotask(() async {
|
|
userVM = Provider.of<UserVM>(context, listen: false);
|
|
userToken = await userVM.performApiCallLoginVerificationPage(context);
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: appBar(context, title: LocaleKeys.login.tr()),
|
|
body: Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
padding: const EdgeInsets.all(40),
|
|
child: Column(
|
|
children: [
|
|
LocaleKeys.verifyAccount.tr().toText(height: 23 / 24, fontSize: 24, letterSpacing: -1.44,),
|
|
Utils.mFlex(2),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ShowImageButton(
|
|
onClick: () {
|
|
userVM.performBasicOtpLoginVerificationPage(context, userToken: userToken);
|
|
},
|
|
title: LocaleKeys.fingerPrint.tr(),
|
|
icon: icons + "ic_fingerprint.png",
|
|
),
|
|
),
|
|
20.width,
|
|
Expanded(
|
|
child: ShowImageButton(
|
|
onClick: () {
|
|
userVM.performBasicOtpLoginVerificationPage(context, userToken: userToken);
|
|
},
|
|
title: LocaleKeys.faceRecognition.tr(),
|
|
icon: icons + "ic_face_id.png",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
40.height,
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ShowImageButton(
|
|
onClick: () {
|
|
userVM.performBasicOtpLoginVerificationPage(context, userToken: userToken);
|
|
},
|
|
title: LocaleKeys.SMS.tr(),
|
|
icon: icons + "ic_sms.png",
|
|
),
|
|
),
|
|
20.width,
|
|
Expanded(
|
|
child: ShowImageButton(
|
|
onClick: () {
|
|
userVM.performBasicOtpLoginVerificationPage(context, userToken: userToken);
|
|
},
|
|
title: LocaleKeys.whatsapp.tr(),
|
|
icon: icons + "ic_whatsapp.png",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Utils.mFlex(10),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// Future<void> performBasicOtp(BuildContext context) async {
|
|
// Utils.showLoading(context);
|
|
// String userToken=await SharedPrefManager.getUserToken();
|
|
// Response response = await UserApiClent().login_V2_OTP(userToken, "1");
|
|
// Utils.hideLoading(context);
|
|
// if (response.statusCode == 200) {
|
|
// String userToken = jsonDecode(response.body)["token"];
|
|
// showMDialog(context, child: OtpDialog(
|
|
// onClick: (String code) async {
|
|
// pop(context);
|
|
// Utils.showLoading(context);
|
|
// Response response2 = await UserApiClent().login_V2_OTPVerify(userToken, code);
|
|
// Utils.hideLoading(context);
|
|
// if (response2.statusCode == 200) {
|
|
// User user = User.fromJson(jsonDecode(response2.body));
|
|
// SharedPrefManager.setUserToken(user.data!.accessToken ?? "");
|
|
// SharedPrefManager.setUserId(user.data!.userInfo!.userId ?? "");
|
|
// navigateWithName(context, AppRoutes.dashboard);
|
|
// } else {
|
|
// Utils.showToast("Something went wrong");
|
|
// }
|
|
// },
|
|
// ));
|
|
// } else {
|
|
// String res = jsonDecode(response.body)["errors"][0] ?? "";
|
|
// Utils.showToast(res);
|
|
// }
|
|
// }
|
|
}
|