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