diff --git a/assets/images/bn_map.png b/assets/images/bn_map.png
deleted file mode 100644
index b04b5aa..0000000
Binary files a/assets/images/bn_map.png and /dev/null differ
diff --git a/assets/images/verify_face.svg b/assets/images/verify_face.svg
new file mode 100644
index 0000000..e50d1a6
--- /dev/null
+++ b/assets/images/verify_face.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/images/verify_sms.svg b/assets/images/verify_sms.svg
new file mode 100644
index 0000000..ae5fa9f
--- /dev/null
+++ b/assets/images/verify_sms.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/images/verify_thumb.svg b/assets/images/verify_thumb.svg
new file mode 100644
index 0000000..e626baf
--- /dev/null
+++ b/assets/images/verify_thumb.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/images/verify_whatsapp.svg b/assets/images/verify_whatsapp.svg
new file mode 100644
index 0000000..09ac85c
--- /dev/null
+++ b/assets/images/verify_whatsapp.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json
index 55e73b0..bfa680d 100644
--- a/assets/langs/ar-SA.json
+++ b/assets/langs/ar-SA.json
@@ -6,6 +6,18 @@
"pleaseEnterLoginDetails": "Please enter the detail below to login",
"username": "Username",
"password": "Password",
+ "welcomeBack": "Welcome back",
+ "wouldYouLikeToLoginWithCurrentUsername": "Would you like to login with current Username?",
+ "lastLoginDetails": "Last Login Details:",
+ "verificationType": "Verification Type:",
+ "pleaseVerify": "Please Verify",
+ "verifyThroughFace": "Verify Through Face",
+ "verifyThroughFingerprint": "Verify Through Fingerprint",
+ "verifyThroughSMS": "Verify Through SMS",
+ "verifyThroughWhatsapp": "Verify Through Whatsapp",
+ "useAnotherAccount": "Use Another Account",
+ "pleaseEnterTheVerificationCodeSentTo": "Please enter the verification code sent to ",
+ "theVerificationCodeWillExpireIn": "The verification code will expire in ",
"title": "Hello",
"forgotPassword": "Forgot Password",
"msg": "Hello {} in the {} world ",
diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json
index 55e73b0..bfa680d 100644
--- a/assets/langs/en-US.json
+++ b/assets/langs/en-US.json
@@ -6,6 +6,18 @@
"pleaseEnterLoginDetails": "Please enter the detail below to login",
"username": "Username",
"password": "Password",
+ "welcomeBack": "Welcome back",
+ "wouldYouLikeToLoginWithCurrentUsername": "Would you like to login with current Username?",
+ "lastLoginDetails": "Last Login Details:",
+ "verificationType": "Verification Type:",
+ "pleaseVerify": "Please Verify",
+ "verifyThroughFace": "Verify Through Face",
+ "verifyThroughFingerprint": "Verify Through Fingerprint",
+ "verifyThroughSMS": "Verify Through SMS",
+ "verifyThroughWhatsapp": "Verify Through Whatsapp",
+ "useAnotherAccount": "Use Another Account",
+ "pleaseEnterTheVerificationCodeSentTo": "Please enter the verification code sent to ",
+ "theVerificationCodeWillExpireIn": "The verification code will expire in ",
"title": "Hello",
"forgotPassword": "Forgot Password",
"msg": "Hello {} in the {} world ",
diff --git a/lib/sikander_later_will_remove_to_parent_directory/api/api_client.dart b/lib/api/api_client.dart
similarity index 98%
rename from lib/sikander_later_will_remove_to_parent_directory/api/api_client.dart
rename to lib/api/api_client.dart
index 66828ee..afba61e 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/api/api_client.dart
+++ b/lib/api/api_client.dart
@@ -5,7 +5,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';
import 'package:http/io_client.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart';
+import 'package:mohem_flutter_app/exceptions/api_exception.dart';
typedef FactoryConstructor = U Function(dynamic);
diff --git a/lib/sikander_later_will_remove_to_parent_directory/api/tangheem_user_api_client.dart b/lib/api/tangheem_user_api_client.dart
similarity index 70%
rename from lib/sikander_later_will_remove_to_parent_directory/api/tangheem_user_api_client.dart
rename to lib/api/tangheem_user_api_client.dart
index 429902f..b849141 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/api/tangheem_user_api_client.dart
+++ b/lib/api/tangheem_user_api_client.dart
@@ -1,9 +1,9 @@
import 'dart:async';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/consts.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/member_model.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/surah_model.dart';
+import 'package:mohem_flutter_app/classes/consts.dart';
+import 'package:mohem_flutter_app/models/content_info_model.dart';
+import 'package:mohem_flutter_app/models/member_model.dart';
+import 'package:mohem_flutter_app/models/surah_model.dart';
import 'api_client.dart';
diff --git a/lib/sikander_later_will_remove_to_parent_directory/app_state/app_state.dart b/lib/app_state/app_state.dart
similarity index 69%
rename from lib/sikander_later_will_remove_to_parent_directory/app_state/app_state.dart
rename to lib/app_state/app_state.dart
index bbc6403..9303802 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/app_state/app_state.dart
+++ b/lib/app_state/app_state.dart
@@ -1,5 +1,5 @@
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/surah_model.dart';
+import 'package:mohem_flutter_app/models/content_info_model.dart';
+import 'package:mohem_flutter_app/models/surah_model.dart';
class AppState {
static final AppState _instance = AppState._internal();
diff --git a/lib/sikander_later_will_remove_to_parent_directory/classes/colors.dart b/lib/classes/colors.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/classes/colors.dart
rename to lib/classes/colors.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/classes/consts.dart b/lib/classes/consts.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/classes/consts.dart
rename to lib/classes/consts.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/classes/utils.dart b/lib/classes/utils.dart
similarity index 94%
rename from lib/sikander_later_will_remove_to_parent_directory/classes/utils.dart
rename to lib/classes/utils.dart
index 3aafdb1..4d26ed6 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/classes/utils.dart
+++ b/lib/classes/utils.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
// import 'package:fluttertoast/fluttertoast.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart';
+import 'package:mohem_flutter_app/exceptions/api_exception.dart';
class Utils {
static bool _isLoadingVisible = false;
diff --git a/lib/config/app_provider.dart b/lib/config/app_provider.dart
index 6f11d24..9ccf065 100644
--- a/lib/config/app_provider.dart
+++ b/lib/config/app_provider.dart
@@ -1,4 +1,3 @@
-import 'package:mohem_flutter_app/provider/counter.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -9,9 +8,10 @@ class AppProvider extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ return child;
return MultiProvider(
providers: [
- ChangeNotifierProvider(create: (_) => Counter()),
+ // ChangeNotifierProvider(create: (_) => Counter()),
],
child: child,
);
diff --git a/lib/config/background_loader.dart b/lib/config/background_loader.dart
deleted file mode 100644
index 0683157..0000000
--- a/lib/config/background_loader.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-//class which loads components "in the background", i.e. ui does not depend on it
-
-import 'package:mohem_flutter_app/services/shared_preferences.dart';
-import 'package:injector/injector.dart';
-//import 'package:revocheckapp/services/firebase_service.dart';
-
-
-class BackgroundLoader {
- Future loadBackgroundData() async {
- //init notification setting
- try {
- /*
- final isPromotionNotificationEnabled = await Injector.appInstance
- .getDependency()
- .promotionNotificationsEnabled;
- if (isPromotionNotificationEnabled == null) {
- await Injector.appInstance
- .getDependency()
- .setPromotionNotificationEnabled(true);
- Injector.appInstance
- .getDependency()
- .subscribeForPromotions();
- } */
- } catch (_) {
- //something wend wrong, set it to true
- await Injector.appInstance
- .getDependency()
- .setPromotionNotificationEnabled(true);
- /*Injector.appInstance
- .getDependency()
- .subscribeForPromotions();*/
- }
- }
-}
diff --git a/lib/config/constants.dart b/lib/config/constants.dart
deleted file mode 100644
index 87c2c46..0000000
--- a/lib/config/constants.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-enum YesOrNo {
- no,
- yes,
-}
-
-const String icons = "assets/icons/";
-const String categorySvgIcons = "assets/category/svg/";
-const String svgIcons = "assets/svg/";
diff --git a/lib/config/dependencies.dart b/lib/config/dependencies.dart
deleted file mode 100644
index 937ebc6..0000000
--- a/lib/config/dependencies.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// import 'package:firebase_crashlytics/firebase_crashlytics.dart';
-// import 'package:flutter/material.dart';
-
-import 'package:mohem_flutter_app/config/background_loader.dart';
-import 'package:mohem_flutter_app/repo/account_repository.dart';
-import 'package:injector/injector.dart';
-
-class AppDependencies {
- static void addDependencies() {
- Injector injector = Injector.appInstance;
-
- //add dependencies as needed
- injector.registerSingleton(() => AcRepository());
-
- // injector.registerSingleton((injector) => AcRepository());
-
- _addCrashlytics();
- _loadBackgroundTasksNonBlocking();
- }
-
- static void _addCrashlytics() {
- // Set `enableInDevMode` to true to see reports while in debug mode
- // This is only to be used for confirming that reports are being
- // submitted as expected. It is not intended to be used for everyday
- // development.
- //Crashlytics.instance.enableInDevMode = true;
-
- // Pass all uncaught errors from the framework to Crashlytics.
- // FlutterError.onError = Crashlytics.instance.recordFlutterError;
- }
-
- static void _loadBackgroundTasksNonBlocking() {
- final backgroundLoader = BackgroundLoader();
- backgroundLoader.loadBackgroundData();
- }
-}
diff --git a/lib/config/routes.dart b/lib/config/routes.dart
index 34505d0..d60f2b8 100644
--- a/lib/config/routes.dart
+++ b/lib/config/routes.dart
@@ -1,11 +1,14 @@
import 'package:flutter/material.dart';
-import 'package:mohem_flutter_app/pages/login/login_screen.dart';
+import 'package:mohem_flutter_app/ui/dashboard.dart';
+import 'package:mohem_flutter_app/ui/login/login_screen.dart';
+import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart';
class AppRoutes {
static const String splash = "/splash";
static const String registerSelection = "/registerSelection";
static const String loginVerifyAccount = "/loginVerifyAccount";
static const String login = "/login";
+ static const String verifyLogin = "/verifyLogin";
static const String forgetPassword = "/forgetPassword";
static const String loginVerification = "/loginVerification";
static const String dashboard = "/dashboard";
@@ -13,5 +16,7 @@ class AppRoutes {
static final Map routes = {
login: (context) => LoginScreen(),
+ verifyLogin: (context) => VerifyLoginScreen(),
+ dashboard: (context) => Dashboard(),
};
}
diff --git a/lib/dialogs/otp_dialog.dart b/lib/dialogs/otp_dialog.dart
new file mode 100644
index 0000000..3d625bf
--- /dev/null
+++ b/lib/dialogs/otp_dialog.dart
@@ -0,0 +1,235 @@
+import 'dart:async';
+
+import 'package:easy_localization/src/public_ext.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
+import 'package:mohem_flutter_app/extensions/int_extensions.dart';
+import 'package:mohem_flutter_app/extensions/string_extensions.dart';
+import 'package:mohem_flutter_app/widgets/otp_widget.dart';
+
+class OtpDialog {
+ final int type;
+ final int mobileNo;
+ final Function(String) onSuccess;
+ final Function onFailure;
+ final BuildContext context;
+
+ int remainingTime = 120;
+
+ Future? timer;
+
+ static BuildContext? _context;
+
+ static bool? _loading;
+
+ OtpDialog(
+ this.context,
+ this.type,
+ this.mobileNo,
+ this.onSuccess,
+ this.onFailure,
+ );
+
+ GlobalKey? verifyAccountForm = GlobalKey();
+
+ final TextEditingController _pinPutController = TextEditingController();
+
+ TextEditingController digit1 = TextEditingController(text: "");
+ TextEditingController digit2 = TextEditingController(text: "");
+ TextEditingController digit3 = TextEditingController(text: "");
+ TextEditingController digit4 = TextEditingController(text: "");
+
+ Map verifyAccountFormValue = {
+ 'digit1': '',
+ 'digit2': '',
+ 'digit3': '',
+ 'digit4': '',
+ };
+ final focusD1 = FocusNode();
+ final focusD2 = FocusNode();
+ final focusD3 = FocusNode();
+ final focusD4 = FocusNode();
+ String? errorMsg;
+
+ // ProjectViewModel projectProvider;
+ String displayTime = '';
+ String? _code;
+ dynamic setState;
+
+ // static String signature;
+
+ displayDialog(BuildContext context) async {
+ return showDialog(
+ context: context,
+ barrierColor: Colors.black.withOpacity(0.63),
+ builder: (context) {
+ // projectProvider = Provider.of(context);
+ return Dialog(
+ backgroundColor: Colors.white,
+ shape: RoundedRectangleBorder(),
+ insetPadding: EdgeInsets.only(left: 21, right: 21),
+ child: StatefulBuilder(builder: (context, setState) {
+ if (displayTime == '') {
+ startTimer(setState);
+ }
+
+ return Container(
+ padding: EdgeInsets.only(left: 21, right: 18, top: 39, bottom: 59),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ SvgPicture.asset(
+ type == 1 ? "assets/images/verify_sms.svg" : "assets/images/verify_whatsapp.svg",
+ height: 50,
+ width: 50,
+ ),
+ IconButton(
+ padding: EdgeInsets.zero,
+ icon: const Icon(Icons.close),
+ constraints: const BoxConstraints(),
+ onPressed: () {
+ Navigator.pop(context);
+ this.onFailure();
+ },
+ )
+ ],
+ ),
+ 22.height,
+ (LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16,
+ 18.height,
+ Directionality(
+ textDirection: TextDirection.ltr,
+ child: Center(
+ child: OTPWidget(
+ autoFocus: true,
+ controller: _pinPutController,
+ defaultBorderColor: const Color(0xffD8D8D8),
+ maxLength: 4,
+ onTextChanged: (text) {},
+ pinBoxColor: Colors.white,
+ onDone: (code) => _onOtpCallBack(code, null),
+ textBorderColor: const Color(0xffD8D8D8),
+ pinBoxWidth: 60,
+ pinBoxHeight: 60,
+ pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor),
+ pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition,
+ pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300),
+ pinBoxRadius: 10,
+ keyboardType: TextInputType.number,
+ ),
+ ),
+ ),
+ 30.height,
+ RichText(
+ text: TextSpan(
+ text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n',
+ style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48),
+ children: [
+ TextSpan(
+ text: displayTime,
+ style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ );
+ }),
+ );
+ });
+ }
+
+ InputDecoration buildInputDecoration(BuildContext context) {
+ return InputDecoration(
+ counterText: " ",
+ // ts/images/password_icon.png
+ // contentPadding: EdgeInsets.only(top: 20, bottom: 20),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(10)),
+ borderSide: BorderSide(color: Colors.black),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(10.0)),
+ borderSide: BorderSide(color: Theme.of(context).primaryColor),
+ ),
+ errorBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(10.0)),
+ borderSide: BorderSide(color: Theme.of(context).errorColor),
+ ),
+ focusedErrorBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.all(Radius.circular(10.0)),
+ borderSide: BorderSide(color: Theme.of(context).errorColor),
+ ),
+ );
+ }
+
+ // String validateCodeDigit(value) {
+ // if (value.isEmpty) {
+ // return ' ';
+ // } else if (value.length == 3) {
+ // print(value);
+ // } else {
+ // return null;
+ // }
+ // }
+
+ checkValue() {
+ //print(verifyAccountFormValue);
+ // if (verifyAccountForm?.currentState!.validate()) {
+ // onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString());
+ // }
+ }
+
+ getSecondsAsDigitalClock(int inputSeconds) {
+ var sec_num = int.parse(inputSeconds.toString()); // don't forget the second param
+ var hours = (sec_num / 3600).floor();
+ var minutes = ((sec_num - hours * 3600) / 60).floor();
+ var seconds = sec_num - hours * 3600 - minutes * 60;
+ var minutesString = "";
+ var secondsString = "";
+ minutesString = minutes < 10 ? "0" + minutes.toString() : minutes.toString();
+ secondsString = seconds < 10 ? "0" + seconds.toString() : seconds.toString();
+ return minutesString + ":" + secondsString;
+ }
+
+ startTimer(setState) {
+ this.remainingTime--;
+ setState(() {
+ displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
+ });
+
+ timer = Future.delayed(Duration(seconds: 1), () {
+ if (this.remainingTime > 0) {
+ startTimer(setState);
+ } else {
+ Navigator.pop(context);
+ }
+ });
+ }
+
+ static void hideSMSBox(context) {
+ Navigator.pop(context);
+ }
+
+ _onOtpCallBack(String otpCode, bool? isAutofill) {
+ if (otpCode.length == 4) {
+ onSuccess(otpCode);
+ }
+ }
+
+ static getSignature() async {
+ // if (Platform.isAndroid) {
+ // return await SmsRetriever.getAppSignature();
+ // } else {
+ // return null;
+ // }
+ }
+}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart b/lib/exceptions/api_exception.dart
similarity index 90%
rename from lib/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart
rename to lib/exceptions/api_exception.dart
index fa2b22c..e3046ca 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart
+++ b/lib/exceptions/api_exception.dart
@@ -1,6 +1,6 @@
import 'dart:convert';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/api/api_client.dart';
+import 'package:mohem_flutter_app/api/api_client.dart';
class APIException implements Exception {
static const String BAD_REQUEST = 'api_common_bad_request';
diff --git a/lib/sikander_later_will_remove_to_parent_directory/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/extensions/int_extensions.dart
rename to lib/extensions/int_extensions.dart
diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart
new file mode 100644
index 0000000..bd52c85
--- /dev/null
+++ b/lib/extensions/string_extensions.dart
@@ -0,0 +1,72 @@
+import 'package:flutter/cupertino.dart';
+import 'package:intl/intl.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
+
+extension EmailValidator on String {
+ Widget get toWidget => Text(this);
+
+ Widget toText10({Color? color}) => Text(
+ this,
+ style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4),
+ );
+
+ Widget toText12({Color? color, bool isUnderLine = false}) => Text(
+ this,
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null),
+ );
+
+ Widget get toText14 => Text(
+ this,
+ style: const TextStyle(color: MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.w600),
+ );
+
+ Widget get toText16 => Text(
+ this,
+ style: const TextStyle(color: MyColors.darkTextColor, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600),
+ );
+
+ Widget toText24({bool isBold = false}) => Text(
+ this,
+ style: TextStyle(color: MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
+ );
+
+ bool isValidEmail() {
+ return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this);
+ }
+
+ String toFormattedDate() {
+ String date = this.split("T")[0];
+ String time = this.split("T")[1];
+ var dates = date.split("-");
+ return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}";
+ }
+
+ getMonth(int month) {
+ switch (month) {
+ case 1:
+ return "January";
+ case 2:
+ return "February";
+ case 3:
+ return "March";
+ case 4:
+ return "April";
+ case 5:
+ return "May";
+ case 6:
+ return "June";
+ case 7:
+ return "July";
+ case 8:
+ return "August";
+ case 9:
+ return "September";
+ case 10:
+ return "October";
+ case 11:
+ return "November";
+ case 12:
+ return "December";
+ }
+ }
+}
diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart
new file mode 100644
index 0000000..787894d
--- /dev/null
+++ b/lib/extensions/widget_extensions.dart
@@ -0,0 +1,11 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+
+extension WidgetExtensions on Widget {
+ Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this);
+
+ Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
+
+ Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
+ Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
+}
diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart
index 6d49427..c0810e9 100644
--- a/lib/generated/codegen_loader.g.dart
+++ b/lib/generated/codegen_loader.g.dart
@@ -22,6 +22,18 @@ class CodegenLoader extends AssetLoader{
"pleaseEnterLoginDetails": "Please enter the detail below to login",
"username": "Username",
"password": "Password",
+ "welcomeBack": "Welcome back",
+ "wouldYouLikeToLoginWithCurrentUsername": "Would you like to login with current Username?",
+ "lastLoginDetails": "Last Login Details:",
+ "verificationType": "Verification Type:",
+ "pleaseVerify": "Please Verify",
+ "verifyThroughFace": "Verify Through Face",
+ "verifyThroughFingerprint": "Verify Through Fingerprint",
+ "verifyThroughSMS": "Verify Through SMS",
+ "verifyThroughWhatsapp": "Verify Through Whatsapp",
+ "useAnotherAccount": "Use Another Account",
+ "pleaseEnterTheVerificationCodeSentTo": "Please enter the verification code sent to ",
+ "theVerificationCodeWillExpireIn": "The verification code will expire in ",
"title": "Hello",
"forgotPassword": "Forgot Password",
"msg": "Hello {} in the {} world ",
@@ -68,6 +80,18 @@ static const Map en_US = {
"pleaseEnterLoginDetails": "Please enter the detail below to login",
"username": "Username",
"password": "Password",
+ "welcomeBack": "Welcome back",
+ "wouldYouLikeToLoginWithCurrentUsername": "Would you like to login with current Username?",
+ "lastLoginDetails": "Last Login Details:",
+ "verificationType": "Verification Type:",
+ "pleaseVerify": "Please Verify",
+ "verifyThroughFace": "Verify Through Face",
+ "verifyThroughFingerprint": "Verify Through Fingerprint",
+ "verifyThroughSMS": "Verify Through SMS",
+ "verifyThroughWhatsapp": "Verify Through Whatsapp",
+ "useAnotherAccount": "Use Another Account",
+ "pleaseEnterTheVerificationCodeSentTo": "Please enter the verification code sent to ",
+ "theVerificationCodeWillExpireIn": "The verification code will expire in ",
"title": "Hello",
"forgotPassword": "Forgot Password",
"msg": "Hello {} in the {} world ",
diff --git a/lib/main.dart b/lib/main.dart
index 5964efe..b118397 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,7 +1,6 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/config/app_provider.dart';
-import 'package:mohem_flutter_app/config/dependencies.dart';
import 'package:mohem_flutter_app/generated/codegen_loader.g.dart';
import 'package:mohem_flutter_app/theme/app_theme.dart';
import 'package:sizer/sizer.dart';
@@ -32,7 +31,7 @@ Future main() async {
class MyApp extends StatelessWidget {
MyApp() {
- AppDependencies.addDependencies();
+// AppDependencies.addDependencies();
}
@override
diff --git a/lib/models/account.dart b/lib/models/account.dart
deleted file mode 100644
index 830b62f..0000000
--- a/lib/models/account.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// To parse this JSON data, do
-//
-// final account = accountFromJson(jsonString);
-
-import 'dart:convert';
-
-import 'package:mohem_flutter_app/models/parent_list.dart';
-
-
-
-Account accountFromJson(String str) => Account.fromJson(json.decode(str));
-
-String accountToJson(Account data) => json.encode(data.toJson());
-
-class Account {
- Account({
- required this.parentList,
- required this.selectedItem,
- });
-
- List? parentList;
- int selectedItem;
-
- factory Account.fromJson(Map json) => Account(
- parentList: json["parentList"] == null
- ? null
- : List.from(
- json["parentList"].map((x) => ParentList.fromJson(x))),
- selectedItem:
- json["selectedItem"] == null ? null : json["selectedItem"],
- );
-
- Map toJson() => {
- "parentList": parentList == null
- ? null
- : List.from(parentList!.map((x) => x.toJson())),
- "selectedItem": selectedItem == null ? null : selectedItem,
- };
-
- Map toJsonData() => {
- "selectedItem": selectedItem == null ? null : selectedItem,
- };
-}
diff --git a/lib/models/config_model.dart b/lib/models/config_model.dart
deleted file mode 100644
index 0245ede..0000000
--- a/lib/models/config_model.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-class ConfigModel {
- ConfigModel(this.endpoint, this.organizationName);
-
- String endpoint;
-
- String organizationName;
-
- factory ConfigModel.fromJson(Map json) =>
- ConfigModel("", "");
-
-// Map toJson() => _$ConfigModelToJson(this);
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart b/lib/models/content_info_model.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart
rename to lib/models/content_info_model.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/models/member_model.dart b/lib/models/member_model.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/models/member_model.dart
rename to lib/models/member_model.dart
diff --git a/lib/models/parent_list.dart b/lib/models/parent_list.dart
deleted file mode 100644
index 3f2286f..0000000
--- a/lib/models/parent_list.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-class ParentList {
- ParentList({
- required this.dbId,
- required this.text,
- required this.path,
- required this.isSelected,
- });
-
- int dbId;
- String text;
- String path;
- bool isSelected;
-
- factory ParentList.fromJson(Map json) => ParentList(
- dbId: json["dbId"] == null ? null : json["dbId"],
- text: json["text"] == null ? null : json["text"],
- path: json["path"] == null ? null : json["path"],
- isSelected: false,
- );
-
- Map toJson() => {
- "dbId": dbId == null ? null : dbId,
- "text": text == null ? null : text,
- "path": path == null ? null : path,
- };
-}
diff --git a/lib/models/response_models.dart b/lib/models/response_models.dart
deleted file mode 100644
index 872893b..0000000
--- a/lib/models/response_models.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-///
-/// This example was taken from
-/// https://flutter.dev/docs/development/data-and-backend/json
-///
-
-/// This allows the `User` class to access private members in
-/// the generated file. The value for this is *.g.dart, where
-/// the star denotes the source file name.
-
-/// An annotation for the code generator to know that this class needs the
-/// JSON serialization logic to be generated.
-
-class BackendResponse {
- BackendResponse({required this.id, required this.isOk, required this.result});
-
- int id;
- bool isOk;
- dynamic result;
-
- /// A necessary factory constructor for creating a new User instance
- /// from a map. Pass the map to the generated `_$UserFromJson()` constructor.
- /// The constructor is named after the source class, in this case, User.
- factory BackendResponse.fromJson(Map json) =>
- BackendResponse(
- id: 1,
- isOk: false,
- result: null,
- );
-//
-// /// `toJson` is the convention for a class to declare support for serialization
-// /// to JSON. The implementation simply calls the private, generated
-// /// helper method `_$UserToJson`.
-// Map toJson() => _$BackendResponseToJson(this);
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/models/surah_model.dart b/lib/models/surah_model.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/models/surah_model.dart
rename to lib/models/surah_model.dart
diff --git a/lib/models/user.dart b/lib/models/user.dart
deleted file mode 100644
index e09c282..0000000
--- a/lib/models/user.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-class User {
- int id;
-
- User(this.id, this.userName, this.userImage, this.createdDate);
-
- String userName;
- String userImage;
- String createdDate;
-}
diff --git a/lib/pages/a.dart b/lib/pages/a.dart
deleted file mode 100644
index e69de29..0000000
diff --git a/lib/pages/user/splash_page.dart b/lib/pages/user/splash_page.dart
deleted file mode 100644
index c593f56..0000000
--- a/lib/pages/user/splash_page.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-import 'dart:async';
-
-import 'package:mohem_flutter_app/config/routes.dart';
-import 'package:mohem_flutter_app/utils/navigator.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-
-class SplashPage extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Container(
- width: double.infinity,
- height: double.infinity,
- child: Column(
- children: [
- mFlex(5),
- Txt(
- "Logo",
- fontSize: 45,
- bold: true,
- ),
- mFlex(3),
- Txt(
- "First Time Log In",
- txtType: TxtType.heading1,
- isFlatButton: true,
- onTap: () {
- navigateWithName(context, AppRoutes.registerSelection);
- },
- ),
- mFlex(1),
- Txt(
- "Already Signed Up and Logged In",
- txtType: TxtType.heading1,
- isFlatButton: true,
- onTap: () {
- navigateWithName(context, AppRoutes.loginVerification);
- },
- ),
- mFlex(5),
- ],
- ),
- ),
- );
- }
-}
diff --git a/lib/provider/counter.dart b/lib/provider/counter.dart
deleted file mode 100644
index 0272327..0000000
--- a/lib/provider/counter.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-
-class Counter with ChangeNotifier, DiagnosticableTreeMixin {
- int _count = 0;
-
- int get count => _count;
-
- void increment() {
- _count++;
- notifyListeners();
- }
-
- /// Makes `Counter` readable inside the devtools by listing all of its properties
- @override
- void debugFillProperties(DiagnosticPropertiesBuilder properties) {
- super.debugFillProperties(properties);
- properties.add(IntProperty('count', count));
- }
-}
\ No newline at end of file
diff --git a/lib/repo/account_repository.dart b/lib/repo/account_repository.dart
deleted file mode 100644
index 770cbb4..0000000
--- a/lib/repo/account_repository.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:mohem_flutter_app/models/account.dart';
-import 'package:mohem_flutter_app/models/response_models.dart';
-import 'package:mohem_flutter_app/services/backend_service.dart';
-import 'package:injector/injector.dart';
-
-abstract class IAcRepository {
- Future getAccountList();
-
- Future updateAccount(String dataAsJson);
-}
-
-class AcRepository implements IAcRepository {
- static const String ACCOUNT_API_CONTROLLER_MOBILE =
- "AccountApiControllerMobile/";
-
- static const String ACCOUNT_LIST = ACCOUNT_API_CONTROLLER_MOBILE + "list";
- static const String UPDATE_LIST =
- ACCOUNT_API_CONTROLLER_MOBILE + "saveaccountselected";
-
- @override
- Future getAccountList() async {
- BackendResponse response = await Injector.appInstance
- .getDependency()
- .getAuthenticatedAPI(ACCOUNT_LIST);
-
- if (response != null && response.isOk) {
- return Account.fromJson(response.result);
- } else {
- throw Exception();
- }
- }
-
- @override
- Future updateAccount(String dataAsJson) async {
- BackendResponse response = await Injector.appInstance
- .getDependency()
- .postAuthenticatedAPI(UPDATE_LIST, dataAsJson);
-
- if (response != null && response.isOk) {
- //if parsing failed, throw exception
- return response;
- } else {
- throw Exception();
- }
- }
-}
diff --git a/lib/services/backend_service.dart b/lib/services/backend_service.dart
deleted file mode 100644
index b2e4de0..0000000
--- a/lib/services/backend_service.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-import 'dart:convert';
-import 'dart:io';
-import 'package:mohem_flutter_app/models/response_models.dart';
-import 'package:mohem_flutter_app/services/secure_storage.dart';
-import 'package:http/http.dart';
-import 'package:injector/injector.dart';
-
-import 'http_service.dart';
-import 'network_service.dart';
-
-abstract class IBackendApiService {
- Future getUnauthenticatedAPI(String route);
-
- Future getAuthenticatedAPI(String route);
-
- Future postUnauthenticatedAPI(
- String route, String dataAsJson);
-
- Future postAuthenticatedAPI(String route, String dataAsJson);
-
- Future deleteAuthenticatedAPI(String route, String id);
-}
-
-class BackendApiService implements IBackendApiService {
- static String _homeUrl = "https://check.revotec.eu/check2/";
- static String _serverApiBaseUrl = _homeUrl + "mapi/v1/";
-
- static String get homeUrl => _homeUrl;
-
- final ISecureStorage _secureStorage =
- Injector.appInstance.getDependency();
- final IHttpService _httpService =
- Injector.appInstance.getDependency();
-
- ///internal helper functions which executes the given api call
- ///and wraps the response
- Future _callApi(Future callback) async {
- Response response;
- try {
- //execute future
- response = await callback;
- //check response code, and if not ok return isOk = false
- //200 for Get
- //201 for Post
-
- // print("res121: " +
- // response.statusCode.toString() +
- // " Body:" +
- // response.body.toString());
- //if delete request sent so server is returning 204 in case of success.
- if (response.statusCode == 204)
- return BackendResponse(id: 1, isOk: true, result: null);
-
- if (response.statusCode != 200 && response.statusCode != 201)
- return BackendResponse(id: -1, isOk: false, result: null);
- //if response code is good then parse message and return parsed response
- return BackendResponse.fromJson(json.decode(response.body));
- //return BackendResponse.fromJson(dioResponse.body);
- } catch (e) {
- return BackendResponse(id: -1, isOk: false, result: null);
- // try {
- // return BackendResponse.fromJson(json.decode(response.body));
- // } catch (e) {
- // return BackendResponse(id:-1, isOk:false,result: null);
- // }
- }
- }
-
- @override
- Future getAuthenticatedAPI(String route) async {
- await checkConnection();
- final token = await _secureStorage.readBearerToken();
- return _callApi(_httpService.get(_serverApiBaseUrl + route, headers: {
- 'Content-Type': 'application/json',
- 'Accept': '*/*',
- HttpHeaders.authorizationHeader: "Bearer $token"
- }));
- }
-
- @override
- Future getUnauthenticatedAPI(String route) async {
- await checkConnection();
- return _callApi(_httpService.get(_serverApiBaseUrl + route,
- headers: {'Content-Type': 'application/json', 'Accept': '*/*'}));
- }
-
- @override
- Future postAuthenticatedAPI(
- String route, String dataAsJson) async {
- await checkConnection();
- final token = await _secureStorage.readBearerToken();
- // print("res121: " + _serverApiBaseUrl + route);
- return _callApi(_httpService
- .post(_serverApiBaseUrl + route, body: dataAsJson, headers: {
- 'Content-Type': 'application/json',
- 'Accept': '*/*',
- HttpHeaders.authorizationHeader: "Bearer $token"
- }));
- }
-
- @override
- Future postUnauthenticatedAPI(
- String route, String dataAsJson) async {
- await checkConnection();
- return _callApi(_httpService.post(_serverApiBaseUrl + route,
- body: dataAsJson, headers: {'Content-Type': 'application/json'}));
- }
-
- Future checkConnection() async {
- if (!(await Injector.appInstance
- .getDependency()
- .isHostAvailable(_homeUrl))) throw NetworkException();
- }
-
- @override
- Future deleteAuthenticatedAPI(
- String route, String id) async {
- await checkConnection();
- final token = await _secureStorage.readBearerToken();
- return _callApi(
- _httpService.delete(_serverApiBaseUrl + route + "/" + id, headers: {
- 'Content-Type': 'application/json',
- 'Accept': '*/*',
- HttpHeaders.authorizationHeader: "Bearer $token"
- }));
- }
-}
diff --git a/lib/services/firebase_service.dart b/lib/services/firebase_service.dart
deleted file mode 100644
index ad76959..0000000
--- a/lib/services/firebase_service.dart
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-import 'dart:io' show Platform;
-import 'package:firebase_messaging/firebase_messaging.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_local_notifications/flutter_local_notifications.dart';
-
-abstract class IFirebaseService {
- Future get token;
-
- Future backgroundMessageHandler(Map message);
-
- Future messageHandler(Map message);
-
- Future onLaunch(Map message);
-
- Future onResume(Map message);
-
- void subscribeForPromotions();
-
- void unsubscribeFromPromotions();
-}
-
-//https://medium.com/@SebastianEngel/easy-push-notifications-with-flutter-and-firebase-cloud-messaging-d96084f5954f
-class FirebaseService implements IFirebaseService {
- FirebaseMessaging _firebaseMessaging;
-
- FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
-
- FirebaseService() {.
- _firebaseMessaging = FirebaseMessaging();
-
- //https://github.com/FirebaseExtended/flutterfire/issues/1695
- _firebaseMessaging.configure(
- onMessage: messageHandler,
- onBackgroundMessage:
- Platform.isAndroid ? myBackgroundMessageHandler : null,
- onLaunch: onLaunch,
- onResume: onResume,
- );
-
- //monitor firebase token changes
- //https://firebase.google.com/docs/cloud-messaging/android/client#sample-register
- ///The registration token may change when:
- //
- //The app deletes Instance ID
- //The app is restored on a new device
- //The user uninstalls/reinstall the app
- //The user clears app data.
- ///
-
- //for the first release we don't care about token refreshes
- /*Stream fcmStream = _firebaseMessaging.onTokenRefresh;
- fcmStream.listen((token) {
-
- });*/
-
- //ios specific settings
- //taken from https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/example/lib/main.dart
- _firebaseMessaging.requestNotificationPermissions(
- const IosNotificationSettings(
- sound: true, badge: true, alert: true, provisional: true));
- _firebaseMessaging.onIosSettingsRegistered
- .listen((IosNotificationSettings settings) {
- print("Settings registered: $settings");
- });
-
- var initializationSettingsAndroid =
- AndroidInitializationSettings('app_icon');
- var initializationSettingsIOS =
- IOSInitializationSettings(onDidReceiveLocalNotification: onDidReceiveLocalNotification);
- var initializationSettings = InitializationSettings(
- initializationSettingsAndroid, initializationSettingsIOS);
- flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
- flutterLocalNotificationsPlugin.initialize(initializationSettings,
- onSelectNotification: selectNotification);
- }
-
- Future onDidReceiveLocalNotification(int id, String title, String body, String payload) async{
- var androidPlatformChannelSpecifics = AndroidNotificationDetails(
- 'new_message_channel_id',
- 'Neue Nachricht',
- 'Channel für neue Nachrichten',
- importance: Importance.Max,
- priority: Priority.High,
- ticker: 'ticker');
- var iOSPlatformChannelSpecifics = IOSNotificationDetails();
- var platformChannelSpecifics = NotificationDetails(
- androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
- await flutterLocalNotificationsPlugin.show(
- 0,
- title,
- body,
- platformChannelSpecifics);
- }
-
- @override
- Future backgroundMessageHandler(Map message) async {
- await myBackgroundMessageHandler(message);
- }
-
- @override
- Future messageHandler(Map message) async {
- print("onMessage: $message");
-
-// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
-
- var androidPlatformChannelSpecifics = AndroidNotificationDetails(
- 'new_message_channel_id',
- 'Neue Nachricht',
- 'Channel für neue Nachrichten',
- importance: Importance.Max,
- priority: Priority.High,
- ticker: 'ticker');
- var iOSPlatformChannelSpecifics = IOSNotificationDetails();
- var platformChannelSpecifics = NotificationDetails(
- androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
-
- if(Platform.isAndroid) {
- await flutterLocalNotificationsPlugin.show(
- 0,
- message["notification"]["title"],
- message["notification"]["body"],
- platformChannelSpecifics);
- }else if(Platform.isIOS){
- await flutterLocalNotificationsPlugin.show(
- 0,
- message["aps"]["alert"]["title"],
- message["aps"]["alert"]["body"],
- platformChannelSpecifics);
- }
- }
-
- Future selectNotification(String payload) async {
- if (payload != null) {
- debugPrint('notification payload: ' + payload);
- }
- }
-
- @override
- Future onLaunch(Map message) async {
- print("onLaunch: $message");
- }
-
- @override
- Future onResume(Map message) async {
- print("onResume: $message");
- }
-
- @override
- Future get token => _firebaseMessaging.getToken();
-
- @override
- void subscribeForPromotions() {
- _firebaseMessaging.subscribeToTopic("promotions");
- }
-
- @override
- void unsubscribeFromPromotions() {
- _firebaseMessaging.unsubscribeFromTopic("promotions");
- }
-}
-
-Future myBackgroundMessageHandler(Map message) {
- debugPrint("BACKGROUND MESSAGE RECEIVED");
- print("BACKGROUND MESSAGE RECEIVED");
- return Future.value(() => true);
-
- /*if (message.containsKey('data')) {
- // Handle data message
- final dynamic data = message['data'];
- }
-
- if (message.containsKey('notification')) {
- // Handle notification message
- final dynamic notification = message['notification'];
- }*/
-
- // Or do other work.
-}
-*/
\ No newline at end of file
diff --git a/lib/services/http_service.dart b/lib/services/http_service.dart
deleted file mode 100644
index b2cb73a..0000000
--- a/lib/services/http_service.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-import 'dart:convert';
-import 'dart:io';
-import 'dart:async';
-
-
-import 'package:http/http.dart' as http;
-import 'package:http/http.dart';
-
-abstract class IHttpService {
- Future post(url,
- {Map headers, body, Encoding encoding});
-
- Future get(url, {Map headers});
-
- Future delete(url, {Map headers});
-}
-
-class HttpService implements IHttpService {
- @override
- Future delete(url, {Map? headers}) {
- return http.delete(url, headers: headers);
- }
-
- @override
- Future get(url, {Map? headers}) {
- return http.get(url, headers: headers);
- }
-
- @override
- Future post(url,
- {Map? headers, body, Encoding? encoding}) {
- return http.post(url, headers: headers, body: body, encoding: encoding);
- }
-}
diff --git a/lib/services/media_service.dart b/lib/services/media_service.dart
deleted file mode 100644
index 0762d7f..0000000
--- a/lib/services/media_service.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// import 'dart:io';
-//
-// import 'package:image_picker/image_picker.dart';
-//
-// abstract class IMediaService {
-// Future takePicture();
-//
-// Future openImageFromGallery();
-// }
-//
-// class MediaService implements IMediaService {
-// @override
-// Future openImageFromGallery() async {
-// final pickedFile =
-// await ImagePicker().getImage(source: ImageSource.gallery);
-// if (pickedFile == null) return null;
-// return File(pickedFile.path);
-// }
-//
-// @override
-// Future takePicture() async {
-// final pickedFile = await ImagePicker().getImage(source: ImageSource.camera);
-// if (pickedFile == null) return null;
-// return File(pickedFile.path);
-// }
-// }
diff --git a/lib/services/network_service.dart b/lib/services/network_service.dart
deleted file mode 100644
index 50a861d..0000000
--- a/lib/services/network_service.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-
-import 'dart:io';
-
-abstract class INetworkService {
- Future isHostAvailable(String endpoint);
-}
-
-class NetworkService implements INetworkService{
- @override
- Future isHostAvailable(String endpoint) async {
- try {
- final result = await InternetAddress.lookup(endpoint.substring(endpoint.indexOf('//')+2).substring(0,endpoint.substring(endpoint.indexOf('//')+2).indexOf('/')));
- if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
- return true;
- } else{
- return false;
- }
- } on SocketException catch (_) {
- return false;
- }
- }
-}
-
-class NetworkException implements Exception {
-}
diff --git a/lib/services/secure_storage.dart b/lib/services/secure_storage.dart
deleted file mode 100644
index 7622f7f..0000000
--- a/lib/services/secure_storage.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-abstract class ISecureStorage {
- Future readBearerToken();
-
- Future clearUserCredentials();
-}
-
-class SecureStorage implements ISecureStorage {
- ///return bearer token if present, or null if not
- @override
- Future readBearerToken() async {
- try {
- return "";
- } catch (_) {
- //an error occured returning null
- return "";
- }
- }
-
- ///returns true if write was successful, false otherwise
- @override
- Future writeBearerToken(String token) async {
- try {
- await "";
- return true;
- } catch (_) {
- //an error occured returning false
- return false;
- }
- }
-
- @override
- Future clearUserCredentials() async {}
-}
diff --git a/lib/services/shared_preferences.dart b/lib/services/shared_preferences.dart
deleted file mode 100644
index 890a616..0000000
--- a/lib/services/shared_preferences.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-import 'dart:convert';
-
-import 'package:mohem_flutter_app/models/config_model.dart';
-
-import 'package:shared_preferences/shared_preferences.dart'
-as SharedPrefsPlugin;
-
-///
-/// Taken from AlarmGuide Project
-///
-
-abstract class ISharedPreferences {
- Future get authState;
-
- Future setAuthState(int authState);
-
- Future get configState;
-
- Future setConfigState(int confState);
-
- Future get config;
-
- Future setConfig(ConfigModel config);
-
- Future get promotionNotificationsEnabled;
-
- Future setPromotionNotificationEnabled(bool newSetting);
-
- Future get helpAlreadyShown;
-
- Future setHelpAlreadyShown();
-
- Future get useS3;
-
- Future setUseS3(int value);
-}
-
-class SharedPreferences implements ISharedPreferences {
- static const String _AUTH_STATE_KEY = "auth_key";
- static const String _CONFIG_KEY = "config";
- static const String _CONFIG_STATE_KEY = "config_key";
- static const String _PROMOTION_NOTIFICATION_KEY = "promotion";
- static const String _HELP_ALREADY_SHOWN = "help_shown";
- static const String _USE_S3 = "s3";
-
- @override
- Future get authState async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- return sharedPrefs.getInt(_AUTH_STATE_KEY);
- }
-
- @override
- Future setAuthState(int authState) async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setInt(_AUTH_STATE_KEY, authState);
- }
-
- @override
- Future get config async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- final configAsJson = sharedPrefs.getString(_CONFIG_KEY);
- return ConfigModel.fromJson(jsonDecode(configAsJson!));
- }
-
- @override
- Future setConfig(ConfigModel config) async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setString(_CONFIG_KEY, jsonEncode(config));
- setConfigState(1);
- }
-
- @override
- Future get promotionNotificationsEnabled async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- return sharedPrefs.getBool(_PROMOTION_NOTIFICATION_KEY);
- }
-
- @override
- Future setPromotionNotificationEnabled(bool newSetting) async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setBool(_PROMOTION_NOTIFICATION_KEY, newSetting);
- }
-
- @override
- Future get helpAlreadyShown async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- return sharedPrefs.getBool(_HELP_ALREADY_SHOWN);
- }
-
- @override
- Future setHelpAlreadyShown() async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setBool(_HELP_ALREADY_SHOWN, true);
- }
-
- @override
- Future get configState async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- return sharedPrefs.getInt(_CONFIG_STATE_KEY);
- }
-
- @override
- Future setConfigState(int confState) async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setInt(_CONFIG_STATE_KEY, confState);
- }
-
- @override
- Future setUseS3(int value) async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- sharedPrefs.setInt(_USE_S3, value);
- }
-
- @override
- Future get useS3 async {
- final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance();
- return sharedPrefs.getInt(_USE_S3);
- }
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/extensions/string_extensions.dart b/lib/sikander_later_will_remove_to_parent_directory/extensions/string_extensions.dart
deleted file mode 100644
index db84adf..0000000
--- a/lib/sikander_later_will_remove_to_parent_directory/extensions/string_extensions.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:intl/intl.dart';
-
-extension EmailValidator on String {
- Widget toWidget() => Text(this);
-
- bool isValidEmail() {
- return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this);
- }
-
- String toFormattedDate() {
- String date = this.split("T")[0];
- String time = this.split("T")[1];
- var dates = date.split("-");
- return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}";
- }
-
- getMonth(int month) {
- switch (month) {
- case 1:
- return "January";
- case 2:
- return "February";
- case 3:
- return "March";
- case 4:
- return "April";
- case 5:
- return "May";
- case 6:
- return "June";
- case 7:
- return "July";
- case 8:
- return "August";
- case 9:
- return "September";
- case 10:
- return "October";
- case 11:
- return "November";
- case 12:
- return "December";
- }
- }
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/extensions/widget_extensions.dart b/lib/sikander_later_will_remove_to_parent_directory/extensions/widget_extensions.dart
deleted file mode 100644
index 6f5e013..0000000
--- a/lib/sikander_later_will_remove_to_parent_directory/extensions/widget_extensions.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
-
-extension WidgetExtensions on Widget {
- Widget onPress(VoidCallback onTap) => InkWell(
- onTap: onTap,
- child: this,
- );
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/widgets/otp_widget.dart b/lib/sikander_later_will_remove_to_parent_directory/widgets/otp_widget.dart
deleted file mode 100644
index bf03b72..0000000
--- a/lib/sikander_later_will_remove_to_parent_directory/widgets/otp_widget.dart
+++ /dev/null
@@ -1,373 +0,0 @@
-// import 'dart:async';
-//
-// import 'package:flutter/animation.dart';
-// import 'package:flutter/foundation.dart';
-// import 'package:flutter/material.dart';
-// import 'package:flutter/rendering.dart';
-// import 'package:flutter/services.dart';
-//
-// typedef OnDone = void Function(String text);
-//
-// class ProvidedPinBoxTextAnimation {
-// static AnimatedSwitcherTransitionBuilder scalingTransition = (child, animation) {
-// return ScaleTransition(
-// child: child,
-// scale: animation,
-// );
-// };
-//
-// static AnimatedSwitcherTransitionBuilder defaultNoTransition = (Widget child, Animation animation) {
-// return child;
-// };
-// }
-//
-// class OTPWidget extends StatefulWidget {
-// final int maxLength;
-// final TextEditingController controller;
-//
-// final Color defaultBorderColor;
-// final Color pinBoxColor;
-// final double pinBoxBorderWidth;
-// final double pinBoxRadius;
-// final bool hideDefaultKeyboard;
-//
-// final TextStyle pinTextStyle;
-// final double pinBoxHeight;
-// final double pinBoxWidth;
-// final OnDone onDone;
-// final bool hasError;
-// final Color errorBorderColor;
-// final Color textBorderColor;
-// final Function(String) onTextChanged;
-// final bool autoFocus;
-// final FocusNode focusNode;
-// final AnimatedSwitcherTransitionBuilder pinTextAnimatedSwitcherTransition;
-// final Duration pinTextAnimatedSwitcherDuration;
-// final TextDirection textDirection;
-// final TextInputType keyboardType;
-// final EdgeInsets pinBoxOuterPadding;
-//
-// const OTPWidget({
-// Key key,
-// this.maxLength: 4,
-// this.controller,
-// this.pinBoxWidth: 70.0,
-// this.pinBoxHeight: 70.0,
-// this.pinTextStyle,
-// this.onDone,
-// this.defaultBorderColor: Colors.black,
-// this.textBorderColor: Colors.black,
-// this.pinTextAnimatedSwitcherTransition,
-// this.pinTextAnimatedSwitcherDuration: const Duration(),
-// this.hasError: false,
-// this.errorBorderColor: Colors.red,
-// this.onTextChanged,
-// this.autoFocus: false,
-// this.focusNode,
-// this.textDirection: TextDirection.ltr,
-// this.keyboardType: TextInputType.number,
-// this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0),
-// this.pinBoxColor = Colors.white,
-// this.pinBoxBorderWidth = 2.0,
-// this.pinBoxRadius = 0,
-// this.hideDefaultKeyboard = false,
-// }) : super(key: key);
-//
-// @override
-// State createState() {
-// return OTPWidgetState();
-// }
-// }
-//
-// class OTPWidgetState extends State with SingleTickerProviderStateMixin {
-// AnimationController _highlightAnimationController;
-// FocusNode focusNode;
-// String text = "";
-// int currentIndex = 0;
-// List strList = [];
-// bool hasFocus = false;
-//
-// @override
-// void didUpdateWidget(OTPWidget oldWidget) {
-// super.didUpdateWidget(oldWidget);
-// focusNode = widget.focusNode ?? focusNode;
-//
-// if (oldWidget.maxLength < widget.maxLength) {
-// setState(() {
-// currentIndex = text.length;
-// });
-// widget.controller?.text = text;
-// widget.controller?.selection = TextSelection.collapsed(offset: text.length);
-// } else if (oldWidget.maxLength > widget.maxLength && widget.maxLength > 0 && text.length > 0 && text.length > widget.maxLength) {
-// setState(() {
-// text = text.substring(0, widget.maxLength);
-// currentIndex = text.length;
-// });
-// widget.controller?.text = text;
-// widget.controller?.selection = TextSelection.collapsed(offset: text.length);
-// }
-// }
-//
-// _calculateStrList() {
-// if (strList.length > widget.maxLength) {
-// strList.length = widget.maxLength;
-// }
-// while (strList.length < widget.maxLength) {
-// strList.add("");
-// }
-// }
-//
-// @override
-// void initState() {
-// super.initState();
-// focusNode = widget.focusNode ?? FocusNode();
-//
-// _initTextController();
-// _calculateStrList();
-// widget.controller?.addListener(_controllerListener);
-// focusNode?.addListener(_focusListener);
-// }
-//
-// void _controllerListener() {
-// if (mounted == true) {
-// setState(() {
-// _initTextController();
-// });
-// var onTextChanged = widget.onTextChanged;
-// if (onTextChanged != null) {
-// onTextChanged(widget.controller?.text ?? "");
-// }
-// }
-// }
-//
-// void _focusListener() {
-// if (mounted == true) {
-// setState(() {
-// hasFocus = focusNode?.hasFocus ?? false;
-// });
-// }
-// }
-//
-// void _initTextController() {
-// if (widget.controller == null) {
-// return;
-// }
-// strList.clear();
-// var text = widget.controller?.text ?? "";
-// if (text.isNotEmpty) {
-// if (text.length > widget.maxLength) {
-// throw Exception("TextEditingController length exceeded maxLength!");
-// }
-// }
-// for (var i = 0; i < text.length; i++) {
-// strList.add(text[i]);
-// }
-// }
-//
-// double get _width {
-// var width = 0.0;
-// for (var i = 0; i < widget.maxLength; i++) {
-// width += widget.pinBoxWidth;
-// if (i == 0) {
-// width += widget.pinBoxOuterPadding.left;
-// } else if (i + 1 == widget.maxLength) {
-// width += widget.pinBoxOuterPadding.right;
-// } else {
-// width += widget.pinBoxOuterPadding.left;
-// }
-// }
-// return width;
-// }
-//
-// @override
-// void dispose() {
-// if (widget.focusNode == null) {
-// focusNode?.dispose();
-// } else {
-// focusNode?.removeListener(_focusListener);
-// }
-// _highlightAnimationController?.dispose();
-// widget.controller?.removeListener(_controllerListener);
-//
-// super.dispose();
-// }
-//
-// @override
-// Widget build(BuildContext context) {
-// return Stack(
-// children: [
-// _otpTextInput(),
-// _touchPinBoxRow(),
-// ],
-// );
-// }
-//
-// Widget _touchPinBoxRow() {
-// return widget.hideDefaultKeyboard
-// ? _pinBoxRow(context)
-// : GestureDetector(
-// behavior: HitTestBehavior.opaque,
-// onTap: () {
-// if (hasFocus) {
-// FocusScope.of(context).requestFocus(FocusNode());
-// Future.delayed(Duration(milliseconds: 100), () {
-// FocusScope.of(context).requestFocus(focusNode);
-// });
-// } else {
-// FocusScope.of(context).requestFocus(focusNode);
-// }
-// },
-// child: _pinBoxRow(context),
-// );
-// }
-//
-// Widget _otpTextInput() {
-// var transparentBorder = OutlineInputBorder(
-// borderSide: BorderSide(
-// color: Colors.transparent,
-// width: 0.0,
-// ),
-// );
-// return Container(
-// width: _width,
-// height: widget.pinBoxHeight,
-// child: TextField(
-// autofocus: !kIsWeb ? widget.autoFocus : false,
-// enableInteractiveSelection: false,
-// focusNode: focusNode,
-// controller: widget.controller,
-// keyboardType: widget.keyboardType,
-// inputFormatters: widget.keyboardType == TextInputType.number ? [FilteringTextInputFormatter.digitsOnly] : null,
-// style: TextStyle(
-// height: 0.1,
-// color: Colors.transparent,
-// ),
-// decoration: InputDecoration(
-// contentPadding: EdgeInsets.all(0),
-// focusedErrorBorder: transparentBorder,
-// errorBorder: transparentBorder,
-// disabledBorder: transparentBorder,
-// enabledBorder: transparentBorder,
-// focusedBorder: transparentBorder,
-// counterText: null,
-// counterStyle: null,
-// helperStyle: TextStyle(
-// height: 0.0,
-// color: Colors.transparent,
-// ),
-// labelStyle: TextStyle(height: 0.1),
-// fillColor: Colors.transparent,
-// border: InputBorder.none,
-// ),
-// cursorColor: Colors.transparent,
-// showCursor: false,
-// maxLength: widget.maxLength,
-// onChanged: _onTextChanged,
-// ),
-// );
-// }
-//
-// void _onTextChanged(text) {
-// var onTextChanged = widget.onTextChanged;
-// if (onTextChanged != null) {
-// onTextChanged(text);
-// }
-// setState(() {
-// this.text = text;
-// if (text.length >= currentIndex) {
-// for (int i = currentIndex; i < text.length; i++) {
-// strList[i] = text[i];
-// }
-// }
-// currentIndex = text.length;
-// });
-// if (text.length == widget.maxLength) {
-// FocusScope.of(context).requestFocus(FocusNode());
-// var onDone = widget.onDone;
-// if (onDone != null) {
-// onDone(text);
-// }
-// }
-// }
-//
-// Widget _pinBoxRow(BuildContext context) {
-// _calculateStrList();
-// List pinCodes = List.generate(widget.maxLength, (int i) {
-// return _buildPinCode(i, context);
-// });
-// return Row(children: pinCodes, mainAxisSize: MainAxisSize.min);
-// }
-//
-// Widget _buildPinCode(int i, BuildContext context) {
-// Color borderColor;
-// Color pinBoxColor = widget.pinBoxColor;
-//
-// if (widget.hasError) {
-// borderColor = widget.errorBorderColor;
-// } else if (i < text.length) {
-// borderColor = widget.textBorderColor;
-// } else {
-// borderColor = widget.defaultBorderColor;
-// pinBoxColor = widget.pinBoxColor;
-// }
-//
-// EdgeInsets insets;
-// if (i == 0) {
-// insets = EdgeInsets.only(
-// left: 0,
-// top: widget.pinBoxOuterPadding.top,
-// right: widget.pinBoxOuterPadding.right,
-// bottom: widget.pinBoxOuterPadding.bottom,
-// );
-// } else if (i == strList.length - 1) {
-// insets = EdgeInsets.only(
-// left: widget.pinBoxOuterPadding.left,
-// top: widget.pinBoxOuterPadding.top,
-// right: 0,
-// bottom: widget.pinBoxOuterPadding.bottom,
-// );
-// } else {
-// insets = widget.pinBoxOuterPadding;
-// }
-// return Container(
-// key: ValueKey("container$i"),
-// alignment: Alignment.center,
-// padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 1.0),
-// margin: insets,
-// child: _animatedTextBox(strList[i], i),
-// decoration: BoxDecoration(
-// border: Border.all(
-// color: borderColor,
-// width: widget.pinBoxBorderWidth,
-// ),
-// color: pinBoxColor,
-// borderRadius: BorderRadius.circular(widget.pinBoxRadius),
-// ),
-// width: widget.pinBoxWidth,
-// height: widget.pinBoxHeight,
-// );
-// }
-//
-// Widget _animatedTextBox(String text, int i) {
-// if (widget.pinTextAnimatedSwitcherTransition != null) {
-// return AnimatedSwitcher(
-// duration: widget.pinTextAnimatedSwitcherDuration,
-// transitionBuilder: widget.pinTextAnimatedSwitcherTransition ??
-// (Widget child, Animation animation) {
-// return child;
-// },
-// child: Text(
-// text,
-// key: ValueKey("$text$i"),
-// style: widget.pinTextStyle,
-// ),
-// );
-// } else {
-// return Text(
-// text,
-// key: ValueKey("${strList[i]}$i"),
-// style: widget.pinTextStyle,
-// );
-// }
-// }
-// }
diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart
index e081009..aed8437 100644
--- a/lib/theme/app_theme.dart
+++ b/lib/theme/app_theme.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/theme/colors.dart';
class AppTheme {
@@ -34,7 +34,7 @@ class AppTheme {
primaryTextTheme: const TextTheme(
bodyText2: TextStyle(color: Colors.white),
),
- iconTheme: const IconThemeData(),
+ iconTheme: const IconThemeData(color: MyColors.darkIconColor),
textTheme: const TextTheme(
bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6),
headline1: TextStyle(color: Colors.white, letterSpacing: 0.6),
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/bottom_sheets/country_selection_bottom_sheet.dart b/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/bottom_sheets/country_selection_bottom_sheet.dart
rename to lib/ui/bottom_sheets/country_selection_bottom_sheet.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/common_appbar.dart b/lib/ui/common_appbar.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/common_appbar.dart
rename to lib/ui/common_appbar.dart
diff --git a/lib/ui/dashboard.dart b/lib/ui/dashboard.dart
new file mode 100644
index 0000000..f6699ae
--- /dev/null
+++ b/lib/ui/dashboard.dart
@@ -0,0 +1,27 @@
+import 'package:flutter/material.dart';
+
+class Dashboard extends StatefulWidget {
+ Dashboard({Key? key}) : super(key: key);
+
+ @override
+ _DashboardState createState() {
+ return _DashboardState();
+ }
+}
+
+class _DashboardState extends State {
+ @override
+ void initState() {
+ super.initState();
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold();
+ }
+}
\ No newline at end of file
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/change_password_dialog.dart b/lib/ui/dialogs/change_password_dialog.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/change_password_dialog.dart
rename to lib/ui/dialogs/change_password_dialog.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/general_dialog.dart b/lib/ui/dialogs/general_dialog.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/general_dialog.dart
rename to lib/ui/dialogs/general_dialog.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/loading_dialog.dart b/lib/ui/dialogs/loading_dialog.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/loading_dialog.dart
rename to lib/ui/dialogs/loading_dialog.dart
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/otp_dialog.dart b/lib/ui/dialogs/otp_dialog.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/dialogs/otp_dialog.dart
rename to lib/ui/dialogs/otp_dialog.dart
diff --git a/lib/pages/login/login_screen.dart b/lib/ui/login/login_screen.dart
similarity index 88%
rename from lib/pages/login/login_screen.dart
rename to lib/ui/login/login_screen.dart
index 8fd0244..6e043bd 100644
--- a/lib/pages/login/login_screen.dart
+++ b/lib/ui/login/login_screen.dart
@@ -2,11 +2,12 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
+import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/extensions/int_extensions.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/extensions/widget_extensions.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/widgets/input_widget.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
+import 'package:mohem_flutter_app/extensions/int_extensions.dart';
+import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
+import 'package:mohem_flutter_app/widgets/input_widget.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
class LoginScreen extends StatefulWidget {
@@ -94,8 +95,9 @@ class _LoginScreenState extends State {
),
DefaultButton(LocaleKeys.login.tr(), () async {
// context.setLocale(const Locale("en", "US")); // to change Loacle
- })
- .insideContainer
+
+ Navigator.pushNamed(context, AppRoutes.verifyLogin);
+ }).insideContainer
],
),
);
diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart
new file mode 100644
index 0000000..e661456
--- /dev/null
+++ b/lib/ui/login/verify_login_screen.dart
@@ -0,0 +1,700 @@
+import 'package:easy_localization/src/public_ext.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:local_auth/local_auth.dart';
+import 'package:mohem_flutter_app/classes/colors.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/extensions/widget_extensions.dart';
+import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
+import 'package:mohem_flutter_app/widgets/button/default_button.dart';
+
+class VerifyLoginScreen extends StatefulWidget {
+ VerifyLoginScreen({Key? key}) : super(key: key);
+
+ @override
+ _VerifyLoginScreenState createState() {
+ return _VerifyLoginScreenState();
+ }
+}
+
+class _VerifyLoginScreenState extends State {
+ final LocalAuthentication auth = LocalAuthentication();
+ List _availableBioMetricType = [];
+
+ @override
+ void initState() {
+ _getAvailableBiometrics();
+ // setDefault();
+ super.initState();
+ }
+
+ @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),
+ ),
+ actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width],
+ ),
+ body: Column(
+ children: [
+ Expanded(
+ child: ListView(
+ padding: const EdgeInsets.all(21),
+ physics: const BouncingScrollPhysics(),
+ children: [
+ //12.height,
+ if (true)
+ Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ LocaleKeys.welcomeBack.tr().toText12(),
+ "Mohammad Hussain".toText24(isBold: true),
+ 10.height,
+ LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16,
+ Container(
+ height: 72,
+ margin: const EdgeInsets.only(top: 23, bottom: 23),
+ alignment: Alignment.center,
+ padding: EdgeInsets.only(left: 17, right: 12),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(10),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ LocaleKeys.lastLoginDetails.tr().toText16,
+ // Text(
+ // user.editedOn != null
+ // ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn))
+ // : user.createdOn != null
+ // ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn))
+ // : '--',
+ // style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48),
+ // ),
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ LocaleKeys.verificationType.tr().toText10(color: MyColors.greyColor),
+ Text(
+ "SMS",
+ // " " + getType(user.logInType, context),
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ ),
+ ),
+ Expanded(child: SizedBox()),
+ // Text(
+ // user.editedOn != null
+ // ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn), false)
+ // : user.createdOn != null
+ // ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn), false)
+ // : '--',
+ // style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48),
+ // ),
+ ],
+ )
+ ],
+ ),
+ ),
+ LocaleKeys.pleaseVerify.tr().toText16,
+ GridView(
+ gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
+ physics: const NeverScrollableScrollPhysics(),
+ padding: const EdgeInsets.only(top: 9),
+ shrinkWrap: true,
+ children: [
+ getButton(3),
+ getButton(2),
+ getButton(1),
+ getButton(4),
+ ],
+ )
+ ],
+ )
+ // else
+ // Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
+ // Image.asset(
+ // 'assets/images/habib-logo.png',
+ // height: 90,
+ // width: 90,
+ // ),
+ // SizedBox(height: 23),
+ // this.onlySMSBox == false
+ // ? Text(
+ // TranslationBase.of(context).verifyLoginWith,
+ // style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16),
+ // )
+ // : Text(
+ // TranslationBase.of(context).verifyFingerprint2,
+ // style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16),
+ // ),
+ // SizedBox(height: 23),
+ // Text(
+ // TranslationBase.of(context).pleaseVerify,
+ // style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
+ // ),
+ // GridView(
+ // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
+ // physics: NeverScrollableScrollPhysics(),
+ // padding: EdgeInsets.only(top: 9),
+ // shrinkWrap: true,
+ // children: [
+ // if (onlySMSBox == false) getButton(3),
+ // if (onlySMSBox == false) getButton(2),
+ // getButton(1),
+ // getButton(4),
+ // ],
+ // ),
+ // ]),
+ ],
+ ),
+ ),
+ 12.height,
+ DefaultButton(
+ LocaleKeys.useAnotherAccount.tr(),
+ () => {
+ //Navigator.of(context).pushNamed(LOGIN_TYPE)
+ },
+ ).insideContainer,
+ ],
+ ),
+ );
+ }
+
+ Future _getAvailableBiometrics() async {
+ try {
+ _availableBioMetricType = await auth.getAvailableBiometrics();
+ } on PlatformException catch (e) {
+ // AppToast.showErrorToast(message: e.message);
+ print(e);
+ }
+ if (mounted) setState(() {});
+ }
+
+ // authenticateUser(int type, {int isActive}) {
+ // GifLoaderDialogUtils.showMyDialog(context);
+ // if (type == 2 || type == 3) {
+ // fingrePrintBefore = type;
+ // }
+ // this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type;
+ //
+ // switch (type) {
+ // case 1:
+ // this.loginWithSMS(type);
+ // break;
+ // case 2:
+ // this.loginWithFingurePrintFace(type, isActive);
+ // break;
+ // case 3:
+ // this.loginWithFingurePrintFace(type, isActive);
+ // break;
+ // case 4:
+ // this.loginWithSMS(type);
+ // break;
+ // default:
+ // break;
+ // }
+ // sharedPref.setInt(LAST_LOGIN, this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
+ // }
+//
+// loginWithSMS(type) {
+// //if (!el.disabled) {
+// if (this.user != null && this.registerd_data == null) {
+// this.checkUserAuthentication(type);
+// } else {
+// if (this.loginTokenID != null) {
+// // Future.delayed(Duration(seconds: 1), () {
+// this.sendActivationCode(type);
+// // });
+// } else {
+// this.checkUserAuthentication(type);
+// }
+// }
+// }
+//
+// checkUserAuthentication(type) {
+// showLoader(true);
+// var req = getCommonRequest(type: type);
+// req.logInTokenID = "";
+//
+// var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
+//
+// sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
+// authService
+// .checkPatientAuthentication(request)
+// .then((value) => {
+// GifLoaderDialogUtils.hideDialog(context),
+// if (value['isSMSSent'])
+// {
+// sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
+// this.loginTokenID = value['LogInTokenID'],
+// sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
+// // Future.delayed(Duration(seconds: 1), () {
+// this.sendActivationCode(type)
+// // })
+// }
+// else
+// {
+// if (value['IsAuthenticated']) {this.checkActivationCode()}
+// }
+// })
+// .catchError((err) {
+// print(err);
+// GifLoaderDialogUtils.hideDialog(context);
+// });
+// }
+//
+// sendActivationCode(type) async {
+// var request = this.getCommonRequest(type: type);
+// request.sMSSignature = await SMSOTP.getSignature();
+// GifLoaderDialogUtils.showMyDialog(context);
+// if (healthId != null) {
+// // final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
+// // final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
+// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
+// request.healthId = healthId;
+// request.isHijri = isHijri;
+// await this.authService.sendActivationCodeRegister(request).then((result) {
+// GifLoaderDialogUtils.hideDialog(context);
+// if (result != null && result['isSMSSent'] == true) {
+// this.startSMSService(type);
+// }
+// }).catchError((r) {
+// GifLoaderDialogUtils.hideDialog(context);
+// });
+// } else {
+// request.dob = "";
+// request.healthId = "";
+// request.isHijri = 0;
+// await this.authService.sendActivationCode(request).then((result) {
+// GifLoaderDialogUtils.hideDialog(context);
+// if (result != null && result['isSMSSent'] == true) {
+// this.startSMSService(type);
+// }
+// }).catchError((r) {
+// GifLoaderDialogUtils.hideDialog(context);
+// });
+// }
+// }
+//
+// var tempType;
+//
+// startSMSService(type) {
+// tempType = type;
+// new SMSOTP(
+// context,
+// type,
+// this.mobileNumber,
+// (value) {
+// this.checkActivationCode(value: value);
+// },
+// () => {
+// Navigator.pop(context),
+// },
+// ).displayDialog(context);
+// }
+//
+// loginWithFingurePrintFace(type, int isActive) async {
+// if (isActive == 1 || isActive == 0) {
+// const iosStrings =
+// const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
+//
+// try {
+// authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings);
+// } on PlatformException catch (e) {
+// GifLoaderDialogUtils.hideDialog(context);
+// AppToast.showErrorToast(message: 'Please enable your Touch or Face ID');
+// }
+//
+// if (authenticated == true) {
+// // if (user != null && (user.logInType == 2 || user.logInType == 3)) {
+// // this.checkActivationCode();
+// // } else {
+//
+// var request = this.getCommonRequest(type: type);
+// this.getMobileInfo(request);
+// //}
+// }
+// }
+// }
+//
+// getMobileInfo(request) {
+// // GifLoaderDialogUtils.showMyDialog(context);
+// this.authService.getLoginInfo(request).then((result) {
+// GifLoaderDialogUtils.hideDialog(context);
+// if (result['SMSLoginRequired'] == false) {
+// this.loginTokenID = result['LogInTokenID'];
+// this.patientOutSA = result['PatientOutSA'];
+// // sms for register the biometric
+// if (result['isSMSSent']) {
+// setState(() {
+// isMoreOption = true;
+// this.onlySMSBox = true;
+// // this.fingrePrintBefore = true;
+// });
+// //this.button();
+// } else {
+// setDefault();
+// checkActivationCode();
+// }
+// } else {
+// if (result['IsAuthenticated'] == true) {
+// setState(() {
+// isMoreOption = true;
+// this.onlySMSBox = true;
+// // this.fingrePrintBefore = true;
+// });
+// }
+// }
+// }).catchError((err) {
+// GifLoaderDialogUtils.hideDialog(context);
+// print(err);
+// });
+// }
+//
+// setDefault() async {
+// if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA));
+//
+// if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) {
+// isMoreOption = true;
+// this.registerd_data = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
+// }
+//
+// this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile);
+// this.zipCode = this.registerd_data != null
+// ? this.registerd_data.zipCode
+// : this.user.outSA == true
+// ? "971"
+// : "966";
+// this.patientOutSA = this.registerd_data != null
+// ? this.registerd_data.zipCode == "966"
+// ? 0
+// : 1
+// : this.user.outSA;
+// if (this.registerd_data != null) {
+// this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID);
+// this.loginType = this.registerd_data.searchType;
+// }
+// var nhic = await sharedPref.getObject(NHIC_DATA);
+// if (nhic != null) {
+// final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
+// final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
+// dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
+//
+// isHijri = nhic['IsHijri'] ? 1 : 0;
+// healthId = nhic['HealthId'];
+// }
+// this.deviceToken = await sharedPref.getString(PUSH_TOKEN);
+// this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null
+// ? await sharedPref.getInt(LAST_LOGIN)
+// : user != null
+// ? user.logInType
+// : null;
+//
+// //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN);
+// }
+//
+// getCommonRequest({type}) {
+// var request = SendActivationRequest();
+// request.patientMobileNumber = this.mobileNumber;
+// request.mobileNo = '0' + this.mobileNumber.toString();
+// request.deviceToken = this.deviceToken;
+// request.projectOutSA = this.patientOutSA == true ? true : false;
+// request.loginType = this.selectedOption;
+// request.oTPSendType = type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2;
+// request.zipCode = this.zipCode;
+//
+// request.logInTokenID = this.loginTokenID ?? "";
+//
+// if (this.registerd_data != null) {
+// request.searchType = this.registerd_data.searchType != null ? this.registerd_data.searchType : 1;
+// request.patientID = this.registerd_data.patientID != null ? this.registerd_data.patientID : 0;
+// request.patientIdentificationID = request.nationalID = this.registerd_data.patientIdentificationID != null ? this.registerd_data.patientIdentificationID : '0';
+//
+// request.isRegister = this.registerd_data.isRegister;
+// } else {
+// request.searchType = request.searchType != null ? request.searchType : 2;
+// request.patientID = this.user.patientID != null ? this.user.patientID : 0;
+// request.nationalID = request.nationalID != null ? request.nationalID : '0';
+// request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0';
+// request.isRegister = false;
+// }
+// request.deviceTypeID = request.searchType;
+// return request;
+// }
+//
+// // checkActivationCode({value}) async {
+// // // Navigator.pop(context);
+// // GifLoaderDialogUtils.showMyDialog(context);
+// // var request = this.getCommonRequest().toJson();
+// // dynamic res;
+// // if (healthId != null) {
+// // request['DOB'] = dob;
+// // request['HealthId'] = healthId;
+// // request['IsHijri'] = isHijri;
+// //
+// // authService
+// // .checkActivationCodeRegister(request, value)
+// // .then((result) => {
+// // res = result,
+// // if (result is Map)
+// // {
+// // result = CheckActivationCode.fromJson(result),
+// // if (this.registerd_data != null && this.registerd_data.isRegister == true)
+// // {
+// // widget.changePageViewIndex(1),
+// // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
+// // }
+// // }
+// // else
+// // {
+// // // Navigator.of(context).pop(),
+// // GifLoaderDialogUtils.hideDialog(context),
+// // Future.delayed(Duration(seconds: 1), () {
+// // AppToast.showErrorToast(message: result);
+// // }),
+// // }
+// // })
+// // .catchError((err) {
+// // print(err);
+// // GifLoaderDialogUtils.hideDialog(context);
+// // Future.delayed(Duration(seconds: 1), () {
+// // AppToast.showErrorToast(message: err);
+// // startSMSService(tempType);
+// // });
+// // });
+// // } else {
+// // authService
+// // .checkActivationCode(request, value)
+// // .then((result) => {
+// // res = result,
+// // if (result is Map)
+// // {
+// // result = CheckActivationCode.fromJson(result),
+// // if (this.registerd_data != null && this.registerd_data.isRegister == true)
+// // {
+// // widget.changePageViewIndex(1),
+// // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
+// // }
+// // else
+// // {
+// // sharedPref.remove(FAMILY_FILE),
+// // result.list.isFamily = false,
+// // userData = result.list,
+// // sharedPref.setString(BLOOD_TYPE, result.patientBloodType),
+// // authenticatedUserObject.user = result.list,
+// // projectViewModel.setPrivilege(privilegeList: res),
+// // sharedPref.setObject(MAIN_USER, result.list),
+// // sharedPref.setObject(USER_PROFILE, result.list),
+// // loginTokenID = result.logInTokenID,
+// // sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
+// // sharedPref.setString(TOKEN, result.authenticationTokenID),
+// // checkIfUserAgreedBefore(result),
+// // }
+// // }
+// // else
+// // {
+// // // // Navigator.of(context).pop(),
+// // // GifLoaderDialogUtils.hideDialog(context),
+// // // Future.delayed(Duration(seconds: 1), () {
+// // // AppToast.showErrorToast(message: result);
+// // // startSMSService(tempType);
+// // // }),
+// // }
+// // })
+// // .catchError((err) {
+// // // print(err);
+// // // GifLoaderDialogUtils.hideDialog(context);
+// // // Future.delayed(Duration(seconds: 1), () {
+// // // AppToast.showErrorToast(message: err);
+// // // startSMSService(tempType);
+// // // });
+// // });
+// // }
+// // }
+//
+// // checkIfUserAgreedBefore(CheckActivationCode result) {
+// // if (result.isNeedUserAgreement == true) {
+// // //move to agreement page.
+// // } else {
+// // goToHome();
+// // }
+// // }
+//
+// insertIMEI() {
+// authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) {
+// print(err);
+// });
+// }
+//
+// // getToDoCount() {
+// // toDoProvider.setState(0, true, "0");
+// // ClinicListService service = new ClinicListService();
+// // service.getActiveAppointmentNo(context).then((res) {
+// // if (res['MessageStatus'] == 1) {
+// // toDoProvider.setState(res['AppointmentActiveNumber'], true, "0");
+// // } else {}
+// // }).catchError((err) {
+// // print(err);
+// // });
+// // }
+//
+// // goToHome() async {
+// // authenticatedUserObject.isLogin = true;
+// // appointmentRateViewModel.isLogin = true;
+// // projectViewModel.isLogin = true;
+// // projectViewModel.user = authenticatedUserObject.user;
+// // await authenticatedUserObject.getUser(getUser: true);
+// //
+// // // getToDoCount();
+// //
+// // appointmentRateViewModel
+// // .getIsLastAppointmentRatedList()
+// // .then((value) => {
+// // getToDoCount(),
+// // GifLoaderDialogUtils.hideDialog(AppGlobal.context),
+// // if (appointmentRateViewModel.isHaveAppointmentNotRate)
+// // {
+// // Navigator.pushAndRemoveUntil(
+// // context,
+// // FadePage(
+// // page: RateAppointmentDoctor(),
+// // ),
+// // (r) => false)
+// // }
+// // else
+// // {
+// // Navigator.pushAndRemoveUntil(
+// // context,
+// // FadePage(
+// // page: LandingPage(),
+// // ),
+// // (r) => false)
+// // },
+// // insertIMEI()
+// // })
+// // .catchError((err) {
+// // print(err);
+// // });
+// // }
+//
+// loading(flag) {
+// // setState(() {
+// // isLoading = flag;
+// // });
+// }
+//
+ Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
+ bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 2 && !checkBiometricIsAvailable(BiometricType.fingerprint)));
+ print("$_title:$isDisable");
+ return InkWell(
+ onTap: isDisable
+ ? null
+ : () {
+ if (_flag == 0) {
+ setState(() {
+ // isMoreOption = true;
+ });
+ } else {
+ OtpDialog(
+ context,
+ _flag,
+ //this.mobileNumber
+ 0554870506,
+ (value) {
+ Navigator.pushReplacementNamed(context, AppRoutes.dashboard);
+ // this.checkActivationCode(value: value);
+ },
+ () => {
+ Navigator.pop(context),
+ },
+ ).displayDialog(context);
+
+ // authenticateUser(_flag, isActive: _loginIndex);
+ }
+ },
+ child: Container(
+ padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white,
+ border: Border.all(color: MyColors.lightGreyColor, width: 1),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ SvgPicture.asset(
+ _icon,
+ height: 38,
+ width: 38,
+ color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
+ ),
+ _title.toText16
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget getButton(int flag) {
+ switch (flag) {
+ case 4:
+ return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/verify_whatsapp.svg', flag, null);
+ case 1:
+ return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/verify_sms.svg', flag, null);
+ case 2:
+ return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/verify_thumb.svg', flag, BiometricType.fingerprint.index);
+ case 3:
+ return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/verify_face.svg', flag, BiometricType.face.index);
+ default:
+ return const SizedBox();
+ }
+ }
+
+ bool checkBiometricIsAvailable(BiometricType biometricType) {
+ bool isAvailable = false;
+ for (int i = 0; i < _availableBioMetricType.length; i++) {
+ if (biometricType == _availableBioMetricType[i]) {
+ isAvailable = true;
+ break;
+ }
+ }
+ return isAvailable;
+ }
+//
+// formatDate(date) {
+// return date;
+// return DateFormat('MMM dd, yyy, kk:mm').format(date);
+// }
+//
+// showLoader(bool isTrue) {
+// setState(() {
+// // isLoading = isTrue;
+// });
+// }
+
+}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/misc/no_data_ui.dart b/lib/ui/misc/no_data_ui.dart
similarity index 87%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/misc/no_data_ui.dart
rename to lib/ui/misc/no_data_ui.dart
index d7110ed..5af6af7 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/ui/misc/no_data_ui.dart
+++ b/lib/ui/misc/no_data_ui.dart
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
class NoDataUI extends StatelessWidget {
NoDataUI({Key? key}) : super(key: key);
diff --git a/lib/sikander_later_will_remove_to_parent_directory/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart
similarity index 100%
rename from lib/sikander_later_will_remove_to_parent_directory/ui/screens/tangheem_detail_screen.dart
rename to lib/ui/screens/tangheem_detail_screen.dart
diff --git a/lib/utils/AppPermissionHandler.dart b/lib/utils/AppPermissionHandler.dart
deleted file mode 100644
index 3e3877e..0000000
--- a/lib/utils/AppPermissionHandler.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-import 'package:permission_handler/permission_handler.dart';
-
-import 'dialogs.dart';
-
-enum ConfirmAction { CANCEL, ACCEPT }
-
-Future requestPermissionGranted(
- context, Permission requestPermissions) async {
- var result = await requestPermissions.request();
-
- switch (result) {
- case PermissionStatus.granted:
- // Application has been given permission to use the feature.
- return true;
- case PermissionStatus.denied:
- // Application has been denied permission to use the feature.
- return false;
- case PermissionStatus.permanentlyDenied:
- ConfirmAction? res = await showConfirmDialogs(
- context,
- 'You was denied Permission. You have give manual permission from app setting. ',
- 'Open App Setting',
- 'Cancel');
- if (res == ConfirmAction.ACCEPT) {
- return false;
- } else if (res == ConfirmAction.CANCEL) {
- return false;
- }
- return false;
- case PermissionStatus.restricted:
- // iOS has restricted access to a specific feature.
- return false;
- default:
- return false;
- }
-}
diff --git a/lib/utils/dialogs.dart b/lib/utils/dialogs.dart
deleted file mode 100644
index a6bff7e..0000000
--- a/lib/utils/dialogs.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'AppPermissionHandler.dart';
-
-Future showConfirmDialogs(
- context, msg, positiveText, negativeText) async {
- return showDialog(
- context: context,
- barrierDismissible: false,
- builder: (context) {
- return AlertDialog(
- backgroundColor: Colors.white,
- title: Text(msg, style: TextStyle(fontSize: 16)),
- actions: [
- TextButton(
- child: Text(
- negativeText,
- ),
- onPressed: () {
- Navigator.of(context).pop(ConfirmAction.CANCEL);
- },
- ),
- TextButton(
- child: Text(
- positiveText,
- ),
- onPressed: () {
- Navigator.of(context).pop(ConfirmAction.ACCEPT);
- },
- )
- ],
- );
- },
- );
-}
diff --git a/lib/utils/navigator.dart b/lib/utils/navigator.dart
deleted file mode 100644
index f9855a9..0000000
--- a/lib/utils/navigator.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:flutter/material.dart';
-
-navigateWithName(BuildContext context, String routeName, {Object? arguments}) {
- Navigator.pushNamed(context, routeName, arguments: arguments);
-}
-
-pop(BuildContext context) {
- Navigator.of(context).pop();
-}
diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
deleted file mode 100644
index a599b3a..0000000
--- a/lib/utils/utils.dart
+++ /dev/null
@@ -1,311 +0,0 @@
-import 'dart:convert';
-import 'dart:io';
-import 'dart:typed_data';
-import 'dart:ui';
-
-import 'package:mohem_flutter_app/config/constants.dart';
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_svg/svg.dart';
-
-import 'package:sizer/sizer.dart';
-
-Color getColorFromHex(String hexColor) {
- hexColor = hexColor.toUpperCase().replaceAll('#', '');
-
- if (hexColor.length == 6) {
- hexColor = 'FF' + hexColor;
- }
-
- return Color(int.parse(hexColor, radix: 16));
-}
-
-Widget spacerVertical(double v) {
- return Container(
- height: v,
- width: double.infinity,
- );
-}
-Future delay(int millis) async {
- return await Future.delayed(Duration(milliseconds: millis));
-}
-
-inkWellCorner({double? r}) {
- return RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(r ?? 4),
- );
-}
-
-Widget spacerHorizontal(double v) {
- return Container(
- height: v,
- width: v,
- );
-}
-
-Widget mHeight(double f) {
- return Container(
- width: f,
- height: f,
- );
-}
-
-Widget mDivider(Color color, {double? h}) {
- return Container(
- width: double.infinity,
- height: h ?? 1,
- color: color,
- );
-}
-
-Widget mDivider3({double? h}) {
- return Container(
- width: double.infinity,
- height: h ?? 1,
- color: borderLightColor!.withOpacity(0.7)
- );
-}
-
-Widget mDivider2(Color color, double w) {
- return Container(
- width: w,
- height: 1,
- color: color,
- );
-}
-
-InputDecoration txtField(String label) {
- return new InputDecoration(
- border: InputBorder.none,
- focusedBorder: InputBorder.none,
- enabledBorder: InputBorder.none,
- errorBorder: InputBorder.none,
- hintText: label,
- hintStyle: TextStyle(color: Colors.grey),
- disabledBorder: InputBorder.none,
- isDense: false,
- contentPadding: EdgeInsets.only(left: 15, right: 15),
- );
-}
-
-Widget mWidth(double f) {
- return Container(
- width: f,
- height: f,
- );
-}
-
-Widget mFlex(int f) {
- return Flexible(
- flex: f,
- child: Container(
- width: double.infinity,
- height: double.infinity,
- ),
- );
-}
-Widget mExp(int f) {
- return Expanded(
- flex: f,
- child: Container(
- width: double.infinity,
- ),
- );
-}
-
-spacer() {
- return SizedBox(
- height: 8,
- );
-}
-
-Widget floatButton(String icon, {Color? color, required Function onClick, String? title}) {
- return Padding(
- padding: const EdgeInsets.only(top: 12, bottom: 12),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- FloatingActionButton(
- onPressed: () {
- onClick();
- },
- heroTag: icon,
- backgroundColor: accentColor,
- elevation: 4,
- child: Container(
- child: SvgPicture.asset(
- categorySvgIcons + icon,
- color: color,
- ),
- width: double.infinity,
- height: double.infinity,
- decoration: containerRadius(Colors.white, 200),
- clipBehavior: Clip.antiAlias,
- padding: EdgeInsets.all(15),
- margin: EdgeInsets.all(1),
- ),
- ),
- if (title != null) mHeight(2.w),
- if (title != null)
- Txt(
- title,
- fontSize: 12.sp,
- bold: true,
- color: headingColor,
- )
- ],
- ),
- );
-}
-
-navigateTo(context, page) {
- Navigator.push(context, MaterialPageRoute(builder: (context) => page));
-}
-
-circularImage(String im, double width, double height) {
- return new Container(width: 190.0, height: 190.0, decoration: new BoxDecoration(shape: BoxShape.circle, image: new DecorationImage(fit: BoxFit.fill, image: new AssetImage(im))));
-}
-
-circularImage2(String im, double width, double height) {
- return new Container(width: width, height: height, decoration: new BoxDecoration(shape: BoxShape.circle, image: new DecorationImage(fit: BoxFit.fill, image: new AssetImage(im))));
-}
-
-cardRadius(double radius) {
- return RoundedRectangleBorder(
- side: BorderSide(color: Colors.transparent, width: 1),
- borderRadius: BorderRadius.circular(radius),
- );
-}
-
-cardRadiusWithoutBorder(double radius) {
- return RoundedRectangleBorder(
- side: BorderSide(color: Colors.transparent, width: 1),
- borderRadius: BorderRadius.circular(radius),
- );
-}
-
-Image imageFromBase64String(String base64String) {
- return Image.memory(base64Decode(base64String));
-}
-
-Uint8List dataFromBase64String(String base64String) {
- return base64Decode(base64String);
-}
-
-String base64String(Uint8List data) {
- return base64Encode(data);
-}
-
-Widget overLayWidget({double? width, double? height,List? color}) {
- return Container(
- width: width ?? double.infinity,
- height: height ?? 60,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: color!=null?color:[
- Colors.black.withOpacity(0.2),
- Colors.black.withOpacity(0.1),
- Colors.black.withOpacity(0.004),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- tileMode: TileMode.clamp,
- ),
- ),
- );
-}
-
-Decoration containerRadius(Color color, double r) {
- return BoxDecoration(
- color: color,
- borderRadius: BorderRadius.all(Radius.circular(r)),
- );
-}
-
-Decoration containerRadiusTop({Color? color, double? r}) {
- return BoxDecoration(
- color: color ?? Colors.white,
- borderRadius: BorderRadius.only(topRight: Radius.circular(r ?? 12), topLeft: Radius.circular(r ?? 12)),
- );
-}
-
-Decoration containerRadiusBorder(Color color, double r) {
- return BoxDecoration(
- color: Colors.transparent,
- border: Border.all(color: color, width: 1),
- borderRadius: BorderRadius.all(Radius.circular(r)),
- );
-}
-
-Decoration containerRadiusBottom(Color color, double r) {
- return BoxDecoration(
- color: color,
- borderRadius: BorderRadius.only(bottomLeft: Radius.circular(r), bottomRight: Radius.circular(r)),
- );
-}
-
-ShapeBorder cardRadiusTop(double radius) {
- return RoundedRectangleBorder(
- side: BorderSide(color: Colors.transparent, width: 0),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)),
- );
-}
-
-Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) {
- return BoxDecoration(
- color: background,
- border: Border.all(
- width: w, //
- color: color // <--- border width here
- ),
- borderRadius: BorderRadius.circular(radius),
- );
-}
-
-ShapeBorder cardRadiusTop2(double radius) {
- return RoundedRectangleBorder(
- borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)),
- );
-}
-
-ShapeBorder cardRadiusBottom(double radius) {
- return RoundedRectangleBorder(
- borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)),
- );
-}
-
-Decoration containerColorRadiusBorder(Color background, double radius, Color color) {
- return BoxDecoration(
- color: background,
- border: Border.all(
- width: 1, //
- color: color // <--- border width here
- ),
- borderRadius: BorderRadius.circular(radius),
- );
-}
-
-
-
-
-
-
-//Decoration appGradient = BoxDecoration(
-// gradient: LinearGradient(
-// colors: [
-// Colors.green[200],
-// Colors.green,
-// ],
-// begin: Alignment.topCenter,
-// end: Alignment.bottomCenter,
-// ),
-//);
-// launchURL(String url) async {
-// if (await canLaunch(url)) {
-// await launch(url);
-// } else {
-// throw 'Could not launch $url';
-// }
-// }
diff --git a/lib/widgets/app_bar.dart b/lib/widgets/app_bar.dart
deleted file mode 100644
index 3ad0b80..0000000
--- a/lib/widgets/app_bar.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-import 'package:sizer/sizer.dart';
-
-AppBar appBar({
- Color? backgroundColor,
- double? elevation,
- String? title,
- Color? titleColor,
- bool? isTitleCenter,
- Color? backIconColor,
- List? actions,
-}) {
- return AppBar(
- backgroundColor: backgroundColor ?? appBackgroundColor,
- elevation: elevation ?? 0,
- centerTitle: isTitleCenter ?? true,
- iconTheme: IconThemeData(
- color: backIconColor ?? Colors.black, //change your color here
- ),
- actions: actions,
- title: Txt(
- title ?? "",
- txtType: TxtType.appBar,
- ),
- );
-}
diff --git a/lib/widgets/blurry_container.dart b/lib/widgets/blurry_container.dart
deleted file mode 100644
index 8bebc4a..0000000
--- a/lib/widgets/blurry_container.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-import 'dart:ui';
-
-import 'package:flutter/material.dart';
-
-const kDemoText = Center(
- child: Text(
- '',
- style: TextStyle(
- fontSize: 25,
- color: Colors.white,
- letterSpacing: 2,
- ),
- textAlign: TextAlign.center,
- ),
-);
-const double kBlur = 1.0;
-const EdgeInsetsGeometry kDefaultPadding = EdgeInsets.all(16);
-const Color kDefaultColor = Colors.transparent;
-const BorderRadius kBorderRadius = BorderRadius.all(Radius.circular(20));
-const double kColorOpacity = 0.0;
-
-class BlurryContainer extends StatelessWidget {
- final Widget child;
- final double blur;
- final double? height, width;
- final EdgeInsetsGeometry padding;
- final Color bgColor;
-
- final BorderRadius borderRadius;
-
- //final double colorOpacity;
-
- BlurryContainer({
- this.child = kDemoText,
- this.blur = 5,
- required this.height,
- required this.width,
- this.padding = kDefaultPadding,
- this.bgColor = kDefaultColor,
- this.borderRadius = kBorderRadius,
- //this.colorOpacity = kColorOpacity,
- });
-
- @override
- Widget build(BuildContext context) {
- return ClipRRect(
- borderRadius: borderRadius,
- child: BackdropFilter(
- filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
- child: Container(
- height: height!,
- width: width!,
- padding: padding,
- color: bgColor == Colors.transparent
- ? bgColor
- : bgColor.withOpacity(0.5),
- child: child,
- ),
- ),
- );
- }
-}
diff --git a/lib/widgets/button/show_circular_button.dart b/lib/widgets/button/show_circular_button.dart
deleted file mode 100644
index c2bd90c..0000000
--- a/lib/widgets/button/show_circular_button.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-
-class ShowCircularButton extends StatelessWidget {
- VoidCallback onPressed;
- IconData? iconData;
- ShowCircularButton({this.iconData,required this.onPressed});
- @override
- Widget build(BuildContext context) {
- return Card(
- shape: cardRadius(1000),
- color: Colors.black.withOpacity(0.2),
- margin: EdgeInsets.all(12),
- child: IconButton(
- onPressed: onPressed,
- icon: Icon(
- iconData?? Icons.amp_stories_outlined,
- color: Colors.white,
- ),
- ),
- );
- }
-}
diff --git a/lib/widgets/button/show_image_button.dart b/lib/widgets/button/show_image_button.dart
deleted file mode 100644
index 8e60d11..0000000
--- a/lib/widgets/button/show_image_button.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-
-import '../txt.dart';
-
-class ShowImageButton extends StatelessWidget {
- String icon, title;
- VoidCallback onClick;
-
- ShowImageButton(
- {required this.icon, required this.title, required this.onClick});
-
- @override
- Widget build(BuildContext context) {
- return InkWell(
- onTap: onClick,
- child: Container(
- width: double.infinity,
- child: Column(
- children: [
- Container(
- width: double.infinity,
- height: 120,
- color: accentColor,
- padding: EdgeInsets.all(30),
- child: Image.asset(
- icon,
- color: Colors.white,
- ),
- ),
- mHeight(12),
- Txt(
- title,
- txtType: TxtType.heading2,
- color: Colors.blue,
- )
- ],
- ),
- ),
- );
- }
-}
diff --git a/lib/widgets/dialog/dialogs.dart b/lib/widgets/dialog/dialogs.dart
deleted file mode 100644
index 9a5a822..0000000
--- a/lib/widgets/dialog/dialogs.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-import 'package:flutter/material.dart';
-
-void showMDialog(
- context, {
- Widget? child,
-}) async {
- return showDialog(
- context: context,
- barrierDismissible: true,
- builder: (context) {
- return Dialog(
- child: child,
- );
- },
- );
-}
diff --git a/lib/widgets/dialog/message_dialog.dart b/lib/widgets/dialog/message_dialog.dart
deleted file mode 100644
index 4181370..0000000
--- a/lib/widgets/dialog/message_dialog.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/navigator.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:mohem_flutter_app/widgets/show_fill_button.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-
-class MessageDialog extends StatelessWidget {
- String? title, buttonTitle;
- VoidCallback? onClick;
- MessageDialog({this.title, this.buttonTitle,this.onClick});
-
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- padding: EdgeInsets.all(30),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Txt(
- title ?? "message",
- txtType: TxtType.heading3,
- ),
- mHeight(40),
- ShowFillButton(
- title: buttonTitle ?? "Continue",
- width: double.infinity,
- onPressed: () {
- onClick!();
- },
- )
- ],
- ),
- );
- }
-}
diff --git a/lib/widgets/dialog/otp_dialog.dart b/lib/widgets/dialog/otp_dialog.dart
deleted file mode 100644
index 3790c44..0000000
--- a/lib/widgets/dialog/otp_dialog.dart
+++ /dev/null
@@ -1,74 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/navigator.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:mohem_flutter_app/widgets/show_fill_button.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-
-class OtpDialog extends StatelessWidget {
- VoidCallback onClick;
-
- OtpDialog({required this.onClick});
-
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- padding: EdgeInsets.all(30),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Txt(
- "Please insert OTP Code",
- txtType: TxtType.heading3,
- ),
- mHeight(20),
- Row(
- children: [
- Expanded(
- child: Container(
- width: double.infinity,
- height: 60,
- color: accentColor.withOpacity(0.3),
- ),
- ),
- mWidth(12),
- Expanded(
- child: Container(
- width: double.infinity,
- height: 60,
- color: accentColor.withOpacity(0.3),
- ),
- ),
- mWidth(12),
- Expanded(
- child: Container(
- width: double.infinity,
- height: 60,
- color: accentColor.withOpacity(0.3),
- ),
- ),
- mWidth(12),
- Expanded(
- child: Container(
- width: double.infinity,
- height: 60,
- color: accentColor.withOpacity(0.3),
- ),
- ),
- ],
- ),
- mHeight(40),
- ShowFillButton(
- title: "Check Code",
- width: double.infinity,
- onPressed: () {
- onClick();
- },
- )
- ],
- ),
- );
- }
-}
diff --git a/lib/widgets/dragable_sheet.dart b/lib/widgets/dragable_sheet.dart
deleted file mode 100644
index 4d91118..0000000
--- a/lib/widgets/dragable_sheet.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-
-showDraggableDialog(BuildContext context, Widget child) {
- showGeneralDialog(
- barrierLabel: "Label",
- barrierDismissible: false,
- barrierColor: Colors.black.withOpacity(0.2),
- transitionDuration: Duration(milliseconds: 200),
- context: context,
- pageBuilder: (context, anim1, anim2) {
- return Dismissible(
- direction: DismissDirection.vertical,
- key: const Key('key'),
- onDismissed: (_) => Navigator.of(context).pop(),
- child: child,
- );
- },
- transitionBuilder: (context, anim1, anim2, child) {
- return SlideTransition(
- position: Tween(begin: Offset(0, 1), end: Offset(0, 0)).animate(anim1),
- child: child,
- );
- },
- );
-}
diff --git a/lib/widgets/dropdown/dropdow_field.dart b/lib/widgets/dropdown/dropdow_field.dart
deleted file mode 100644
index 091b6f6..0000000
--- a/lib/widgets/dropdown/dropdow_field.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-
-import '../txt.dart';
-
-class DropdownField extends StatefulWidget {
- String? hint;
- List? list;
-
- DropdownField({this.hint, this.list});
-
- @override
- State createState() => _DropdownFieldState();
-}
-
-class _DropdownFieldState extends State {
- String? dropdownValue;
-
- @override
- Widget build(BuildContext context) {
- return Container(
- decoration: containerColorRadiusBorderWidth(
- Colors.transparent,
- 4,
- borderColor,
- 0.5,
- ),
- margin: EdgeInsets.all(2),
- padding: EdgeInsets.only(left: 8, right: 8),
- child: DropdownButton(
- value: dropdownValue,
- icon: const Icon(Icons.keyboard_arrow_down_sharp),
- elevation: 16,
- iconSize: 16,
- iconEnabledColor: borderColor,
- iconDisabledColor: borderColor,
- isExpanded: true,
- style: const TextStyle(color: Colors.black),
- hint: Txt(
- widget.hint ?? "",
- txtType: TxtType.heading1,
- bold: false,
- color: borderColor,
- ),
- underline: Container(
- height: 0,
- ),
- onChanged: (String? newValue) {
- setState(() {
- dropdownValue = newValue!;
- });
- },
- items: (widget.list ??
- [
- 'One',
- 'Two',
- 'Free',
- 'Four',
- ])
- .map>(
- (String value) {
- return DropdownMenuItem(
- value: value,
- child: Txt(
- value,
- txtType: TxtType.heading1,
- bold: false,
- ),
- );
- },
- ).toList(),
- ),
- );
- }
-}
diff --git a/lib/widgets/dropdown/dropdown_text.dart b/lib/widgets/dropdown/dropdown_text.dart
deleted file mode 100644
index 4031a98..0000000
--- a/lib/widgets/dropdown/dropdown_text.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_svg/flutter_svg.dart';
-import 'package:mohem_flutter_app/config/constants.dart';
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-
-class DropDownText extends StatelessWidget {
- String title;
-
- DropDownText(this.title);
-
- @override
- Widget build(BuildContext context) {
- return Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Txt(
- title,
- txtType: TxtType.heading3,
- color: accentColor,
- ),
- mWidth(16),
- SvgPicture.asset(
- svgIcons + "ic_arrow_down.svg",
- width: 10,
- height: 10,
- ),
- ],
- );
- }
-}
diff --git a/lib/widgets/extensions/extensions_widget.dart b/lib/widgets/extensions/extensions_widget.dart
deleted file mode 100644
index caaaba9..0000000
--- a/lib/widgets/extensions/extensions_widget.dart
+++ /dev/null
@@ -1,235 +0,0 @@
-import 'dart:math';
-
-import 'package:flutter/material.dart';
-
-extension ExtendedText on Widget {
- showOverlay({double? width, double? height}){
- return Container(
- width: width ?? double.infinity,
- height: height ?? 60,
- decoration: BoxDecoration(
- gradient: LinearGradient(colors: [
- Colors.black.withOpacity(0.2),
- Colors.black.withOpacity(0.1),
- Colors.black.withOpacity(0.004),
- ], begin: Alignment.topCenter, end: Alignment.bottomCenter, tileMode: TileMode.clamp),
- ),
- child: this,
- );
- }
-}
-
-
-
-
-
-extension ImageExt on Image {
- Widget circular() {
- return ClipRRect(
- clipBehavior: Clip.hardEdge,
- borderRadius: BorderRadius.circular(100),
- child: this,
- );
- }
-}
-
-extension WidgetExt on Widget {
- Widget toWidget() {
- return this as Widget;
- }
-
- Widget sized({double? width, double? height}) {
- return SizedBox(
- width: width,
- height: height,
- child: this,
- );
- }
- Widget inkWell({required VoidCallback onTap,double radius=0}){
- return InkWell(
- child: Material(child: this,color: Colors.transparent,),
- onTap: onTap,
- );
- }
- Widget sizeSq(double size) {
- return SizedBox(
- width: size,
- height: size,
- child: this,
- );
- }
-
- Widget fillParent({double hFactor = 1, double? vFactor}) {
- return FractionallySizedBox(
- heightFactor: null,
- widthFactor: hFactor,
- child: this,
- );
- }
-
- Widget margin(
- {double top = 0, double bottom = 0, double left = 0, double right = 0}) {
- var pad =
- EdgeInsets.only(top: top, left: left, bottom: bottom, right: right);
- try {
- (this as dynamic).margin = pad;
- } catch (err) {
- return Padding(
- padding: pad,
- child: this,
- );
- }
- return this;
- }
-
- Widget toClip({double r = 40}) {
- return ClipRRect(
- borderRadius: BorderRadius.all(
- Radius.circular(r),
- ),
- clipBehavior: Clip.antiAlias,
- child: this,
- );
- }
-
- // Widget scrollable({Axis? direction, bool fadingEdge = true}) {
- // var scrollview = SingleChildScrollView(
- // child: this,
- // controller: ScrollController(),
- // scrollDirection: direction ?? Axis.vertical,
- // );
- // return fadingEdge ? scrollview.fadingEdge() : scrollview;
- // }
-
- Widget expand() {
- return Expanded(
- child: this,
- );
- }
-
- Widget align(Alignment alignment) {
- return Align(
- alignment: alignment,
- child: this,
- );
- }
-
- Widget center() {
- return Center(
- child: this,
- );
- }
-
- Widget padding(EdgeInsets padding) {
- return Padding(
- padding: padding,
- child: this,
- );
- }
-
- Widget paddingAll(double padding) {
- return Padding(
- padding: EdgeInsets.all(padding),
- child: this,
- );
- }
-
- // Widget onTap(VoidCallback onTap, {double corners = 0}) {
- // return Clickable.widget(child: this, corners: corners, onTap: onTap);
- // }
-
- Widget ignoreInteraction() {
- return IgnorePointer(
- child: this,
- );
- }
-}
-
-// extension xScrollView on ScrollView {
-// Widget fadingEdge() => FadingEdgeScrollView.fromScrollView(
-// child: this,
-// gradientFractionOnEnd: 0.08,
-// gradientFractionOnStart: 0.08,
-// shouldDisposeScrollController: true,
-// );
-// }
-//
-// extension x2ScrollView on SingleChildScrollView {
-// Widget fadingEdge() => FadingEdgeScrollView.fromSingleChildScrollView(
-// child: this,
-// gradientFractionOnEnd: 0.08,
-// gradientFractionOnStart: 0.08,
-// shouldDisposeScrollController: true,
-// );
-// }
-
-class Position {
- final double x, y, w, h;
-
- Position(this.x, this.y, this.w, this.h);
-}
-
-extension KeyExt on GlobalKey {
- Position globalPosition() {
- RenderBox box = currentContext!.findRenderObject() as RenderBox;
- Offset xy = box.localToGlobal(Offset.zero);
- Size wh = box.size;
- return Position(xy.dx, xy.dy, wh.width, wh.height);
- }
-}
-
-extension StateExt on State {
- reload({VoidCallback? b}) {
- setState(b ?? () {});
- }
-}
-
-// extension LocatiionExt on Location {
-// LatLng toLatLng() {
-// return LatLng(lat!, lng!);
-// }
-// }
-
-// extension xList on List {
-// T randomItem() {
-// final random = new Random();
-// var i = random.nextInt(this.length);
-// return this[i];
-// }
-//
-// List append(List items) {
-// this.addAll(items);
-// return this;
-// }
-//
-// bool isFirst(T item) => first == item;
-//
-// bool isLast(T item) => last == item;
-//
-// getOneByOne(
-// {required int delayMillis,
-// required Function(T) callback, VoidCallback? complete}) async {
-// for (var i in this) {
-// await delay(delayMillis);
-// callback(i);
-// }
-// complete!();
-// }
-// }
-
-extension xFuture on Future {
- thenWithDelay(int millis, Function(T) thenBlock) {
- then((value) {
- Future.delayed(Duration(milliseconds: millis))
- .then((value) => thenBlock(value));
- });
- }
-}
-
-extension xDouble on int {
- Duration durationMillis() => Duration(milliseconds: this);
-
- Duration durationSec() => Duration(seconds: this);
-
- Duration durationHour() => Duration(hours: this);
-}
diff --git a/lib/widgets/gradient_app_bar.dart b/lib/widgets/gradient_app_bar.dart
deleted file mode 100644
index c3ded30..0000000
--- a/lib/widgets/gradient_app_bar.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-import 'package:flutter/material.dart';
-
-class GradientAppBar extends StatelessWidget {
- final String title;
- final double barHeight = 50.0;
- IconData? iconData;
-
- GradientAppBar(this.title, {this.iconData});
-
- @override
- Widget build(BuildContext context) {
- final double statusbarHeight = MediaQuery.of(context).padding.top;
-
- return new Container(
- padding: EdgeInsets.only(top: statusbarHeight),
- height: statusbarHeight + barHeight,
- child: Row(
- children: [
- IconButton(
- onPressed: () {
- Navigator.pop(context);
- },
- icon: Icon(
- Icons.arrow_back_ios,
- color: Colors.white,
- ),
- ),
- Expanded(
- child: Center(
- child: Text(
- title,
- style: TextStyle(
- fontSize: 20.0,
- color: Colors.white,
- fontWeight: FontWeight.bold),
- ),
- ),
- ),
- if (iconData != null)
- IconButton(
- onPressed: () {},
- icon: Icon(
- iconData,
- color: Colors.white,
- ),
- ),
- ],
- ),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [
- Colors.black.withOpacity(0.4),
- Colors.black.withOpacity(0.2),
- Colors.black.withOpacity(0.0001),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- tileMode: TileMode.clamp,
- ),
- ),
- );
- }
-}
diff --git a/lib/widgets/images/circular_image.dart b/lib/widgets/images/circular_image.dart
deleted file mode 100644
index dd64efa..0000000
--- a/lib/widgets/images/circular_image.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-import 'package:mohem_flutter_app/config/constants.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-
-class CircularImage extends StatelessWidget {
- double? w, h, padding;
- String? image;
-
- CircularImage({this.w, this.h, this.image, this.padding});
-
- @override
- Widget build(BuildContext context) {
- return Container(
- width: w ?? 120,
- height: h ?? 120,
- child: Card(
- shape: cardRadius(2000),
- clipBehavior: Clip.antiAlias,
- elevation: 4,
- child: Card(
- shape: cardRadius(2000),
- clipBehavior: Clip.antiAlias,
- elevation: 0,
- margin: EdgeInsets.all(padding ?? 0),
- child: Image.asset(image ?? icons + "green.jpg"),
- ),
- ),
- );
- }
-}
diff --git a/lib/sikander_later_will_remove_to_parent_directory/widgets/input_widget.dart b/lib/widgets/input_widget.dart
similarity index 97%
rename from lib/sikander_later_will_remove_to_parent_directory/widgets/input_widget.dart
rename to lib/widgets/input_widget.dart
index 162fd35..97e90a2 100644
--- a/lib/sikander_later_will_remove_to_parent_directory/widgets/input_widget.dart
+++ b/lib/widgets/input_widget.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart';
+import 'package:mohem_flutter_app/classes/colors.dart';
class InputWidget extends StatelessWidget {
final String labelText;
diff --git a/lib/widgets/otp_widget.dart b/lib/widgets/otp_widget.dart
new file mode 100644
index 0000000..a489e61
--- /dev/null
+++ b/lib/widgets/otp_widget.dart
@@ -0,0 +1,373 @@
+import 'dart:async';
+
+import 'package:flutter/animation.dart';
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+
+typedef OnDone = void Function(String text);
+
+class ProvidedPinBoxTextAnimation {
+ static AnimatedSwitcherTransitionBuilder scalingTransition = (child, animation) {
+ return ScaleTransition(
+ child: child,
+ scale: animation,
+ );
+ };
+
+ static AnimatedSwitcherTransitionBuilder defaultNoTransition = (Widget child, Animation animation) {
+ return child;
+ };
+}
+
+class OTPWidget extends StatefulWidget {
+ final int maxLength;
+ final TextEditingController? controller;
+
+ final Color defaultBorderColor;
+ final Color pinBoxColor;
+ final double pinBoxBorderWidth;
+ final double pinBoxRadius;
+ final bool hideDefaultKeyboard;
+
+ final TextStyle? pinTextStyle;
+ final double pinBoxHeight;
+ final double pinBoxWidth;
+ final OnDone? onDone;
+ final bool hasError;
+ final Color errorBorderColor;
+ final Color textBorderColor;
+ final Function(String)? onTextChanged;
+ final bool autoFocus;
+ final FocusNode? focusNode;
+ final AnimatedSwitcherTransitionBuilder? pinTextAnimatedSwitcherTransition;
+ final Duration pinTextAnimatedSwitcherDuration;
+ final TextDirection textDirection;
+ final TextInputType keyboardType;
+ final EdgeInsets pinBoxOuterPadding;
+
+ const OTPWidget({
+ Key? key,
+ this.maxLength: 4,
+ this.controller,
+ this.pinBoxWidth: 70.0,
+ this.pinBoxHeight: 70.0,
+ this.pinTextStyle,
+ this.onDone,
+ this.defaultBorderColor: Colors.black,
+ this.textBorderColor: Colors.black,
+ this.pinTextAnimatedSwitcherTransition,
+ this.pinTextAnimatedSwitcherDuration: const Duration(),
+ this.hasError: false,
+ this.errorBorderColor: Colors.red,
+ this.onTextChanged,
+ this.autoFocus: false,
+ this.focusNode,
+ this.textDirection: TextDirection.ltr,
+ this.keyboardType: TextInputType.number,
+ this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0),
+ this.pinBoxColor = Colors.white,
+ this.pinBoxBorderWidth = 2.0,
+ this.pinBoxRadius = 0,
+ this.hideDefaultKeyboard = false,
+ }) : super(key: key);
+
+ @override
+ State createState() {
+ return OTPWidgetState();
+ }
+}
+
+class OTPWidgetState extends State with SingleTickerProviderStateMixin {
+ AnimationController? _highlightAnimationController;
+ FocusNode? focusNode;
+ String text = "";
+ int currentIndex = 0;
+ List strList = [];
+ bool hasFocus = false;
+
+ @override
+ void didUpdateWidget(OTPWidget oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ focusNode = widget.focusNode ?? focusNode;
+
+ if (oldWidget.maxLength < widget.maxLength) {
+ setState(() {
+ currentIndex = text.length;
+ });
+ widget.controller?.text = text;
+ widget.controller?.selection = TextSelection.collapsed(offset: text.length);
+ } else if (oldWidget.maxLength > widget.maxLength && widget.maxLength > 0 && text.length > 0 && text.length > widget.maxLength) {
+ setState(() {
+ text = text.substring(0, widget.maxLength);
+ currentIndex = text.length;
+ });
+ widget.controller?.text = text;
+ widget.controller?.selection = TextSelection.collapsed(offset: text.length);
+ }
+ }
+
+ _calculateStrList() {
+ if (strList.length > widget.maxLength) {
+ strList.length = widget.maxLength;
+ }
+ while (strList.length < widget.maxLength) {
+ strList.add("");
+ }
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ focusNode = widget.focusNode ?? FocusNode();
+
+ _initTextController();
+ _calculateStrList();
+ widget.controller?.addListener(_controllerListener);
+ focusNode?.addListener(_focusListener);
+ }
+
+ void _controllerListener() {
+ if (mounted == true) {
+ setState(() {
+ _initTextController();
+ });
+ var onTextChanged = widget.onTextChanged;
+ if (onTextChanged != null) {
+ onTextChanged(widget.controller?.text ?? "");
+ }
+ }
+ }
+
+ void _focusListener() {
+ if (mounted == true) {
+ setState(() {
+ hasFocus = focusNode?.hasFocus ?? false;
+ });
+ }
+ }
+
+ void _initTextController() {
+ if (widget.controller == null) {
+ return;
+ }
+ strList.clear();
+ var text = widget.controller?.text ?? "";
+ if (text.isNotEmpty) {
+ if (text.length > widget.maxLength) {
+ throw Exception("TextEditingController length exceeded maxLength!");
+ }
+ }
+ for (var i = 0; i < text.length; i++) {
+ strList.add(text[i]);
+ }
+ }
+
+ double get _width {
+ var width = 0.0;
+ for (var i = 0; i < widget.maxLength; i++) {
+ width += widget.pinBoxWidth;
+ if (i == 0) {
+ width += widget.pinBoxOuterPadding.left;
+ } else if (i + 1 == widget.maxLength) {
+ width += widget.pinBoxOuterPadding.right;
+ } else {
+ width += widget.pinBoxOuterPadding.left;
+ }
+ }
+ return width;
+ }
+
+ @override
+ void dispose() {
+ if (widget.focusNode == null) {
+ focusNode?.dispose();
+ } else {
+ focusNode?.removeListener(_focusListener);
+ }
+ _highlightAnimationController?.dispose();
+ widget.controller?.removeListener(_controllerListener);
+
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Stack(
+ children: [
+ _otpTextInput(),
+ _touchPinBoxRow(),
+ ],
+ );
+ }
+
+ Widget _touchPinBoxRow() {
+ return widget.hideDefaultKeyboard
+ ? _pinBoxRow(context)
+ : GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ if (hasFocus) {
+ FocusScope.of(context).requestFocus(FocusNode());
+ Future.delayed(Duration(milliseconds: 100), () {
+ FocusScope.of(context).requestFocus(focusNode);
+ });
+ } else {
+ FocusScope.of(context).requestFocus(focusNode);
+ }
+ },
+ child: _pinBoxRow(context),
+ );
+ }
+
+ Widget _otpTextInput() {
+ var transparentBorder = OutlineInputBorder(
+ borderSide: BorderSide(
+ color: Colors.transparent,
+ width: 0.0,
+ ),
+ );
+ return Container(
+ width: _width,
+ height: widget.pinBoxHeight,
+ child: TextField(
+ autofocus: !kIsWeb ? widget.autoFocus : false,
+ enableInteractiveSelection: false,
+ focusNode: focusNode,
+ controller: widget.controller,
+ keyboardType: widget.keyboardType,
+ inputFormatters: widget.keyboardType == TextInputType.number ? [FilteringTextInputFormatter.digitsOnly] : null,
+ style: TextStyle(
+ height: 0.1,
+ color: Colors.transparent,
+ ),
+ decoration: InputDecoration(
+ contentPadding: EdgeInsets.all(0),
+ focusedErrorBorder: transparentBorder,
+ errorBorder: transparentBorder,
+ disabledBorder: transparentBorder,
+ enabledBorder: transparentBorder,
+ focusedBorder: transparentBorder,
+ counterText: null,
+ counterStyle: null,
+ helperStyle: TextStyle(
+ height: 0.0,
+ color: Colors.transparent,
+ ),
+ labelStyle: TextStyle(height: 0.1),
+ fillColor: Colors.transparent,
+ border: InputBorder.none,
+ ),
+ cursorColor: Colors.transparent,
+ showCursor: false,
+ maxLength: widget.maxLength,
+ onChanged: _onTextChanged,
+ ),
+ );
+ }
+
+ void _onTextChanged(text) {
+ var onTextChanged = widget.onTextChanged;
+ if (onTextChanged != null) {
+ onTextChanged(text);
+ }
+ setState(() {
+ this.text = text;
+ if (text.length >= currentIndex) {
+ for (int i = currentIndex; i < text.length; i++) {
+ strList[i] = text[i];
+ }
+ }
+ currentIndex = text.length;
+ });
+ if (text.length == widget.maxLength) {
+ FocusScope.of(context).requestFocus(FocusNode());
+ var onDone = widget.onDone;
+ if (onDone != null) {
+ onDone(text);
+ }
+ }
+ }
+
+ Widget _pinBoxRow(BuildContext context) {
+ _calculateStrList();
+ List pinCodes = List.generate(widget.maxLength, (int i) {
+ return _buildPinCode(i, context);
+ });
+ return Row(children: pinCodes, mainAxisSize: MainAxisSize.min);
+ }
+
+ Widget _buildPinCode(int i, BuildContext context) {
+ Color borderColor;
+ Color pinBoxColor = widget.pinBoxColor;
+
+ if (widget.hasError) {
+ borderColor = widget.errorBorderColor;
+ } else if (i < text.length) {
+ borderColor = widget.textBorderColor;
+ } else {
+ borderColor = widget.defaultBorderColor;
+ pinBoxColor = widget.pinBoxColor;
+ }
+
+ EdgeInsets insets;
+ if (i == 0) {
+ insets = EdgeInsets.only(
+ left: 0,
+ top: widget.pinBoxOuterPadding.top,
+ right: widget.pinBoxOuterPadding.right,
+ bottom: widget.pinBoxOuterPadding.bottom,
+ );
+ } else if (i == strList.length - 1) {
+ insets = EdgeInsets.only(
+ left: widget.pinBoxOuterPadding.left,
+ top: widget.pinBoxOuterPadding.top,
+ right: 0,
+ bottom: widget.pinBoxOuterPadding.bottom,
+ );
+ } else {
+ insets = widget.pinBoxOuterPadding;
+ }
+ return Container(
+ key: ValueKey("container$i"),
+ alignment: Alignment.center,
+ padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 1.0),
+ margin: insets,
+ child: _animatedTextBox(strList[i], i),
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: borderColor,
+ width: widget.pinBoxBorderWidth,
+ ),
+ color: pinBoxColor,
+ borderRadius: BorderRadius.circular(widget.pinBoxRadius),
+ ),
+ width: widget.pinBoxWidth,
+ height: widget.pinBoxHeight,
+ );
+ }
+
+ Widget _animatedTextBox(String text, int i) {
+ if (widget.pinTextAnimatedSwitcherTransition != null) {
+ return AnimatedSwitcher(
+ duration: widget.pinTextAnimatedSwitcherDuration,
+ transitionBuilder: widget.pinTextAnimatedSwitcherTransition ??
+ (Widget child, Animation animation) {
+ return child;
+ },
+ child: Text(
+ text,
+ key: ValueKey("$text$i"),
+ style: widget.pinTextStyle,
+ ),
+ );
+ } else {
+ return Text(
+ text,
+ key: ValueKey("${strList[i]}$i"),
+ style: widget.pinTextStyle,
+ );
+ }
+ }
+}
diff --git a/lib/widgets/show_card_buttton.dart b/lib/widgets/show_card_buttton.dart
deleted file mode 100644
index 7b9ac38..0000000
--- a/lib/widgets/show_card_buttton.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/widgets/show_fill_button.dart';
-import 'package:flutter/material.dart';
-
-class ShowCardButton extends StatelessWidget {
- String title;
- VoidCallback onPressed;
- Color txtColor;
-
- ShowCardButton({
- required this.title,
- required this.onPressed,
- this.txtColor = Colors.white,
- });
-
- @override
- Widget build(BuildContext context) {
- return Card(
- margin: EdgeInsets.zero,
- elevation: 20,
- child: Container(
- width: double.infinity,
- padding: EdgeInsets.all(12),
- child: ShowFillButton(
- title: title,
- onPressed: onPressed,
- txtColor: txtColor,
- ),
- ),
- );
- }
-}
diff --git a/lib/widgets/show_fill_button.dart b/lib/widgets/show_fill_button.dart
deleted file mode 100644
index 168521e..0000000
--- a/lib/widgets/show_fill_button.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-
-class ShowFillButton extends StatelessWidget {
- String title;
- VoidCallback onPressed;
- Color txtColor;
- double elevation, radius,width;
-
- ShowFillButton({
- required this.title,
- required this.onPressed,
- this.txtColor = Colors.white,
- this.elevation = 4,
- this.radius = 6,
- this.width=88,
- });
-
- @override
- Widget build(BuildContext context) {
- return ElevatedButton(
- style: ElevatedButton.styleFrom(
- onPrimary: Colors.black87,
- primary: accentColor,
- minimumSize: Size(width, 45),
- padding: EdgeInsets.symmetric(horizontal: 16),
- elevation: elevation,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(Radius.circular(radius)),
- ),
- ),
- onPressed: onPressed,
- child: Txt(
- title.toUpperCase(),
- color: txtColor,
- txtType: TxtType.heading1,
- ),
- );
- }
-}
diff --git a/lib/widgets/txt.dart b/lib/widgets/txt.dart
deleted file mode 100644
index 8591277..0000000
--- a/lib/widgets/txt.dart
+++ /dev/null
@@ -1,170 +0,0 @@
-// import 'package:auto_size_text/auto_size_text.dart';
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-import 'package:sizer/sizer.dart';
-
-enum TxtType {
- small,
- normal,
- heading1,
- heading2,
- heading3,
- appBar,
-}
-
-class Txt extends StatelessWidget {
- String text;
- int? maxLines;
- double? fontSize;
- Color? color;
- bool? bold;
- bool? isUnderline;
- bool? isFlatButton;
- double? pedding;
- TextAlign? textAlign;
- FontWeight? fontWeight;
- Function? onTap;
- TxtType txtType;
-
- Txt(this.text, {this.maxLines, this.color, this.bold, this.fontSize, this.isUnderline, this.isFlatButton, this.pedding, this.textAlign, this.fontWeight, this.onTap, this.txtType = TxtType.normal});
-
- @override
- Widget build(BuildContext context) {
- if (isFlatButton != null)
- return Padding(
- padding: EdgeInsets.only(right: pedding ?? 0, left: pedding ?? 0),
- child: InkWell(
- onTap: () {
- onTap!();
- },
- customBorder: inkWellCorner(r: 4),
- child: Padding(
- padding: const EdgeInsets.only(
- left: 14,
- right: 14,
- top: 6,
- bottom: 6,
- ),
- child: getText(),
- ),
- ),
- );
- else
- return getText();
- }
-
- Widget getText() {
- return Material(
- type: MaterialType.transparency,
- child: Text(
- text,
- maxLines: maxLines,
- textAlign: textAlign,
- overflow: maxLines != null ? TextOverflow.ellipsis : null,
- style: TextStyle(
- fontSize: fontSize ??
- (txtType == TxtType.small
- ? 8.sp
- : txtType == TxtType.normal
- ? 10.sp
- : txtType == TxtType.heading1
- ? 11.sp
- : txtType == TxtType.heading2
- ? 12.sp
- : txtType == TxtType.heading3
- ? 13.sp
- : txtType == TxtType.appBar
- ? 14.sp
- : 8.sp),
- color: color ??
- (txtType == TxtType.appBar
- ? Colors.black
- : txtType == TxtType.heading1
- ? headingColor
- : txtType == TxtType.heading2
- ? headingColor
- : txtType == TxtType.heading3
- ? headingColor
- : null),
- fontWeight: (fontWeight != null)
- ? fontWeight
- : ((bold != null)
- ? FontWeight.bold
- : (txtType == TxtType.appBar
- ? FontWeight.bold
- : txtType == TxtType.heading1
- ? FontWeight.bold
- : txtType == TxtType.heading2
- ? FontWeight.bold
- : txtType == TxtType.heading3
- ? FontWeight.bold
- : null)),
- decoration: (isUnderline != null) ? TextDecoration.underline : null,
- ),
- ),
- );
- }
-}
-
-// class TxtAuto extends StatelessWidget {
-// String text;
-// int? maxLines;
-// double? fontSize;
-// Color? color;
-// bool? bold;
-// bool? isUnderline;
-// bool? isFlatButton;
-// double? pedding;
-// TextAlign? textAlign;
-//
-// TxtAuto(
-// this.text, {
-// this.maxLines,
-// this.color,
-// this.bold,
-// this.fontSize,
-// this.isUnderline,
-// this.isFlatButton,
-// this.pedding,
-// this.textAlign,
-// });
-//
-// @override
-// Widget build(BuildContext context) {
-// if (isFlatButton != null)
-// return Padding(
-// padding: EdgeInsets.only(right: pedding ?? 0, left: pedding ?? 0),
-// child: InkWell(
-// onTap: () {},
-// customBorder: inkWellCorner(r: 4),
-// child: Padding(
-// padding: const EdgeInsets.only(
-// left: 14,
-// right: 14,
-// top: 6,
-// bottom: 6,
-// ),
-// child: getText(),
-// ),
-// ),
-// );
-// else
-// return getText();
-// }
-//
-// Widget getText() {
-// return AutoSizeText(
-// text,
-// maxLines: maxLines,
-// textAlign: textAlign,
-// overflow: maxLines != null ? TextOverflow.ellipsis : null,
-// style: TextStyle(
-// fontSize: fontSize,
-// color: color,
-// fontWeight: (bold != null) ? FontWeight.bold : null,
-// decoration: (isUnderline != null) ? TextDecoration.underline : null,
-// ),
-// );
-// }
-// }
diff --git a/lib/widgets/txt_field.dart b/lib/widgets/txt_field.dart
deleted file mode 100644
index c081229..0000000
--- a/lib/widgets/txt_field.dart
+++ /dev/null
@@ -1,155 +0,0 @@
-import 'package:mohem_flutter_app/theme/colors.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:mohem_flutter_app/widgets/txt.dart';
-import 'package:flutter/material.dart';
-import 'package:sizer/sizer.dart';
-
-class TxtField extends StatelessWidget {
- TextEditingController controller = new TextEditingController();
- String? title;
- String? hint;
- String? lable;
- IconData? prefixData;
- IconData? postfixData;
- bool isNeedFilterButton;
- bool isNeedClickAll;
- bool isButtonEnable;
- double? elevation;
- Function? onTap;
- String? buttonTitle;
- int? maxLines;
- bool isSidePaddingZero;
- bool isNeedBorder;
-
- TxtField({
- this.title,
- this.lable,
- this.hint,
- this.prefixData,
- this.postfixData,
- this.isNeedClickAll = false,
- this.isNeedFilterButton = false,
- this.elevation,
- this.onTap,
- this.isButtonEnable = false,
- this.buttonTitle,
- this.maxLines,
- this.isSidePaddingZero = false,
- this.isNeedBorder = true,
- });
-
- @override
- Widget build(BuildContext context) {
- controller.text = title ?? "";
- return InkWell(
- onTap: isNeedClickAll == false
- ? null
- : () {
- onTap!();
- },
- customBorder: inkWellCorner(),
- child: Row(
- children: [
- Expanded(
- child: Card(
- elevation: elevation,
- margin: isSidePaddingZero ? EdgeInsets.zero : null,
- child: TextField(
- autofocus: false,
- controller: controller,
- enabled: isNeedClickAll == true ? false : true,
- maxLines: maxLines,
- onTap: () {},
- decoration: InputDecoration(
- labelText: lable,
- alignLabelWithHint: true,
- fillColor: Colors.white,
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: accentColor, width: isNeedBorder ? 1.0 : 0),
- borderRadius: BorderRadius.circular(4.0),
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: borderColor, width: isNeedBorder ? 1.0 : 0),
- borderRadius: BorderRadius.circular(4.0),
- ),
- disabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: borderColor, width: isNeedBorder ? 1.0 : 0),
- borderRadius: BorderRadius.circular(4.0),
- ),
- prefixIcon: prefixData != null
- ? Icon(
- Icons.search,
- color: borderColor,
- )
- : null,
- labelStyle: TextStyle(color: borderColor, fontSize: 13.sp),
- hintStyle: TextStyle(color: borderColor, fontSize: 9.sp),
- hintText: hint ?? "",
- contentPadding: prefixData == null
- ? EdgeInsets.only(
- left: 12,
- right: 12,
- top: maxLines != null ? 12 : 0,
- bottom: maxLines != null ? 12 : 0,
- )
- : EdgeInsets.zero,
- ),
- ),
- ),
- ),
- if (isNeedFilterButton) mWidth(8),
- if (isNeedFilterButton)
- InkWell(
- onTap: isNeedClickAll
- ? null
- : () {
- controller.clear();
- },
- child: Container(
- width: 55,
- height: 55,
- child: Card(
- color: accentColor,
- // margin: EdgeInsets.all(4),
- // shape: cardRadius(0),
- child: Icon(
- postfixData ?? Icons.filter_alt,
- color: Colors.white,
- ),
- ),
- ),
- ),
- if (isButtonEnable)
- Material(
- child: InkWell(
- onTap: () {},
- customBorder: inkWellCorner(),
- child: Container(
- height: 55,
- child: Card(
- color: accentColor,
- // margin: EdgeInsets.all(4),
- // shape: cardRadius(0),
- child: Center(
- child: Padding(
- padding: const EdgeInsets.only(left: 12, right: 12),
- child: Txt(
- buttonTitle ?? "Search",
- color: Colors.white,
- fontSize: 18,
- bold: true,
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}
diff --git a/lib/widgets/user_image.dart b/lib/widgets/user_image.dart
deleted file mode 100644
index 9ff8102..0000000
--- a/lib/widgets/user_image.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-import 'package:mohem_flutter_app/config/constants.dart';
-import 'package:mohem_flutter_app/utils/utils.dart';
-import 'package:flutter/material.dart';
-
-class UserImage extends StatelessWidget {
- double? size;
- String? url;
-
- UserImage({this.size, this.url});
-
- @override
- Widget build(BuildContext context) {
- return Container(
- height: size ?? 60,
- width: size ?? 60,
- decoration: containerRadius(Colors.transparent, 1000),
- clipBehavior: Clip.antiAlias,
- child: Image.asset(
- url ?? icons + "Blue Masked.jpg",
- width: double.infinity,
- height: double.infinity,
- fit: BoxFit.cover,
- ),
- );
- }
-}
diff --git a/pubspec.lock b/pubspec.lock
index b656e4d..302ac7a 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -116,6 +116,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_plugin_android_lifecycle:
+ dependency: transitive
+ description:
+ name: flutter_plugin_android_lifecycle
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.5"
flutter_svg:
dependency: "direct main"
description:
@@ -133,6 +140,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ fluttertoast:
+ dependency: "direct main"
+ description:
+ name: fluttertoast
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "8.0.8"
http:
dependency: "direct main"
description:
@@ -175,6 +189,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
+ local_auth:
+ dependency: "direct main"
+ description:
+ name: local_auth
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.9"
matcher:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 50eef52..04a1968 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -42,6 +42,8 @@ dependencies:
permission_handler: ^8.3.0
flutter_svg: ^1.0.0
sizer: ^2.0.15
+ local_auth: ^1.1.9
+ fluttertoast: ^8.0.8
dev_dependencies: