diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 857f1d1..472e794 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ + diff --git a/assets/images/add.svg b/assets/images/add.svg new file mode 100644 index 0000000..0230942 --- /dev/null +++ b/assets/images/add.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/announcements.svg b/assets/images/announcements.svg new file mode 100644 index 0000000..d204e60 --- /dev/null +++ b/assets/images/announcements.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/arrow_next.svg b/assets/images/arrow_next.svg new file mode 100644 index 0000000..76de3b9 --- /dev/null +++ b/assets/images/arrow_next.svg @@ -0,0 +1,3 @@ + + + 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/clear_field.svg b/assets/images/clear_field.svg new file mode 100644 index 0000000..618ed79 --- /dev/null +++ b/assets/images/clear_field.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/clock.svg b/assets/images/clock.svg new file mode 100644 index 0000000..bc9faed --- /dev/null +++ b/assets/images/clock.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/close.svg b/assets/images/close.svg new file mode 100644 index 0000000..7ef696b --- /dev/null +++ b/assets/images/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/delegate.svg b/assets/images/delegate.svg new file mode 100644 index 0000000..aa2bd7a --- /dev/null +++ b/assets/images/delegate.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/dot_circle.svg b/assets/images/dot_circle.svg new file mode 100644 index 0000000..b3ac566 --- /dev/null +++ b/assets/images/dot_circle.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/fav.svg b/assets/images/fav.svg new file mode 100644 index 0000000..ebbaf1c --- /dev/null +++ b/assets/images/fav.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/jpg.svg b/assets/images/jpg.svg new file mode 100644 index 0000000..cfda5a7 --- /dev/null +++ b/assets/images/jpg.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/login/verify_face.svg b/assets/images/login/verify_face.svg new file mode 100644 index 0000000..e50d1a6 --- /dev/null +++ b/assets/images/login/verify_face.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/login/verify_sms.svg b/assets/images/login/verify_sms.svg new file mode 100644 index 0000000..ae5fa9f --- /dev/null +++ b/assets/images/login/verify_sms.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/login/verify_thumb.svg b/assets/images/login/verify_thumb.svg new file mode 100644 index 0000000..e626baf --- /dev/null +++ b/assets/images/login/verify_thumb.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/login/verify_whatsapp.svg b/assets/images/login/verify_whatsapp.svg new file mode 100644 index 0000000..09ac85c --- /dev/null +++ b/assets/images/login/verify_whatsapp.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/logos/mohemm_logo.svg b/assets/images/logos/mohemm_logo.svg new file mode 100644 index 0000000..1cb9a0b --- /dev/null +++ b/assets/images/logos/mohemm_logo.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/miss_swipe.svg b/assets/images/miss_swipe.svg new file mode 100644 index 0000000..05d32f2 --- /dev/null +++ b/assets/images/miss_swipe.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/images/monthly_attendance.svg b/assets/images/monthly_attendance.svg new file mode 100644 index 0000000..c84a9a1 --- /dev/null +++ b/assets/images/monthly_attendance.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/images/more_dotted.svg b/assets/images/more_dotted.svg new file mode 100644 index 0000000..add7848 --- /dev/null +++ b/assets/images/more_dotted.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/nfc.svg b/assets/images/nfc.svg new file mode 100644 index 0000000..aff027e --- /dev/null +++ b/assets/images/nfc.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/pdf.svg b/assets/images/pdf.svg new file mode 100644 index 0000000..fc59aea --- /dev/null +++ b/assets/images/pdf.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/png.svg b/assets/images/png.svg new file mode 100644 index 0000000..2a0091d --- /dev/null +++ b/assets/images/png.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/request_info.svg b/assets/images/request_info.svg new file mode 100644 index 0000000..43ac9c1 --- /dev/null +++ b/assets/images/request_info.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/side_nav.svg b/assets/images/side_nav.svg new file mode 100644 index 0000000..a53378f --- /dev/null +++ b/assets/images/side_nav.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/skip.svg b/assets/images/skip.svg new file mode 100644 index 0000000..01831e0 --- /dev/null +++ b/assets/images/skip.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/stop.svg b/assets/images/stop.svg new file mode 100644 index 0000000..5f658a8 --- /dev/null +++ b/assets/images/stop.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/ticket_request.svg b/assets/images/ticket_request.svg new file mode 100644 index 0000000..f489a8e --- /dev/null +++ b/assets/images/ticket_request.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/un_fav.svg b/assets/images/un_fav.svg new file mode 100644 index 0000000..de1b852 --- /dev/null +++ b/assets/images/un_fav.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/work_from_home.svg b/assets/images/work_from_home.svg new file mode 100644 index 0000000..cf9a8d7 --- /dev/null +++ b/assets/images/work_from_home.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/wufu.svg b/assets/images/wufu.svg new file mode 100644 index 0000000..dd3ebab --- /dev/null +++ b/assets/images/wufu.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/xls.svg b/assets/images/xls.svg new file mode 100644 index 0000000..658ba92 --- /dev/null +++ b/assets/images/xls.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 55e73b0..a0625e6 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -6,11 +6,47 @@ "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", "password": "Password", - "title": "Hello", + "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 ", + "goodMorning": "Good Morning", + "markAttendance": "Mark Attendance", + "timeLeftToday": "Time Left Today", + "checkIn": "Check In", + "workList": "Work List", + "leaveBalance": "Leave Balance", + "missingSwipes": "Missing Swipes", + "ticketBalance": "Ticket Balance", + "other": "Other", + "services": "Services", + "viewAllServices": "View All Services", + "monthlyAttendance": "Monthly Attendance", + "workFromHome": "Work From Home", + "ticketRequest": "Ticket Request", + "viewAllOffers": "View All Offers", + "offers": "Offers & ", + "discounts": "Discounts", + "newString": "New", + "title": "Title", + "home": "Home", + "mySalary": "My Salary", + "createRequest": "Create Request", "forgotPassword": "Forgot Password", + "itemsForSale": "Items for Sale", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", + "human": "Human", + "resources": "Resources", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 55e73b0..a0625e6 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -6,11 +6,47 @@ "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", "password": "Password", - "title": "Hello", + "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 ", + "goodMorning": "Good Morning", + "markAttendance": "Mark Attendance", + "timeLeftToday": "Time Left Today", + "checkIn": "Check In", + "workList": "Work List", + "leaveBalance": "Leave Balance", + "missingSwipes": "Missing Swipes", + "ticketBalance": "Ticket Balance", + "other": "Other", + "services": "Services", + "viewAllServices": "View All Services", + "monthlyAttendance": "Monthly Attendance", + "workFromHome": "Work From Home", + "ticketRequest": "Ticket Request", + "viewAllOffers": "View All Offers", + "offers": "Offers & ", + "discounts": "Discounts", + "newString": "New", + "title": "Title", + "home": "Home", + "mySalary": "My Salary", + "createRequest": "Create Request", "forgotPassword": "Forgot Password", + "itemsForSale": "Items for Sale", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", + "human": "Human", + "resources": "Resources", "profile": { "reset_password": { "label": "Reset Password", diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6a06610..7ca764b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 6BB994F47479089301AC9232 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CBD2B2B1A504A0E0BA52E83 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -31,7 +32,11 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3085328F552329DC897B71DD /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 3A5ABA8306DCFDB9E71D453A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B4D9CAD3B112CCF7FEE1F91 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 6CBD2B2B1A504A0E0BA52E83 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -49,12 +54,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6BB994F47479089301AC9232 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 6BD33033650F08D3E79761E4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6CBD2B2B1A504A0E0BA52E83 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 969F82F1FCE09135D9CB4C64 /* Pods */ = { + isa = PBXGroup; + children = ( + 3085328F552329DC897B71DD /* Pods-Runner.debug.xcconfig */, + 3B4D9CAD3B112CCF7FEE1F91 /* Pods-Runner.release.xcconfig */, + 3A5ABA8306DCFDB9E71D453A /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +97,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 969F82F1FCE09135D9CB4C64 /* Pods */, + 6BD33033650F08D3E79761E4 /* Frameworks */, ); sourceTree = ""; }; @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 7D19CFF3DFB977EA83F4C733 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + AAF25E5FC427CABFCDCC628C /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -183,6 +212,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 7D19CFF3DFB977EA83F4C733 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +248,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + AAF25E5FC427CABFCDCC628C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + 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/classes/colors.dart b/lib/classes/colors.dart new file mode 100644 index 0000000..d9c5656 --- /dev/null +++ b/lib/classes/colors.dart @@ -0,0 +1,23 @@ +import 'package:flutter/cupertino.dart'; + +class MyColors { + static const Color darkIconColor = Color(0xff28323A); + static const Color darkTextColor = Color(0xff2B353E); + static const Color normalTextColor = Color(0xff5A5A5A); + static const Color lightTextColor = Color(0xffBFBFBF); + static const Color gradiantStartColor = Color(0xff33c0a5); + static const Color gradiantEndColor = Color(0xff259db7 ); + static const Color textMixColor = Color(0xff2BB8A6); + static const Color backgroundColor = Color(0xffF8F8F8); + static const Color grey57Color = Color(0xff575757); + static const Color grey77Color = Color(0xff777777); + static const Color grey98Color = Color(0xff989898); + static const Color lightGreyEFColor = Color(0xffEFEFEF); + static const Color lightGreyEDColor = Color(0xffEDEDED); + static const Color darkWhiteColor = Color(0xffE0E0E0); + static const Color redColor = Color(0xffD02127); + static const Color yellowColor = Color(0xffF4E31C); + static const Color black = Color(0xff000000); + static const Color white = Color(0xffffffff); + static const Color green = Color(0xffffffff); +} 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..7d171b7 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -1,17 +1,32 @@ 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'; +import 'package:mohem_flutter_app/ui/work_list/missing_swipe/missing_swipe_screen.dart'; +import 'package:mohem_flutter_app/ui/work_list/work_list_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"; static const String initialRoute = login; + //Work List + static const String workList = "/workList"; + static const String missingSwipe = "/missingSwipe"; + static final Map routes = { login: (context) => LoginScreen(), + verifyLogin: (context) => VerifyLoginScreen(), + dashboard: (context) => Dashboard(), + + //Work List + workList: (context) => WorkListScreen(), + missingSwipe: (context) => MissingSwipeScreen(), }; } diff --git a/lib/dialogs/otp_dialog.dart b/lib/dialogs/otp_dialog.dart new file mode 100644 index 0000000..f589211 --- /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/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/generated/locale_keys.g.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/login/verify_sms.svg" : "assets/images/login/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..21e370a --- /dev/null +++ b/lib/extensions/string_extensions.dart @@ -0,0 +1,126 @@ +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, bool isBold = false}) => Text( + this, + style: TextStyle( + fontSize: 10, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: -0.4), + ); + + Widget toText11( + {Color? color, bool isUnderLine = false, bool isBold = false}) => + Text( + this, + style: TextStyle( + fontSize: 11, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: -0.33, + decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText12( + {Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int maxLine = 0}) => + Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + style: TextStyle( + fontSize: 12, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: -0.72, + decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText13({Color? color, bool isUnderLine = false}) => Text( + this, + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: -0.52, + decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText14({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle( + color: color ?? MyColors.darkTextColor, + fontSize: 14, + letterSpacing: -0.48, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + ); + + Widget toText16({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle( + color: color ?? MyColors.darkTextColor, + fontSize: 16, + letterSpacing: -0.64, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + ); + + Widget toText24({bool isBold = false, Color? textColor}) => Text( + this, + style: TextStyle( + height: 23 / 24, + color: textColor ?? 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..a471169 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -22,8 +22,42 @@ class CodegenLoader extends AssetLoader{ "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", "password": "Password", - "title": "Hello", + "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 ", + "goodMorning": "Good Morning", + "markAttendance": "Mark Attendance", + "timeLeftToday": "Time Left Today", + "checkIn": "Check In", + "workList": "Work List", + "leaveBalance": "Leave Balance", + "missingSwipes": "Missing Swipes", + "ticketBalance": "Ticket Balance", + "other": "Other", + "services": "Services", + "viewAllServices": "View All Services", + "monthlyAttendance": "Monthly Attendance", + "workFromHome": "Work From Home", + "ticketRequest": "Ticket Request", + "viewAllOffers": "View All Offers", + "offers": "Offers & ", + "discounts": "Discounts", + "newString": "New", + "title": "Title", + "home": "Home", + "mySalary": "My Salary", + "createRequest": "Create Request", "forgotPassword": "Forgot Password", + "itemsForSale": "Items for Sale", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", @@ -68,8 +102,42 @@ static const Map en_US = { "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", "password": "Password", - "title": "Hello", + "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 ", + "goodMorning": "Good Morning", + "markAttendance": "Mark Attendance", + "timeLeftToday": "Time Left Today", + "checkIn": "Check In", + "workList": "Work List", + "leaveBalance": "Leave Balance", + "missingSwipes": "Missing Swipes", + "ticketBalance": "Ticket Balance", + "other": "Other", + "services": "Services", + "viewAllServices": "View All Services", + "monthlyAttendance": "Monthly Attendance", + "workFromHome": "Work From Home", + "ticketRequest": "Ticket Request", + "viewAllOffers": "View All Offers", + "offers": "Offers & ", + "discounts": "Discounts", + "newString": "New", + "title": "Title", + "home": "Home", + "mySalary": "My Salary", + "createRequest": "Create Request", "forgotPassword": "Forgot Password", + "itemsForSale": "Items for Sale", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", 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/classes/colors.dart b/lib/sikander_later_will_remove_to_parent_directory/classes/colors.dart deleted file mode 100644 index d19edc6..0000000 --- a/lib/sikander_later_will_remove_to_parent_directory/classes/colors.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class MyColors { - static const Color darkIconColor = Color(0xff28323A); - static const Color darkTextColor = Color(0xff2B353E); - static const Color gradiantStartColor = Color(0xff32D892); - static const Color gradiantEndColor = Color(0xff259CB8); - static const Color textMixColor = Color(0xff2BB8A6); - static const Color backgroundColor = Color(0xffF8F8F8); - static const Color greyColor = Color(0xff575757); - static const Color lightGreyColor = Color(0xffEFEFEF); - static const Color darkWhiteColor = Color(0xffE0E0E0); -} 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/ui/app_bar.dart b/lib/ui/app_bar.dart new file mode 100644 index 0000000..0823a5a --- /dev/null +++ b/lib/ui/app_bar.dart @@ -0,0 +1,25 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; + +AppBar appBar(BuildContext context, {required String title}) { + return AppBar( + title: title.toText24(textColor: MyColors.darkTextColor), + centerTitle: false, + automaticallyImplyLeading: false, + backgroundColor: Colors.white, + actions: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: Icon( + Icons.close, + color: MyColors.darkIconColor, + ), + ), + ], + ); +} 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..91a6e4f --- /dev/null +++ b/lib/ui/dashboard.dart @@ -0,0 +1,464 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/config/routes.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/circular_avatar.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) { + List names = [ + LocaleKeys.workList.tr(), + LocaleKeys.missingSwipes.tr(), + LocaleKeys.leaveBalance.tr(), + LocaleKeys.ticketBalance.tr() + ]; + List namesInt = [118, 02, 18.5, 03]; + List namesColor = [0xff125765, 0xff239D8F, 0xff2BB8A8, 0xff1D92AA]; + + List namesT = [ + LocaleKeys.monthlyAttendance.tr(), + LocaleKeys.workFromHome.tr(), + LocaleKeys.ticketRequest.tr(), + LocaleKeys.monthlyAttendance.tr() + ]; + List iconT = [ + "assets/images/monthly_attendance.svg", + "assets/images/work_from_home.svg", + "assets/images/ticket_request.svg", + "assets/images/work_from_home.svg" + ]; + + List namesD = [ + "Nostalgia Perfume Perfume", + "Al Nafoura", + "AlJadi", + "Nostalgia Perfume" + ]; + + return Scaffold( + body: Column( + children: [ + Row( + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + CircularAvatar( + width: 34, + height: 34, + url: + "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", + ), + 8.width, + SvgPicture.asset("assets/images/side_nav.svg"), + ], + ).onPress(() {}), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + //AppLogo(), + 8.width, + LocaleKeys.mohemm.tr().toText14() + ], + ), + ), + SizedBox( + width: 36, + height: 36, + child: Stack( + alignment: Alignment.centerLeft, + children: [ + SvgPicture.asset("assets/images/announcements.svg"), + Positioned( + right: 0, + top: 0, + child: Container( + padding: const EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + color: MyColors.redColor, + borderRadius: BorderRadius.circular(17)), + child: "3".toText12(color: Colors.white), + ), + ) + ], + ), + ) + ], + ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), + Expanded( + child: ListView( + padding: EdgeInsets.zero, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.goodMorning + .tr() + .toText14(color: MyColors.grey77Color), + "Mahmoud Shrouf".toText24(isBold: true), + 16.height, + Row( + children: [ + Expanded( + child: AspectRatio( + aspectRatio: 159 / 159, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomRight, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset("assets/images/"), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance + .tr() + .toText14( + color: Colors.white, + isBold: true), + 9.height, + "07:55:12".toText14( + color: Colors.white, + isBold: true), + LocaleKeys.timeLeftToday + .tr() + .toText12(color: Colors.white), + 9.height, + const ClipRRect( + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + child: LinearProgressIndicator( + value: 0.7, + minHeight: 8, + valueColor: + const AlwaysStoppedAnimation< + Color>(Colors.white), + backgroundColor: + const Color(0xff196D73), + ), + ), + ], + ).paddingOnly( + top: 12, right: 15, left: 12), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + LocaleKeys.checkIn + .tr() + .toText12( + color: Colors.white), + "09:00".toText14( + color: Colors.white, + isBold: true), + 4.height + ], + ).paddingOnly(left: 12), + ), + Container( + width: 45, + height: 45, + padding: const EdgeInsets.only( + left: 14, right: 14), + decoration: const BoxDecoration( + color: Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: + Radius.circular(15), + ), + ), + child: SvgPicture.asset( + "assets/images/stop.svg"), + ), + ], + ), + ], + ), + ], + ), + ), + ), + ), + 9.width, + Expanded( + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: 2 / 2, + crossAxisSpacing: 9, + mainAxisSpacing: 9), + padding: EdgeInsets.zero, + itemCount: 4, + itemBuilder: (BuildContext context, int index) { + return Container( + decoration: BoxDecoration( + color: Color(namesColor[index]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + names[index].toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: namesInt[index] + .toStringAsFixed(1) + .toText16( + color: Colors.white, + isBold: true), + ), + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: Colors.white) + ], + ) + ], + ).paddingOnly( + left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed( + context, AppRoutes.workList); + }); + }, + ), + ), + ], + ), + 20.height, + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + "Other".toText12(), + LocaleKeys.services.tr().toText24(isBold: true), + ], + ), + ), + LocaleKeys.viewAllServices + .tr() + .toText12(isUnderLine: true), + ], + ), + ], + ).paddingOnly(left: 21, right: 21, top: 7), + SizedBox( + height: 105 + 26, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 13, bottom: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return AspectRatio( + aspectRatio: 105 / 105, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: + const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.asset(iconT[index]), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: + namesT[index].toText11(isBold: true), + ), + SvgPicture.asset( + "assets/images/arrow_next.svg") + .paddingOnly(bottom: 4) + ], + ) + ], + ).paddingOnly( + left: 10, right: 10, bottom: 10, top: 12), + ), + ); + }, + separatorBuilder: (cxt, index) => 9.width, + itemCount: 4), + ), + 8.height, + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 31), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(50), + topLeft: Radius.circular(50)), + border: + Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.offers.tr().toText12(), + Row( + children: [ + LocaleKeys.discounts + .tr() + .toText24(isBold: true), + 6.width, + Container( + padding: const EdgeInsets.only( + left: 8, right: 8), + decoration: BoxDecoration( + color: MyColors.yellowColor, + borderRadius: + BorderRadius.circular(10), + ), + child: LocaleKeys.newString + .tr() + .toText10(isBold: true)), + ], + ), + ], + ), + ), + LocaleKeys.viewAllOffers + .tr() + .toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 103 + 33, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(100), + ), + border: Border.all( + color: MyColors.lightGreyEDColor, + width: 1), + ), + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), + ), + child: Image.network( + "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", + fit: BoxFit.cover, + ), + ), + ), + 4.height, + Expanded( + child: namesD[6 % (index + 1)].toText12( + isCenter: true, maxLine: 2)), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => 8.width, + itemCount: 6), + ), + ], + ), + ) + ], + ), + ) + ], + ), + ); + } +} 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..54be916 --- /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.grey57Color), + 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.lightGreyEFColor, 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/login/verify_whatsapp.svg', flag, null); + case 1: + return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); + case 2: + return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); + case 3: + return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/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/ui/work_list/missing_swipe/fragments/actions_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/actions_fragment.dart new file mode 100644 index 0000000..05cf9ce --- /dev/null +++ b/lib/ui/work_list/missing_swipe/fragments/actions_fragment.dart @@ -0,0 +1,126 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'dart:math' as math; + +class ActionsFragment extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + showItem(), + ], + ), + ); + } + + Widget showItem() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + clipBehavior: Clip.antiAlias, + margin: EdgeInsets.all(21), + child: Stack( + clipBehavior: Clip.antiAlias, + children: [ + Positioned( + left: -21, + child: Transform.rotate( + angle: 125, + child: Container( + width: 60, + height: 20, + color: Colors.black, + ), + ), + ), + Column( + children: [ + Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12), + child: Column( + children: [ + Row( + children: [ + CircularAvatar(), + 12.width, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Mahmoud Shrouf".toText16(), + 6.height, + "Missing Swipe Request for Hussain, Mohammad has been approved" + .toText12(), + 3.height, + Row( + children: [ + "Submitted".toText10(), + 12.width, + "On 07 Jan 2021" + .toText12(color: MyColors.lightTextColor) + ], + ) + ], + ), + ) + ], + ), + ], + ), + ), + 12.height, + Container( + width: double.infinity, + height: 1, + color: MyColors.lightTextColor, + ), + Row( + children: [ + Expanded( + child: Center( + child: "Request Info" + .toText12(isBold: true) + .paddingOnly(left: 21, right: 21, top: 16, bottom: 8), + ), + ), + Center( + child: Container( + width: 1, + height: 45, + color: MyColors.lightTextColor, + ), + ), + Expanded( + child: Center( + child: "Delegate" + .toText12( + color: MyColors.gradiantEndColor, isBold: true) + .paddingOnly(left: 21, right: 21, top: 16, bottom: 8), + ), + ), + ], + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart new file mode 100644 index 0000000..652eba8 --- /dev/null +++ b/lib/ui/work_list/missing_swipe/fragments/attachments_fragment.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; + +class AttachmentsFragment extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: ListView.separated( + itemCount: 2, + padding: EdgeInsets.all(21), + itemBuilder: (context, index) { + return showItem(attachmentsList[index]); + }, + separatorBuilder: (BuildContext context, int index) { + return 21.height; + }, + ), + ); + } + + Widget showItem(Attachments attachments) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(21), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Row( + children: [ + SvgPicture.asset(attachments.icon), + 12.width, + attachments.title.toText16() + ], + ), + ); + } +} + +class Attachments { + String title; + String icon; + + Attachments(this.title, this.icon); +} + +List attachmentsList = [ + Attachments("Attachment File Name.png", "assets/images/png.svg"), + Attachments("Attachment File Name.pdf", "assets/images/pdf.svg"), +]; diff --git a/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart b/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart new file mode 100644 index 0000000..b115df9 --- /dev/null +++ b/lib/ui/work_list/missing_swipe/fragments/info_fragments.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.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'; + +class InfoFragment extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + margin: EdgeInsets.all(21), + padding: EdgeInsets.only(top: 21, bottom: 21, right: 16, left: 16), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: "Info Details".toText16(), + ), + // Icon(Icons.keyboard_arrow_down_rounded), + ], + ), + Column( + children: [ + 12.height, + showItem("From:", "Alma Linde Mendoza"), + showItem("To:", "Al Yabis, Norah"), + showItem("Sent:", "1/26/2020 10:41:07 AM"), + showItem("ID:", "30581045"), + showItem("Closed:", "-"), + ], + ), + ], + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value) { + return Padding( + padding: const EdgeInsets.only(top: 2, bottom: 2), + child: Row( + children: [ + title.toText12(isBold: true), + 6.width, + title.toText12(isBold: false, color: MyColors.normalTextColor), + ], + ), + ); + } +} diff --git a/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart b/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart new file mode 100644 index 0000000..f87995a --- /dev/null +++ b/lib/ui/work_list/missing_swipe/fragments/request_fragment.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; + +class RequestFragment extends StatefulWidget { + @override + State createState() => _RequestFragmentState(); +} + +class _RequestFragmentState extends State { + bool isOpened = false; + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + margin: EdgeInsets.all(21), + padding: EdgeInsets.only(top: 21, bottom: 21, right: 16, left: 16), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: "Hardware Mobility 161 Messenger".toText16(), + ), + Icon(Icons.keyboard_arrow_down_rounded), + ], + ), + Column( + children: [ + 12.height, + showItem("Code:", "3188000067"), + showItem("Quantity:", "1"), + showItem("Line Status:", "Pending Approval"), + showItem("Transection Type:", "Move Order Issue:"), + showItem("Organization Code:", "SWD"), + showItem("From Subinventory:", "SWD_MSPS"), + showItem("To Subinventory:", "SWD_MSPS"), + showItem("Ship To Location :", + "SWD 11206-E.R. (Emergency Room)"), + showItem("Unit:", "Each"), + showItem("Date Required:", "12/23/2019 4:54:04 PM"), + showItem("Status Date:", "12/23/2019 4:54:04 PM"), + showItem("Operation Unit:", "Sehat Al Sewedi"), + showItem("Organization:", "Sehat Al Sewedi"), + showItem("From Locator:", "-"), + showItem("To Locator :", "-"), + ], + ), + ], + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value) { + return Padding( + padding: const EdgeInsets.only(top: 2, bottom: 2), + child: Row( + children: [ + title.toText12(isBold: true), + 6.width, + title.toText12(isBold: false, color: MyColors.normalTextColor), + ], + ), + ); + } +} diff --git a/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart b/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart new file mode 100644 index 0000000..850f565 --- /dev/null +++ b/lib/ui/work_list/missing_swipe/missing_swipe_screen.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/ui/app_bar.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/actions_fragment.dart'; +import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/attachments_fragment.dart'; +import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/info_fragments.dart'; +import 'package:mohem_flutter_app/ui/work_list/missing_swipe/fragments/request_fragment.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; + +class MissingSwipeScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 4, + child: Scaffold( + appBar: appBar(context, title: "Missing Swipe Request"), + body: Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(20), + bottomRight: Radius.circular(20)), + gradient: LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomRight, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + clipBehavior: Clip.antiAlias, + child: TabBar( + indicatorColor: Colors.white, + labelColor: Colors.white, + tabs: [ + Tab( + text: "Request", + ), + Tab( + text: "Actions", + ), + Tab( + text: "Attachments", + ), + Tab( + text: "Info.", + ), + ], + ), + ), + Expanded( + child: TabBarView( + children: [ + RequestFragment(), + ActionsFragment(), + AttachmentsFragment(), + InfoFragment(), + ], + ), + ), + Container( + width: double.infinity, + height: 60, + padding: EdgeInsets.only(left: 21, right: 21), + child: Row( + children: [ + Expanded( + child: DefaultButton( + "Reject", + () {}, + colors: [ + Color(0xffEB8C90), + Color(0xffDE6C70), + ], + ), + ), + 12.width, + Expanded( + child: DefaultButton( + "Approve", + () {}, + colors: [ + Color(0xff32D892), + Color(0xff1AB170), + ], + ), + ), + ], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart new file mode 100644 index 0000000..c3de75f --- /dev/null +++ b/lib/ui/work_list/work_list_screen.dart @@ -0,0 +1,206 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/ui/app_bar.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; + +class WorkListScreen extends StatefulWidget { + @override + State createState() => _WorkListScreenState(); +} + +class _WorkListScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: appBar( + context, + title: LocaleKeys.workList.tr(), + ), + body: Container( + width: double.infinity, + height: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + height: 2, + color: MyColors.darkWhiteColor, + ), + Container( + width: double.infinity, + height: 40, + margin: EdgeInsets.only( + top: 21, + ), + child: ListView.separated( + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.only( + left: 30, + right: 30, + ), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color: tabList[index].isSelected + ? MyColors.darkIconColor + : MyColors.darkWhiteColor, + ), + child: tabList[index].title.toText12( + color: tabList[index].isSelected + ? MyColors.white + : MyColors.black, + ), + ); + }, + separatorBuilder: (context, index) { + return 8.width; + }, + shrinkWrap: true, + itemCount: tabList.length, + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.only( + left: 21, + right: 21, + ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.human.toText12(), + LocaleKeys.resources.tr().toText24(isBold: true), + ], + ).paddingOnly(top: 24, left: 21, right: 21), + 24.height, + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return rowItem(typesList[index]); + }, + separatorBuilder: (context, index) { + return 12.height; + }, + itemCount: typesList.length, + padding: EdgeInsets.only(left: 21, right: 21), + ), + ), + ], + ), + ), + ); + } + + Widget rowItem(Types types) { + return InkWell( + onTap: (){ + Navigator.pushNamed(context, AppRoutes.missingSwipe); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + gradient: LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomRight, + colors: types.colors), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/images/miss_swipe.svg", + color: Colors.white, + ), + 2.height, + types.title.toText10(color: Colors.white) + ], + ).paddingAll(6), + ), + 12.width, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Missing Swipe Request".toText16(), + "Missing Swipe Request for Hussain, Mohammad has been approved" + .toText10(), + 12.height, + Row( + children: [ + Expanded( + child: "07 Jan 2021" + .toText10(color: MyColors.lightTextColor)), + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor, + ) + ], + ), + ], + ), + ), + ], + ), + ), + ); + } +} + +class Tabs { + String title; + bool isSelected; + + Tabs(this.title, this.isSelected); +} + +List tabList = [ + Tabs("All", true), + Tabs("HR", false), + Tabs("MO", false), + Tabs("PR", false), + Tabs("PO", false), +]; + +class Types { + String title; + List colors; + + Types(this.title, this.colors); +} + +List typesList = [ + Types("HR", [Color(0xff32D892), Color(0xff1AB170)]), + Types("ITG", [Color(0xffEB8C90), Color(0xffDE6C70)]), + Types("PO", [Color(0xff5099E3), Color(0xff3670AA)]), + Types("PR", [Color(0xff48EACF), Color(0xff3DCAB3)]), + Types("MO", [Color(0xff58DCFA), Color(0xff3CB9D5)]), +]; 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/app_logo.dart b/lib/widgets/app_logo.dart new file mode 100644 index 0000000..1c0bc37 --- /dev/null +++ b/lib/widgets/app_logo.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +class AppLogo extends StatelessWidget { + AppLogo({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Row(children: [ + SvgPicture.asset( + "assets/mohemm_logo.svg", + height: 100, + width: 100, + alignment: Alignment.centerRight, + ), + ],); + } +} 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/default_button.dart b/lib/widgets/button/default_button.dart index b8ad88e..77d1c61 100644 --- a/lib/widgets/button/default_button.dart +++ b/lib/widgets/button/default_button.dart @@ -1,8 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; extension WithContainer on Widget { - Widget get insideContainer => Container(color: Colors.white, padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); + Widget get insideContainer => Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: this); } class DefaultButton extends StatelessWidget { @@ -16,8 +20,18 @@ class DefaultButton extends StatelessWidget { final double? fontSize; final bool isTextExpanded; final int count; + final List? colors; - DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize}); + DefaultButton(this.text, this.onPress, + {this.color, + this.isTextExpanded = true, + this.svgIcon, + this.disabledColor, + this.count = 0, + this.textColor = Colors.white, + this.iconData, + this.fontSize, + this.colors}); @override Widget build(BuildContext context) { @@ -28,24 +42,36 @@ class DefaultButton extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), gradient: onPress == null - ? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) - : const LinearGradient(transform: GradientRotation(.83), begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - Color(0xff32D892), - Color(0xff259CB8), - ]), + ? const LinearGradient( + colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) + : LinearGradient( + transform: GradientRotation(.83), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: colors ?? + [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ if (iconData != null) Icon(iconData, color: textColor), - if (svgIcon != null) SvgPicture.asset(svgIcon ?? "", color: textColor), + if (svgIcon != null) + SvgPicture.asset(svgIcon ?? "", color: textColor), if (!isTextExpanded) Padding( - padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), + padding: EdgeInsets.only( + left: (iconData ?? svgIcon) != null ? 6 : 0), child: Text( text, textAlign: TextAlign.center, - style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + style: TextStyle( + fontSize: fontSize ?? 16, + fontWeight: FontWeight.w600, + color: textColor, + letterSpacing: -0.48), ), ), if (isTextExpanded) @@ -53,7 +79,11 @@ class DefaultButton extends StatelessWidget { child: Text( text, textAlign: TextAlign.center, - style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + style: TextStyle( + fontSize: fontSize ?? 16, + fontWeight: FontWeight.w600, + color: textColor, + letterSpacing: -0.48), ), ), if (count > 0) @@ -64,11 +94,17 @@ class DefaultButton extends StatelessWidget { padding: const EdgeInsets.only(left: 5, right: 5), alignment: Alignment.center, height: 16, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: Colors.white), child: Text( "$count", textAlign: TextAlign.center, - style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: Color(0xffD02127), letterSpacing: -0.6), + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w700, + color: Color(0xffD02127), + letterSpacing: -0.6), ), ), ) 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/circular_avatar.dart b/lib/widgets/circular_avatar.dart new file mode 100644 index 0000000..cd60e06 --- /dev/null +++ b/lib/widgets/circular_avatar.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +class CircularAvatar extends StatelessWidget { + final String? url; + final double radius; + final double width; + final double height; + + CircularAvatar({Key? key, this.radius = 70.0, this.width = 70, this.height = 60, this.url}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + width: width, + height: height, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + fit: BoxFit.cover, + image: NetworkImage(url ?? "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png"), + ), + ), + ); + } +} 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..56d2f3f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -28,7 +28,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.1.0" charcode: dependency: transitive description: @@ -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,13 +189,20 @@ 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: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.10" meta: dependency: transitive description: @@ -424,7 +445,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.2" typed_data: dependency: transitive description: @@ -445,7 +466,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.0" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 50eef52..dfbb0eb 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: @@ -75,6 +77,8 @@ flutter: - assets/langs/ - assets/icons/ - assets/images/ + - assets/images/login/ + - assets/images/logos/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.