Added OTP Dialog fixes

merge-requests/3/head
Zohaib Iqbal Kambrani 3 years ago
parent 771a0204dc
commit 6cffb35a9f

@ -42,5 +42,9 @@
"whatsapp": "واتس اب", "whatsapp": "واتس اب",
"reject": "يرفض", "reject": "يرفض",
"approve": "يوافق", "approve": "يوافق",
"cancel": "إلغاء" "cancel": "إلغاء",
"otp": "OTP",
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق"
} }

@ -42,5 +42,9 @@
"whatsapp": "Whatsapp", "whatsapp": "Whatsapp",
"reject": "Reject", "reject": "Reject",
"approve": "Approve", "approve": "Approve",
"cancel": "Cancel" "cancel": "Cancel",
"otp": "OTP",
"verification": "Verification",
"resend": "Resend",
"codeExpire": "The verification code has been expired"
} }

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 50; objectVersion = 51;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -13,6 +13,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
9D12EA470E69A39F3F4EEEAC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBDA1EC0585A028F26394B8F /* Pods_Runner.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@ -31,6 +32,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
27FAD59055A271CDB6345D20 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -42,6 +44,9 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CBDA1EC0585A028F26394B8F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E8F2C56CA7A126F5FC598365 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
FF2E7CCDDEE1BDF1A3E7D477 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -49,12 +54,21 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9D12EA470E69A39F3F4EEEAC /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
5070F4CF6F638C91B59F4B67 /* Frameworks */ = {
isa = PBXGroup;
children = (
CBDA1EC0585A028F26394B8F /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = { 9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -72,6 +86,8 @@
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
CACFC9B4D329C2F774D03EE9 /* Pods */,
5070F4CF6F638C91B59F4B67 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -98,6 +114,16 @@
path = Runner; path = Runner;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
CACFC9B4D329C2F774D03EE9 /* Pods */ = {
isa = PBXGroup;
children = (
FF2E7CCDDEE1BDF1A3E7D477 /* Pods-Runner.debug.xcconfig */,
27FAD59055A271CDB6345D20 /* Pods-Runner.release.xcconfig */,
E8F2C56CA7A126F5FC598365 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@ -105,12 +131,14 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
CDED494F0D32669A035C1EA5 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
2CEBFA1962BF46DCB0A31085 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -169,6 +197,23 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
2CEBFA1962BF46DCB0A31085 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -197,6 +242,28 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
CDED494F0D32669A035C1EA5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@ -288,6 +355,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KT58FV5WJU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -416,6 +484,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KT58FV5WJU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -438,6 +507,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KT58FV5WJU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (

@ -4,4 +4,7 @@
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:Runner.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace> </Workspace>

@ -1,15 +1,15 @@
import 'dart:async'; import 'dart:async';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:hmg_nurses/classes/colors.dart'; import 'package:hmg_nurses/classes/colors.dart';
import 'package:hmg_nurses/extensions/int_extensions.dart'; import 'package:hmg_nurses/extensions/int_extensions.dart';
import 'package:hmg_nurses/extensions/string_extensions.dart'; import 'package:hmg_nurses/extensions/string_extensions.dart';
import 'package:hmg_nurses/generated/locale_keys.g.dart';
import 'package:hmg_nurses/widgets/button/default_button.dart'; import 'package:hmg_nurses/widgets/button/default_button.dart';
import 'package:hmg_nurses/widgets/otp_widget.dart'; import 'package:hmg_nurses/widgets/otp_widget.dart';
final ValueNotifier<String> otpFieldClear = ValueNotifier<String>(""); final ValueNotifier<String> otpFieldClear = ValueNotifier<String>("");
class OtpDialog { class OtpDialog {
@ -17,18 +17,13 @@ class OtpDialog {
final int? mobileNo; final int? mobileNo;
final Function(String, TextEditingController _pinPutController) onSuccess; final Function(String, TextEditingController _pinPutController) onSuccess;
final Function onFailure; final Function onFailure;
final BuildContext context;
final Function onResendCode; final Function onResendCode;
int remainingTime = 120; int remainingTime = 120;
Future<Null>? timer; Future<Null>? timer;
static BuildContext? _context; OtpDialog({required this.type, required this.mobileNo, required this.onSuccess, required this.onFailure, required this.onResendCode});
static bool? _loading;
OtpDialog(this.context, this.type, this.mobileNo, this.onSuccess, this.onFailure, {required this.onResendCode});
GlobalKey? verifyAccountForm = GlobalKey<FormState>(); GlobalKey? verifyAccountForm = GlobalKey<FormState>();
@ -53,7 +48,6 @@ class OtpDialog {
// ProjectViewModel projectProvider; // ProjectViewModel projectProvider;
String displayTime = ''; String displayTime = '';
String? _code;
dynamic setState; dynamic setState;
bool stopTimer = false; bool stopTimer = false;
@ -75,7 +69,7 @@ class OtpDialog {
} }
return Container( return Container(
padding: EdgeInsets.all(21), padding: const EdgeInsets.all(21),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -92,38 +86,33 @@ class OtpDialog {
width: 50, width: 50,
), ),
12.height, 12.height,
"LocaleKeys.otp.tr()".toText14(), LocaleKeys.otp.tr().toText14(),
"LocaleKeys.verification.tr()".toText24(isBold: true), LocaleKeys.verification.tr().toText24(isBold: true),
6.height, 6.height,
("LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr()" + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(), ('${LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr()} xxxxxxxx${mobileNo.toString().substring(mobileNo.toString().length - 3)}').toText16(),
18.height, 18.height,
ValueListenableBuilder<String>( ValueListenableBuilder<String>(
builder: (BuildContext context, String value, Widget? child) { builder: (BuildContext context, String value, Widget? child) {
// This builder will only get called when the _counter
// is updated.
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Directionality( Center(
textDirection: TextDirection.ltr, child: OTPWidget(
child: Center( autoFocus: true,
child: OTPWidget( controller: _pinPutController,
autoFocus: true, defaultBorderColor: const Color(0xffD8D8D8),
controller: _pinPutController, maxLength: 4,
defaultBorderColor: const Color(0xffD8D8D8), onTextChanged: (text) {},
maxLength: 4, pinBoxColor: Colors.white,
onTextChanged: (text) {}, onDone: (code) => _onOtpCallBack(code, null),
pinBoxColor: Colors.white, textBorderColor: const Color(0xffD8D8D8),
onDone: (code) => _onOtpCallBack(code, null), pinBoxWidth: 60,
textBorderColor: const Color(0xffD8D8D8), pinBoxHeight: 60,
pinBoxWidth: 60, pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor),
pinBoxHeight: 60, pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition,
pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor), pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300),
pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition, pinBoxRadius: 10,
pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300), keyboardType: TextInputType.number,
pinBoxRadius: 10,
keyboardType: TextInputType.number,
),
), ),
), ),
10.height, 10.height,
@ -131,7 +120,7 @@ class OtpDialog {
? Row( ? Row(
children: [ children: [
Expanded( Expanded(
child: "LocaleKeys.codeExpire.tr()".toText16( child: LocaleKeys.codeExpire.tr().toText16(
color: MyColors.redColor, color: MyColors.redColor,
), ),
), ),
@ -146,7 +135,7 @@ class OtpDialog {
) )
: RichText( : RichText(
text: TextSpan( text: TextSpan(
text: "LocaleKeys.theVerificationCodeWillExpireIn.tr()" + '\n', text: '${LocaleKeys.theVerificationCodeWillExpireIn.tr()}\n',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
@ -163,7 +152,7 @@ class OtpDialog {
), ),
18.height, 18.height,
DefaultButton( DefaultButton(
stopTimer ? "LocaleKeys.resend.tr()" : "LocaleKeys.cancel.tr()", stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(),
() async { () async {
if (stopTimer) { if (stopTimer) {
hideSMSBox(context); hideSMSBox(context);
@ -177,8 +166,8 @@ class OtpDialog {
colors: stopTimer colors: stopTimer
? null ? null
: [ : [
MyColors.pinkDarkColor, MyColors.redColor,
MyColors.pinkDarkColor, MyColors.redColor,
], ],
), ),
], ],
@ -211,16 +200,6 @@ class OtpDialog {
); );
} }
// String validateCodeDigit(value) {
// if (value.isEmpty) {
// return ' ';
// } else if (value.length == 3) {
// print(value);
// } else {
// return null;
// }
// }
String getSecondsAsDigitalClock(int inputSeconds) { String getSecondsAsDigitalClock(int inputSeconds) {
int secNum = int.parse(inputSeconds.toString()); // don't forget the second param int secNum = int.parse(inputSeconds.toString()); // don't forget the second param
int hours = (secNum / 3600).floor(); int hours = (secNum / 3600).floor();
@ -228,9 +207,9 @@ class OtpDialog {
double seconds = secNum - hours * 3600 - minutes * 60; double seconds = secNum - hours * 3600 - minutes * 60;
String minutesString = ""; String minutesString = "";
String secondsString = ""; String secondsString = "";
minutesString = minutes < 10 ? "0" + minutes.toString() : minutes.toString(); minutesString = minutes < 10 ? "0$minutes" : minutes.toString();
secondsString = seconds < 10 ? "0" + seconds.toStringAsFixed(0) : seconds.toStringAsFixed(0); secondsString = seconds < 10 ? "0${seconds.toStringAsFixed(0)}" : seconds.toStringAsFixed(0);
return minutesString + ":" + secondsString; return "$minutesString:$secondsString";
} }
void startTimer(setState) { void startTimer(setState) {

@ -58,7 +58,11 @@ class CodegenLoader extends AssetLoader{
"whatsapp": "واتس اب", "whatsapp": "واتس اب",
"reject": "يرفض", "reject": "يرفض",
"approve": "يوافق", "approve": "يوافق",
"cancel": "إلغاء" "cancel": "إلغاء",
"otp": "OTP",
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -104,7 +108,11 @@ static const Map<String,dynamic> en_US = {
"whatsapp": "Whatsapp", "whatsapp": "Whatsapp",
"reject": "Reject", "reject": "Reject",
"approve": "Approve", "approve": "Approve",
"cancel": "Cancel" "cancel": "Cancel",
"otp": "OTP",
"verification": "Verification",
"resend": "Resend",
"codeExpire": "The verification code has been expired"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -12,6 +12,9 @@ import 'package:sizer/sizer.dart';
import 'generated/codegen_loader.g.dart'; import 'generated/codegen_loader.g.dart';
GlobalKey<NavigatorState> navigatorKey = GlobalKey();
Logger logger = Logger( Logger logger = Logger(
// filter: null, // Use the default LogFilter (-> only log in debug mode) // filter: null, // Use the default LogFilter (-> only log in debug mode)
printer: PrettyPrinter( printer: PrettyPrinter(
@ -71,6 +74,7 @@ class MyApp extends StatelessWidget {
) { ) {
List<LocalizationsDelegate<dynamic>> delegates = context.localizationDelegates; List<LocalizationsDelegate<dynamic>> delegates = context.localizationDelegates;
return MaterialApp( return MaterialApp(
key: navigatorKey,
theme: AppTheme.getTheme( theme: AppTheme.getTheme(
EasyLocalization.of(context)?.locale.languageCode == "ar", EasyLocalization.of(context)?.locale.languageCode == "ar",
), ),

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:hmg_nurses/classes/colors.dart'; import 'package:hmg_nurses/classes/colors.dart';
import 'package:hmg_nurses/classes/utils.dart'; import 'package:hmg_nurses/classes/utils.dart';
import 'package:hmg_nurses/dialogs/otp_dialog.dart';
import 'package:hmg_nurses/extensions/int_extensions.dart'; import 'package:hmg_nurses/extensions/int_extensions.dart';
import 'package:hmg_nurses/extensions/string_extensions.dart'; import 'package:hmg_nurses/extensions/string_extensions.dart';
import 'package:hmg_nurses/generated/locale_keys.g.dart'; import 'package:hmg_nurses/generated/locale_keys.g.dart';
@ -105,10 +106,26 @@ class LoginMethodsPageState extends State<LoginMethodsPage> {
} else { } else {
if (isNeedVerifyWithFaceIDAndBiometrics) { if (isNeedVerifyWithFaceIDAndBiometrics) {
// performApiCall(_title, _icon, selectedFlag, _flag); // performApiCall(_title, _icon, selectedFlag, _flag);
// TODO: CALL API AND THEN SHOW DIALOG
OtpDialog(
type: 1,
mobileNo: 0504278212,
onSuccess: (string, TextEditingController pinPutController) {},
onFailure: () {},
onResendCode: () {},
).displayDialog(context);
} else { } else {
// performApiCall(_title, _icon, _flag, _flag); // performApiCall(_title, _icon, _flag, _flag);
// TODO: CALL API AND THEN SHOW DIALOG
OtpDialog(
type: 1,
mobileNo: 0504278212,
onSuccess: (string, TextEditingController pinPutController) {},
onFailure: () {},
onResendCode: () {},
).displayDialog(context);
} }
} }
} }

@ -0,0 +1,7 @@
import 'package:flutter/cupertino.dart';
class LoginVM extends ChangeNotifier {
}
Loading…
Cancel
Save