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.
car_common_app/lib/views/user/login_method_selection_page...

111 lines
4.4 KiB
Dart

2 years ago
import 'dart:async';
import 'dart:io';
3 years ago
2 years ago
import 'package:local_auth/local_auth.dart';
import 'package:mc_common_app/classes/app_state.dart';
3 years ago
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/config/dependencies.dart';
3 years ago
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
3 years ago
import 'package:mc_common_app/widgets/button/show_image_button.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
2 years ago
class LoginMethodSelectionPage extends StatefulWidget {
3 years ago
final String userToken;
const LoginMethodSelectionPage(this.userToken, {Key? key}) : super(key: key);
2 years ago
@override
State<LoginMethodSelectionPage> createState() => _LoginMethodSelectionPageState();
}
class _LoginMethodSelectionPageState extends State<LoginMethodSelectionPage> {
3 years ago
@override
Widget build(BuildContext context) {
2 years ago
UserVM userVM = context.read<UserVM>();
AppState appState = injector.get<AppState>();
print("current: ${appState.currentAppType}");
3 years ago
return Scaffold(
2 years ago
appBar: CustomAppBar(isRemoveBackButton: true, title: LocaleKeys.log_in.tr()),
3 years ago
body: Container(
width: double.infinity,
height: double.infinity,
padding: const EdgeInsets.all(20),
child: SingleChildScrollView(
child: Column(
children: [
2 years ago
LocaleKeys.loginSelection.tr().toText(
fontSize: 20,
letterSpacing: -1.44,
),
3 years ago
30.height,
2 years ago
LocaleKeys.welcomeBack.tr().toText(
fontSize: 20,
letterSpacing: -1.44,
),
3 years ago
40.height,
Row(
children: [
Expanded(
child: ShowImageButton(
onClick: () {
2 years ago
userVM.verifiyAuth(context: context, userToken: widget.userToken, apptype: appState.currentAppType);
//userVM.performBasicOtpLoginSelectionPage(context, userToken: userToken,appType: appState.currentAppType);
3 years ago
},
title: LocaleKeys.fingerPrint.tr(),
icon: MyAssets.icFingerprintSvg,
2 years ago
isDisabled: userVM.isBioAvailable(Platform.isAndroid ? BiometricType.weak : BiometricType.fingerprint),
3 years ago
),
),
20.width,
Expanded(
child: ShowImageButton(
onClick: () {
2 years ago
// userVM.performBasicOtpLoginSelectionPage(context, userToken: widget.userToken, appType: appState.currentAppType);
userVM.verifiyAuth(context: context, userToken: widget.userToken, apptype: appState.currentAppType);
3 years ago
},
title: LocaleKeys.faceRecognition.tr(),
icon: MyAssets.icFace,
2 years ago
isDisabled: userVM.isBioAvailable(Platform.isAndroid ? BiometricType.strong : BiometricType.face),
3 years ago
),
),
],
),
40.height,
Row(
children: [
Expanded(
child: ShowImageButton(
onClick: () {
2 years ago
userVM.performBasicOtpLoginSelectionPage(context, userToken: widget.userToken, appType: appState.currentAppType);
3 years ago
},
title: LocaleKeys.SMS.tr(),
icon: MyAssets.icSmsSvg,
3 years ago
),
),
20.width,
Expanded(
child: ShowImageButton(
onClick: () {
// navigateWithName(context, AppRoutes.dashboard);
2 years ago
userVM.performBasicOtpLoginSelectionPage(context, userToken: widget.userToken, appType: appState.currentAppType);
3 years ago
},
title: LocaleKeys.whatsapp.tr(),
icon: MyAssets.icWhatsAppSvg,
3 years ago
),
),
],
),
],
),
),
),
);
}
}