From 26277765db3424dc6e0f13a72f72146e3ac9b05a Mon Sep 17 00:00:00 2001 From: Benjamin Arhen Date: Sat, 17 Sep 2022 12:42:41 -0400 Subject: [PATCH] After null-safety barely stable --- .DS_Store | Bin 10244 -> 10244 bytes android/app/google-services.json | 37 +- assets/.DS_Store | Bin 0 -> 6148 bytes assets/images/.DS_Store | Bin 0 -> 10244 bytes assets/images/coupon.svg | 1 + assets/images/search.svg | 1 + ios/Podfile | 6 +- ios/Podfile.lock | 217 ++++----- ios/Runner.xcodeproj/project.pbxproj | 8 +- ios/Runner/.DS_Store | Bin 6148 -> 6148 bytes ios/Runner/Base.lproj/Main.storyboard | 13 +- ios/Runner/GoogleService-Info.plist | 18 +- ios/Runner/Info.plist | 1 + ios/Runner/ProdGoogleService-Info.plist | 38 ++ ios/firebase_app_id_file.json | 6 +- lib/Classes/API Clasess/BusinessProfile.dart | 8 +- lib/Classes/API Clasess/CampAd.dart | 6 +- lib/Classes/API Clasess/Campaign.dart | 16 +- lib/Classes/API Clasess/CommentsPost.dart | 10 +- lib/Classes/API Clasess/CouponDetails.dart | 32 +- lib/Classes/API Clasess/CouponHead.dart | 26 +- lib/Classes/API Clasess/Desire.dart | 12 +- lib/Classes/API Clasess/ExploreObject.dart | 4 +- lib/Classes/API Clasess/FacebookUser.dart | 20 +- lib/Classes/API Clasess/GoogleUser.dart | 20 +- lib/Classes/API Clasess/Post.dart | 18 +- lib/Classes/API Clasess/PostFav.dart | 8 +- lib/Classes/API Clasess/PostUpload.dart | 10 +- lib/Classes/API Clasess/PostedAd.dart | 14 +- lib/Classes/API Clasess/PostionAP.dart | 4 +- lib/Classes/API Clasess/Product.dart | 14 +- lib/Classes/API Clasess/ProximityCoupon.dart | 28 +- lib/Classes/API Clasess/ReferralClass.dart | 6 +- lib/Classes/API Clasess/Registrar.dart | 6 +- lib/Classes/API Clasess/ResetClass.dart | 6 +- .../API Clasess/SilverPurchaseRequest.dart | 6 +- .../API Clasess/TesoBusinessDetail.dart | 28 +- lib/Classes/API Clasess/TesoUserDetail.dart | 26 +- lib/Classes/API Clasess/ThirdPerson.dart | 16 +- lib/Classes/API Clasess/TokenHandler.dart | 6 +- lib/Classes/API Clasess/TwitterUser.dart | 20 +- lib/Classes/API Clasess/UserAuth.dart | 12 +- lib/Classes/API Clasess/UserFavCategory.dart | 6 +- lib/Classes/API Clasess/UserFinance.dart | 6 +- lib/Classes/ChatMessage.dart | 10 +- lib/Classes/ColorFilters.dart | 4 +- lib/Classes/Connection.dart | 2 +- lib/Classes/Firebase/Comments.dart | 14 +- lib/Classes/Firebase/Posts.dart | 22 +- lib/Classes/NotificationSpliter.dart | 14 - lib/Classes/Payload.dart | 22 +- lib/Classes/Product.dart | 16 +- lib/Classes/QRClass.dart | 6 +- lib/Classes/ReportedContent.dart | 10 +- lib/Classes/TesoShop.dart | 26 +- lib/Classes/TesoUser.dart | 34 +- lib/Classes/TextE.dart | 6 +- lib/Classes/categories.dart | 6 +- lib/Classes/customLoginButton.dart | 14 +- lib/Classes/customTesoButton.dart | 12 +- lib/Classes/friend.dart | 18 +- lib/Classes/inbox.dart | 18 +- lib/Notifications/NotificationPlugin.dart | 24 +- lib/Pages/BusinessLocator.dart | 76 +-- lib/Pages/DesireComeTrue.dart | 10 +- lib/Pages/LandingPage.dart | 4 +- lib/Pages/PageWidgets/Alerts/AlertTile.dart | 14 +- lib/Pages/PageWidgets/Alerts/Redeemable.dart | 10 +- lib/Pages/PageWidgets/Alerts/Refund.dart | 2 +- lib/Pages/PageWidgets/Alerts/header.dart | 10 +- .../Alerts/personalizedCoupon.dart | 14 +- lib/Pages/PageWidgets/Alerts/post.dart | 10 +- lib/Pages/PageWidgets/Alerts/requestTile.dart | 18 +- .../BusinessProfile/BusinessHead.dart | 20 +- .../BusinessProfile/BusinessItems.dart | 6 +- lib/Pages/PageWidgets/ChatScreen/header.dart | 6 +- .../PageWidgets/ChatScreen/recipient.dart | 4 +- lib/Pages/PageWidgets/ChatScreen/sender.dart | 4 +- .../PageWidgets/CoinPurchase/AmountInput.dart | 2 +- .../PageWidgets/CoinPurchase/MomoType.dart | 4 +- .../PageWidgets/CoinPurchase/PayGold.dart | 2 +- .../CoinPurchase/SilverAmountInput.dart | 2 +- .../CoinPurchase/SilverPurchase.dart | 10 +- .../PageWidgets/CoinPurchase/phonenumber.dart | 2 +- .../PageWidgets/CoinPurchase/selector.dart | 2 +- lib/Pages/PageWidgets/Coupons/GiftFriend.dart | 14 +- lib/Pages/PageWidgets/Coupons/mycoupons.dart | 32 +- .../Coupons/personalizedDiscount.dart | 22 +- .../Coupons/personalizedFreebie.dart | 10 +- .../PageWidgets/CouponsList/activeCoupon.dart | 48 +- .../CouponsList/activeFreebieCoupon.dart | 18 +- .../DesireComeTrue/DesireTile.dart | 4 +- .../DesireComeTrue/DesiredItem.dart | 26 +- .../PageWidgets/Editors/SampleThumbnail.dart | 8 +- lib/Pages/PageWidgets/Explore/business.dart | 10 +- .../PageWidgets/Explore/categoriesTile.dart | 4 +- lib/Pages/PageWidgets/Explore/popular.dart | 2 +- lib/Pages/PageWidgets/Explore/products.dart | 2 +- lib/Pages/PageWidgets/Explore/trending.dart | 2 +- lib/Pages/PageWidgets/Friends/friendTile.dart | 8 +- lib/Pages/PageWidgets/Friends/header.dart | 2 +- .../HomeProximity/ActiveDiscount.dart | 44 +- .../HomeProximity/ActiveFreebie.dart | 26 +- .../HomeProximity/DummyDiscount.dart | 24 +- .../HomeProximity/DummyFreebie.dart | 14 +- lib/Pages/PageWidgets/Inbox/inboxTile.dart | 16 +- .../PageWidgets/Login/passwordSignUP.dart | 2 +- lib/Pages/PageWidgets/Login/phonenumber.dart | 2 +- lib/Pages/PageWidgets/Login/validation.dart | 8 +- lib/Pages/PageWidgets/Personal/header.dart | 50 +- .../ProximityList/ActiveDiscount.dart | 42 +- .../ProximityList/ActiveFreebie.dart | 26 +- .../ProximityList/DummyDiscount.dart | 22 +- .../ProximityList/DummyFreebie.dart | 14 +- .../Recently Viewed/viewedItem.dart | 14 +- lib/Pages/PageWidgets/Redeem/activeCard.dart | 8 +- lib/Pages/PageWidgets/Redeem/detail.dart | 26 +- .../PageWidgets/Redeem/discountCoupon.dart | 14 +- lib/Pages/PageWidgets/Redeem/dummyCard.dart | 2 +- .../PageWidgets/Redeem/scannedDummy.dart | 4 +- .../PageWidgets/Settings/AccountSettings.dart | 28 +- .../PageWidgets/Settings/EditProfile.dart | 60 +-- .../Third Person Profile/header.dart | 34 +- .../WalkIn Coupons/ActiveDiscount.dart | 24 +- .../WalkIn Coupons/ActiveFreebie.dart | 14 +- .../WalkIn Coupons/DummyDiscount.dart | 20 +- .../WalkIn Coupons/DummyFreebie.dart | 10 +- lib/Pages/Personnal.dart | 36 +- .../Camera/Picture/PictureReview.dart | 2 +- .../@Generic/Camera/Picture/TakeDP.dart | 46 +- .../@Generic/Camera/Picture/TakePicture.dart | 60 +-- lib/Pages/Sub_Pages/@Generic/Error.dart | 6 +- .../Sub_Pages/@Generic/ProductImage.dart | 2 +- .../Sub_Pages/@Generic/RedeemingCoupon.dart | 2 +- .../Sub_Pages/@Generic/SuccessRedeem.dart | 26 +- .../Sub_Pages/@Generic/productDetails.dart | 40 +- .../@Generic/prominentDisclosure.dart | 2 +- .../prominentDisclosureBackground.dart | 2 +- .../AccountSettings/BlockedUser.dart | 4 +- .../AccountSettings/changePassword.dart | 2 +- .../AccountSettings/genderPicker.dart | 14 +- .../AccountSettings/newPassword.dart | 8 +- .../Sub_Pages/Business/BusinessProducts.dart | 18 +- .../Sub_Pages/Business/BusinessProfile.dart | 58 +-- lib/Pages/Sub_Pages/BusinessDetails.dart | 18 +- lib/Pages/Sub_Pages/CoinPurchase.dart | 10 +- .../CoinsPurchase/GoldTransactions.dart | 2 +- .../CoinsPurchase/GoldWithdrawal.dart | 10 +- .../CoinsPurchase/PurchaseingSilver.dart | 16 +- .../CoinsPurchase/SilverPurchase.dart | 16 +- .../CoinsPurchase/SilverPurchaseFixed.dart | 19 +- .../CoinsPurchase/SilverTransaction.dart | 2 +- lib/Pages/Sub_Pages/Coupons/Acquire.dart | 32 +- .../Sub_Pages/Coupons/CouponLocation.dart | 70 +-- .../Sub_Pages/Coupons/LoadGiftRecipient.dart | 22 +- .../Sub_Pages/Coupons/MyCouponOptions.dart | 56 +-- .../Sub_Pages/Coupons/ProximityCoupons.dart | 43 +- .../Desires Come True/AddDesire.dart | 22 +- .../Desires Come True/NotListed.dart | 12 +- .../Explore/Categories/ExploreCategory.dart | 26 +- .../Sub_Pages/Explore/ExploreBusiness.dart | 12 +- .../Sub_Pages/Explore/ExplorePeople.dart | 10 +- .../Sub_Pages/Explore/ExploreProduct.dart | 12 +- .../Sub_Pages/Explore/Latest/AllLatest.dart | 10 +- .../Sub_Pages/Explore/ML/FindProduct.dart | 22 +- .../Explore/Trending/AllTrending.dart | 10 +- lib/Pages/Sub_Pages/Explore/search.dart | 16 +- .../Sub_Pages/LandingPage/FinalProcess.dart | 28 +- lib/Pages/Sub_Pages/LandingPage/Login.dart | 155 +++--- .../Sub_Pages/LandingPage/NewProfile.dart | 8 +- .../Sub_Pages/LandingPage/ReferPage.dart | 12 +- .../Sub_Pages/LandingPage/ResetPassword.dart | 2 +- lib/Pages/Sub_Pages/LandingPage/SignUp.dart | 2 +- lib/Pages/Sub_Pages/LandingPage/Success.dart | 2 +- .../Sub_Pages/LandingPage/createPassword.dart | 18 +- .../LandingPage/facebookRedirect.dart | 4 +- .../LandingPage/registeringProcess.dart | 12 +- .../LandingPage/resetVerification.dart | 2 +- .../LandingPage/resetpasswordCode.dart | 8 +- .../Sub_Pages/LandingPage/verification.dart | 42 +- lib/Pages/Sub_Pages/Notifications/Alerts.dart | 182 +++---- .../Sub_Pages/Notifications/ChatScreen.dart | 110 ++--- lib/Pages/Sub_Pages/Notifications/Inbox.dart | 54 +-- .../Sub_Pages/Notifications/newMessage.dart | 18 +- lib/Pages/Sub_Pages/Payments/PaymentView.dart | 7 +- lib/Pages/Sub_Pages/Payments/Withdrawal.dart | 36 +- .../Sub_Pages/PersonalSub/Categories.dart | 5 +- .../PersonalSub/CompleteProfile.dart | 12 +- lib/Pages/Sub_Pages/PersonalSub/Friends.dart | 16 +- lib/Pages/Sub_Pages/PersonalSub/Recently.dart | 97 ++-- lib/Pages/Sub_Pages/PersonalSub/Referral.dart | 15 +- lib/Pages/Sub_Pages/PersonalSub/Settings.dart | 22 +- lib/Pages/Sub_Pages/PopUp/Personalized.dart | 14 +- .../Sub_Pages/ProductDetails/CouponList.dart | 20 +- lib/Pages/Sub_Pages/homeSub/MyCoupons.dart | 7 +- .../Sub_Pages/homeSub/ProximityCoupons.dart | 36 +- lib/Pages/Sub_Pages/userProfile3P.dart | 64 +-- lib/Pages/codeQR.dart | 10 +- lib/Pages/explore.dart | 53 +-- lib/Pages/firsttimer.dart | 2 +- lib/Pages/home.dart | 68 ++- lib/Pages/notifications.dart | 12 +- lib/Pages/productView.dart | 56 +-- lib/Pages/scannerqr.dart | 22 +- lib/Pages/splash.dart | 22 +- lib/Prodfirebase_options.dart | 72 +++ lib/Services/DynamicLinks.dart | 6 +- lib/Services/navigation_service.dart | 4 +- lib/firebase_options.dart | 26 +- lib/main.dart | 12 +- lib/main_screen.dart | 143 +++--- lib/providers/app_provider.dart | 2 +- lib/providers/device_provider.dart | 55 +-- lib/providers/pageAnimations.dart | 24 +- lib/providers/referral_provider.dart | 4 +- lib/providers/user_provider.dart | 56 +-- lib/resetpassword.dart | 10 +- lib/simplewidgets/custom_alert.dart | 10 +- lib/src/qr_code_scanner.dart | 28 +- lib/src/qr_scanner_overlay_shape.dart | 14 +- lib/teso_fab.dart | 447 +++++++++--------- lib/util/SizeConfig.dart | 18 +- lib/util/consts.dart | 19 +- pubspec.yaml | 15 +- 224 files changed, 2541 insertions(+), 2485 deletions(-) create mode 100644 assets/.DS_Store create mode 100644 assets/images/.DS_Store create mode 100644 assets/images/coupon.svg create mode 100644 assets/images/search.svg create mode 100644 ios/Runner/ProdGoogleService-Info.plist create mode 100644 lib/Prodfirebase_options.dart diff --git a/.DS_Store b/.DS_Store index dac28d82adb3e4a81fa73a9270338ca626532284..acfc3e5993dcda8822d093a403a4b3d00f1a38eb 100644 GIT binary patch delta 51 zcmZn(XbG6$&nUeyU^hRb^kyD`<&2Zt1$lYOf{XHU^7GOe7#J8gZxFQR+sv-;i)Hgu H5oTrps80{) delta 37 tcmZn(XbG6$&nUGqU^hRb)Mg%m<&2xp3tI3^Y>?T^uJDUxv#cmHGXU^O3&{Wg diff --git a/android/app/google-services.json b/android/app/google-services.json index 6db7eeb..20d033b 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,62 +1,45 @@ { "project_info": { - "project_number": "280510379185", - "firebase_url": "https://teso-ghana-default-rtdb.firebaseio.com", - "project_id": "teso-ghana", - "storage_bucket": "teso-ghana.appspot.com" + "project_number": "675860686596", + "project_id": "teso-test-6fc81", + "storage_bucket": "teso-test-6fc81.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:280510379185:android:b778de8dca1cf49219de90", + "mobilesdk_app_id": "1:675860686596:android:8522b46df172af41cd9251", "android_client_info": { "package_name": "com.sparentechBacware.teso" } }, "oauth_client": [ { - "client_id": "280510379185-0shp8sia3i5m589bov645t3kuddb1032.apps.googleusercontent.com", + "client_id": "675860686596-in4piqob6d8nj42nguh06abpdrrhai0f.apps.googleusercontent.com", "client_type": 1, "android_info": { "package_name": "com.sparentechBacware.teso", - "certificate_hash": "40b68890dd51d72454ccdc7289623c4d56273248" + "certificate_hash": "b50b0b74dfcde0a02336f00eae49428a517551b2" } }, { - "client_id": "280510379185-87k85sksrd30mu9fjgfmacb3bkcjnmdq.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.sparentechBacware.teso", - "certificate_hash": "4f655cf94cd94864838475611b711c2528e33601" - } - }, - { - "client_id": "280510379185-ac7qjglm9cct9u0diqrns6om8t2mb9ug.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.sparentechBacware.teso", - "certificate_hash": "063304c2da41f90c824fad163b5ad481edf6db11" - } - }, - { - "client_id": "280510379185-58chj1fi4pts4p7p7sieq16miapvtepi.apps.googleusercontent.com", + "client_id": "675860686596-n32ta36ndmugfm1jj61mu2p1v197a1nn.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyAHBguF6oqPEq7em1vLrh_NP2LoPuabe6o" + "current_key": "AIzaSyDt05opA09hr9Y1pysllCsEE_6dT4CrhRM" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "280510379185-58chj1fi4pts4p7p7sieq16miapvtepi.apps.googleusercontent.com", + "client_id": "675860686596-n32ta36ndmugfm1jj61mu2p1v197a1nn.apps.googleusercontent.com", "client_type": 3 }, { - "client_id": "280510379185-67vianhh973klriv75ip2tb9cf8ibitl.apps.googleusercontent.com", + "client_id": "675860686596-8dsd5qf42n1gej04f2m2rmt27neft8vg.apps.googleusercontent.com", "client_type": 2, "ios_info": { "bundle_id": "com.tesoapp", diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..af794031abf4def113bc97f10f786b3ca6b94c07 GIT binary patch literal 6148 zcmeHKPfrs;6n_I1wji=Vi%2wS?8O9vP>BgKhP7Z6J%B9162P+CPRq)6r`g@MA|dHn z6F-0-z^hljfJd($y!Zt?c=D=m{xq;wuS(3m6=Z#y#`03i8Bc@97a01cI6 zVgQTZ2yf@wB|Xa1he$*p6oM6(m28*UUD2^4W*}zZyfMJ{ZXY;M0}HAU-M{=$xQ9CP zLx`AqB-U;Pb+y+|?7Hg&;q2@u($kx`(ATf^YlGUZxzAc=XoZa+Z~5E2w!xTdcWlev zbZD!nrA3k>HdmhU`3byfSO$S;H#_BG;4+T2f0E^@*dSx!l5ZWT5YiVRH;Ve` zFLCR%{Or`VaahNg)Tu-C^}wgp+phXfd9_jrXjnL7Zx!|7pyV^xU1Nb0I?UVJ36SWO zkk(eb3d0ebNb+i(HwBy24-mU@3R{-%TV9ps4|iS5rtYejXJN={Jd*c@3t96i?@5ep z)~%A`RkMrVB$HWVtz+Dfh7MV20A!8BJz;C9j!Plg@R&!F$*l2Mc{G^9AKfD`VINxX z2HwIuIDrrF8NR}Ik|5*cI+-H#*QOzS?6a|0J&&TO(gx4tYmMGJKsK*CUBNO#PA!2mwKO@3{7!u<$W*}xD%0REI>iqt{|L6CAG%2pd48#ol zR}7HEvbmhcC8@i$YjOOp&7kg~a^Z1pi6R9HbsYTOxW;;y(g{ MhPa3s_^S;31O)}~0ssI2 literal 0 HcmV?d00001 diff --git a/assets/images/.DS_Store b/assets/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d1dd2d501d2a39262b872b420be217ac21a56f7e GIT binary patch literal 10244 zcmeHM!EO^V5FLk#CfQO-5eOk6?Fn(AfoZ!va6nkUmSdg$Kdp5~D&-l%FR(6O;^-m5S5~W1cMrXOPhQZVLckT@j^9&OhwK?S*HXhtX*elk zS(y`x66?UFqE4!(WgH^|k%2`9`0Tz;+c>jVR6FPQEt=9XjdzN2e^``5=<(LtM&J4= z4Nr_6Qbzmq9%udvr~VUQ4#zEr31-dW+t{Uc;KY(?GNZaRNWR7S!j4ege-j zn$aQc!m~Pn`q4mj1;uReJw^p?a+it1$V+Vv?;g ze^ZRdz|82>$4Bd%g}Du`;TtR+0h5Vj^d3#{X=-EzeslQc_k*Ki`*9U>@|sU&&N1eg z%99r@5wg)8SegJ)(?`EOiII(1vk-l({X+o9QF3u3tZ^UcAyB2{P#|N~y2aTBqT}NB zz*tUae!CKB+wK*KF2}W&yRHeaUTz4?I+i<7cfeSw~Vax#kD5Q=(zd(ZL)w zvPkD&pz^fdSghZKK3D6K9-;rP^gFQ5YZ!|cnV(&*CC*%z&*vJ@3-{f`Rm9OvpnC=j zwO|780nU2|wMMVu0nUWV~Y$#1|kEIfyh8) z;6fO-=cG4y}6bG!64W1 rka8W54}2Ye51n-%u;hm4o{@7c@eSIA{}~X^|MC3)=hooAJpca!t^phM literal 0 HcmV?d00001 diff --git a/assets/images/coupon.svg b/assets/images/coupon.svg new file mode 100644 index 0000000..afaa12f --- /dev/null +++ b/assets/images/coupon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/search.svg b/assets/images/search.svg new file mode 100644 index 0000000..0d9ddca --- /dev/null +++ b/assets/images/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 74a05be..b6d908a 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,7 +1,7 @@ # Uncomment this line to define a global platform for your project -platform :ios, '12.0' +platform :ios, '15.0' # Override Firebase SDK Version -$FirebaseSDKVersion = '8.15.0' + $FirebaseSDKVersion = '9.2.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -39,7 +39,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0' end end end \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ef07a3f..e2dde26 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -608,102 +608,105 @@ PODS: - BoringSSL-GRPC/Implementation (0.0.24): - BoringSSL-GRPC/Interface (= 0.0.24) - BoringSSL-GRPC/Interface (0.0.24) - - camera (0.0.1): + - camera_avfoundation (0.0.1): - Flutter - - cloud_firestore (3.1.15): - - Firebase/Firestore (= 8.15.0) + - cloud_firestore (3.2.0): + - Firebase/Firestore (= 9.2.0) - firebase_core - Flutter - connectivity (0.0.1): - Flutter - Reachability - - Firebase/Analytics (8.15.0): + - Firebase/Analytics (9.2.0): - Firebase/Core - - Firebase/Auth (8.15.0): + - Firebase/Auth (9.2.0): - Firebase/CoreOnly - - FirebaseAuth (~> 8.15.0) - - Firebase/Core (8.15.0): + - FirebaseAuth (~> 9.2.0) + - Firebase/Core (9.2.0): - Firebase/CoreOnly - - FirebaseAnalytics (~> 8.15.0) - - Firebase/CoreOnly (8.15.0): - - FirebaseCore (= 8.15.0) - - Firebase/Crashlytics (8.15.0): + - FirebaseAnalytics (~> 9.2.0) + - Firebase/CoreOnly (9.2.0): + - FirebaseCore (= 9.2.0) + - Firebase/Crashlytics (9.2.0): - Firebase/CoreOnly - - FirebaseCrashlytics (~> 8.15.0) - - Firebase/DynamicLinks (8.15.0): + - FirebaseCrashlytics (~> 9.2.0) + - Firebase/DynamicLinks (9.2.0): - Firebase/CoreOnly - - FirebaseDynamicLinks (~> 8.15.0) - - Firebase/Firestore (8.15.0): + - FirebaseDynamicLinks (~> 9.2.0) + - Firebase/Firestore (9.2.0): - Firebase/CoreOnly - - FirebaseFirestore (~> 8.15.0) - - Firebase/Messaging (8.15.0): + - FirebaseFirestore (~> 9.2.0) + - Firebase/Messaging (9.2.0): - Firebase/CoreOnly - - FirebaseMessaging (~> 8.15.0) - - firebase_analytics (9.1.8): - - Firebase/Analytics (= 8.15.0) + - FirebaseMessaging (~> 9.2.0) + - firebase_analytics (9.1.11): + - Firebase/Analytics (= 9.2.0) - firebase_core - Flutter - - firebase_auth (3.3.18): - - Firebase/Auth (= 8.15.0) + - firebase_auth (3.4.0): + - Firebase/Auth (= 9.2.0) - firebase_core - Flutter - - firebase_core (1.17.0): - - Firebase/CoreOnly (= 8.15.0) + - firebase_core (1.22.0): + - Firebase/CoreOnly (= 9.2.0) - Flutter - - firebase_crashlytics (2.8.0): - - Firebase/Crashlytics (= 8.15.0) + - firebase_crashlytics (2.8.3): + - Firebase/Crashlytics (= 9.2.0) - firebase_core - Flutter - - firebase_dynamic_links (4.2.3): - - Firebase/DynamicLinks (= 8.15.0) + - firebase_dynamic_links (4.3.0): + - Firebase/DynamicLinks (= 9.2.0) - firebase_core - Flutter - - firebase_messaging (11.4.0): - - Firebase/Messaging (= 8.15.0) + - firebase_messaging (11.4.3): + - Firebase/Messaging (= 9.2.0) - firebase_core - Flutter - - FirebaseAnalytics (8.15.0): - - FirebaseAnalytics/AdIdSupport (= 8.15.0) - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) + - FirebaseAnalytics (9.2.0): + - FirebaseAnalytics/AdIdSupport (= 9.2.0) + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - FirebaseAnalytics/AdIdSupport (8.15.0): - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleAppMeasurement (= 8.15.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (9.2.0): + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleAppMeasurement (= 9.2.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - FirebaseAuth (8.15.0): - - FirebaseCore (~> 8.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAuth (9.2.0): + - FirebaseCore (~> 9.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/Environment (~> 7.7) - - GTMSessionFetcher/Core (~> 1.5) - - FirebaseCore (8.15.0): - - FirebaseCoreDiagnostics (~> 8.0) + - GTMSessionFetcher/Core (< 3.0, >= 1.7) + - FirebaseCore (9.2.0): + - FirebaseCoreDiagnostics (~> 9.0) + - FirebaseCoreInternal (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - FirebaseCoreDiagnostics (8.15.0): - - GoogleDataTransport (~> 9.1) + - FirebaseCoreDiagnostics (9.5.0): + - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - nanopb (~> 2.30908.0) - - FirebaseCrashlytics (8.15.0): - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleDataTransport (~> 9.1) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCoreInternal (9.5.0): + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - FirebaseCrashlytics (9.2.0): + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - - nanopb (~> 2.30908.0) - - PromisesObjC (< 3.0, >= 1.2) - - FirebaseDynamicLinks (8.15.0): - - FirebaseCore (~> 8.0) - - FirebaseFirestore (8.15.0): + - nanopb (< 2.30910.0, >= 2.30908.0) + - PromisesObjC (~> 2.1) + - FirebaseDynamicLinks (9.2.0): + - FirebaseCore (~> 9.0) + - FirebaseFirestore (9.2.0): - abseil/algorithm (~> 1.20211102.0) - abseil/base (~> 1.20211102.0) - abseil/container/flat_hash_map (~> 1.20211102.0) @@ -712,24 +715,24 @@ PODS: - abseil/strings/strings (~> 1.20211102.0) - abseil/time (~> 1.20211102.0) - abseil/types (~> 1.20211102.0) - - FirebaseCore (~> 8.0) + - FirebaseCore (~> 9.0) - "gRPC-C++ (~> 1.44.0)" - leveldb-library (~> 1.22) - - nanopb (~> 2.30908.0) - - FirebaseInstallations (8.15.0): - - FirebaseCore (~> 8.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseInstallations (9.5.0): + - FirebaseCore (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - - PromisesObjC (< 3.0, >= 1.2) - - FirebaseMessaging (8.15.0): - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleDataTransport (~> 9.1) + - PromisesObjC (~> 2.1) + - FirebaseMessaging (9.2.0): + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Reachability (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - - nanopb (~> 2.30908.0) + - nanopb (< 2.30910.0, >= 2.30908.0) - Flutter (1.0.0) - flutter_inappwebview (0.0.1): - Flutter @@ -753,7 +756,7 @@ PODS: - FMDB/standard (2.7.5) - geolocator_apple (1.2.0): - Flutter - - google_maps_flutter (0.0.1): + - google_maps_flutter_ios (0.0.1): - Flutter - GoogleMaps - google_ml_vision (0.0.7): @@ -765,26 +768,26 @@ PODS: - google_sign_in_ios (0.0.1): - Flutter - GoogleSignIn (~> 6.2) - - GoogleAppMeasurement (8.15.0): - - GoogleAppMeasurement/AdIdSupport (= 8.15.0) + - GoogleAppMeasurement (9.2.0): + - GoogleAppMeasurement/AdIdSupport (= 9.2.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (8.15.0): - - GoogleAppMeasurement/WithoutAdIdSupport (= 8.15.0) + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (9.2.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 9.2.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/WithoutAdIdSupport (8.15.0): + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (9.2.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - - nanopb (~> 2.30908.0) + - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleDataTransport (9.1.4): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) @@ -976,7 +979,7 @@ PODS: - permission_handler_apple (9.0.4): - Flutter - PhoneNumberKit/PhoneNumberKitCore (3.3.4) - - PromisesObjC (2.1.0) + - PromisesObjC (2.1.1) - Protobuf (3.20.1) - Reachability (3.2) - share_plus (0.0.1): @@ -995,7 +998,7 @@ PODS: - Flutter DEPENDENCIES: - - camera (from `.symlinks/plugins/camera/ios`) + - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) @@ -1011,7 +1014,7 @@ DEPENDENCIES: - flutter_qrcode_scanner (from `.symlinks/plugins/flutter_qrcode_scanner/ios`) - flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) + - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - google_ml_vision (from `.symlinks/plugins/google_ml_vision/ios`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) @@ -1038,6 +1041,7 @@ SPEC REPOS: - FirebaseAuth - FirebaseCore - FirebaseCoreDiagnostics + - FirebaseCoreInternal - FirebaseCrashlytics - FirebaseDynamicLinks - FirebaseFirestore @@ -1079,8 +1083,8 @@ SPEC REPOS: - TOCropViewController EXTERNAL SOURCES: - camera: - :path: ".symlinks/plugins/camera/ios" + camera_avfoundation: + :path: ".symlinks/plugins/camera_avfoundation/ios" cloud_firestore: :path: ".symlinks/plugins/cloud_firestore/ios" connectivity: @@ -1111,8 +1115,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_webview_plugin/ios" geolocator_apple: :path: ".symlinks/plugins/geolocator_apple/ios" - google_maps_flutter: - :path: ".symlinks/plugins/google_maps_flutter/ios" + google_maps_flutter_ios: + :path: ".symlinks/plugins/google_maps_flutter_ios/ios" google_ml_vision: :path: ".symlinks/plugins/google_ml_vision/ios" google_sign_in_ios: @@ -1148,25 +1152,26 @@ SPEC CHECKSUMS: abseil: ebe5b5529fb05d93a8bdb7951607be08b7fa71bc AppAuth: 80317d99ac7ff2801a2f18ff86b48cd315ed465d BoringSSL-GRPC: 3175b25143e648463a56daeaaa499c6cb86dad33 - camera: 9993f92f2c793e87b65e35f3a23c70582afb05b1 - cloud_firestore: 76e73835a6ac79ac825190eefd876a1e100c7835 + camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9 + cloud_firestore: 30fe479181386bcf28579a0b4bf1654c89b88542 connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d - firebase_analytics: 92d27947c7516981cabdc0acbb33cd0687bcda44 - firebase_auth: ace975b530600827bd901a9a18584f7cdaf6d160 - firebase_core: aa1b92020533f5c23955e388c347c58fd64f8627 - firebase_crashlytics: d42b108fa870b889f4c4ea22094647f2aca5f765 - firebase_dynamic_links: 7263ea02f9eb9af202173d2ec093120340e38677 - firebase_messaging: 8957bf304b47daf8bf12d0b111fdecc5b33e77a3 - FirebaseAnalytics: 7761cbadb00a717d8d0939363eb46041526474fa - FirebaseAuth: 3e73bf8abf4fbb40f8b421f361f4cc48ee57388c - FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1 - FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb - FirebaseCrashlytics: feb07e4e9187be3c23c6a846cce4824e5ce2dd0b - FirebaseDynamicLinks: 1dc816ef789c5adac6fede0b46d11478175c70e4 - FirebaseFirestore: d7023faff8e1b4fd69d0adbcf18e65129bc03842 - FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd - FirebaseMessaging: 5e5118a2383b3531e730d974680954c679ca0a13 + Firebase: 4ba896cb8e5105d4b9e247e1c1b6222b548df55a + firebase_analytics: ff0cb0848b62fea2c6cf93dfd08135130f194de8 + firebase_auth: 4844b43012019d01268544a497b5a9757f69027b + firebase_core: 07ad4db354f9b07c54809df99dbe6dd5f7256872 + firebase_crashlytics: e0040786f14b369cc717037d124ae124d40c6460 + firebase_dynamic_links: e2d08d5e0cd443258a54137a61247e92d5e1a1c4 + firebase_messaging: 753569fe9d79bcc694bab3526b168d248b512ce2 + FirebaseAnalytics: af5a03a8dff7648c7b8486f6a78b1368e0268dd3 + FirebaseAuth: 1c574ab64a051dd86dbe7fd5a3f86b58155b3482 + FirebaseCore: 0e27f2a15d8f7b7ef11e7d93e23b1cbab55d748c + FirebaseCoreDiagnostics: 17cbf4e72b1dbd64bfdc33d4b1f07bce4f16f1d8 + FirebaseCoreInternal: 50a8e39cae8abf72d5145d07ea34c3244f70862b + FirebaseCrashlytics: 9fff819edb2bfc9d3eff612225b207d41945a935 + FirebaseDynamicLinks: f576ccfba05f2813e3679d48ccae5bcfff5714fc + FirebaseFirestore: de27d96de10596ebc114adf25c6aa7d36dd91f2f + FirebaseInstallations: 41f811b530c41dd90973d0174381cdb3fcb5e839 + FirebaseMessaging: 4eaf1b8a7464b2c5e619ad66e9b20ee3e3206b24 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 flutter_libphonenumber: 6a23afdf063b34d1e53e6dbd6c6bc905d18e8e46 @@ -1175,10 +1180,10 @@ SPEC CHECKSUMS: flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 - google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d + google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9 google_ml_vision: d16cd76617b3260c4283a28843555a8c6253a171 - google_sign_in_ios: 90eec6616c4c2105b9f9fe5c774773d13565b504 - GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e + google_sign_in_ios: 4f85eb9f937450765c8573bb85fd8cd6a5af675c + GoogleAppMeasurement: 7a33224321f975d58c166657260526775d9c6b1a GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 GoogleMLKit: 85ffdc9641d05311c76dbba5bbf93059087be12f @@ -1214,7 +1219,7 @@ SPEC CHECKSUMS: path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce PhoneNumberKit: 441e8b26ec88d598e3591de9061eff18f5dd12e8 - PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72 + PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb Protobuf: b60ec2f51ad74765f44d0c09d2e0579d7de21745 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 @@ -1225,6 +1230,6 @@ SPEC CHECKSUMS: url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f -PODFILE CHECKSUM: c62121d8312d0ff0e0c4dd40334ffbc665ef58ad +PODFILE CHECKSUM: 2123a5cc771d730e237b041002bf2d3b6ae5004b COCOAPODS: 1.11.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index b881125..b5cbb9b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -13,8 +13,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 98FE50F8283B030E00F3547E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 98FE50F7283B030D00F3547E /* GoogleService-Info.plist */; }; DE7D3950774AF2253178F202 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29578401A5FB3088ABB7635B /* Pods_Runner.framework */; }; + FE1744D5ADF4D39D2F573FCB /* GoogleService-Info.plist in Sources */ = {isa = PBXBuildFile; fileRef = 0B3B84CDB01189B80ADF6D47 /* GoogleService-Info.plist */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -31,6 +31,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0B3B84CDB01189B80ADF6D47 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 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 = ""; }; 29578401A5FB3088ABB7635B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -46,7 +47,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 98FE50F7283B030D00F3547E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; A59F426903D2E7C7F7F74FB8 /* 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 = ""; }; DD7F4377AC18215A9CA08DC8 /* 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 = ""; }; /* End PBXFileReference section */ @@ -100,6 +100,7 @@ 97C146EF1CF9000F007C117D /* Products */, 4334E30C393B71F7A6E589D8 /* Pods */, 23D06BD6AD1FD965EEBFDFB4 /* Frameworks */, + 0B3B84CDB01189B80ADF6D47 /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -114,7 +115,6 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 98FE50F7283B030D00F3547E /* GoogleService-Info.plist */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -194,7 +194,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 98FE50F8283B030E00F3547E /* GoogleService-Info.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -316,6 +315,7 @@ files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + FE1744D5ADF4D39D2F573FCB /* GoogleService-Info.plist in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/Runner/.DS_Store b/ios/Runner/.DS_Store index 6ee4398e7b920f358899520c22775568ca50da26..483ddf9b3bfce9c3df39ab0de8641f2557b9c50a 100644 GIT binary patch delta 116 zcmZoMXfc=|#>B!ku~2NHo+2a1#(>?7i&&T#IX3e!O=nbeM`3&g{ zISi=`!9ZNZP{xqSkPKw$PA*_pVq;2YU|`VOJcC)BX)`+qKL^mv%^#V+Gf(ChapYiR PU|<4DGi;6!S;Gtf?6w%5 delta 68 zcmZoMXfc=|#>B)qu~2NHo+2ar#(>?7jO?3vSf(>>{>{q6w6P(AX)`+qKL=3FW - + + + - + + @@ -14,13 +16,14 @@ - + - + + diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist index a306f47..b88ab6e 100644 --- a/ios/Runner/GoogleService-Info.plist +++ b/ios/Runner/GoogleService-Info.plist @@ -3,23 +3,23 @@ CLIENT_ID - 280510379185-67vianhh973klriv75ip2tb9cf8ibitl.apps.googleusercontent.com + 675860686596-8dsd5qf42n1gej04f2m2rmt27neft8vg.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.280510379185-67vianhh973klriv75ip2tb9cf8ibitl + com.googleusercontent.apps.675860686596-8dsd5qf42n1gej04f2m2rmt27neft8vg ANDROID_CLIENT_ID - 280510379185-0shp8sia3i5m589bov645t3kuddb1032.apps.googleusercontent.com + 675860686596-in4piqob6d8nj42nguh06abpdrrhai0f.apps.googleusercontent.com API_KEY - AIzaSyCBDtZO2_Z5JjrNj1TocK6YAlk_wDbzZHs + AIzaSyDBcm0Bpx8tucyVx3Cwe48ehqcWGPWThzI GCM_SENDER_ID - 280510379185 + 675860686596 PLIST_VERSION 1 BUNDLE_ID com.tesoapp PROJECT_ID - teso-ghana + teso-test-6fc81 STORAGE_BUCKET - teso-ghana.appspot.com + teso-test-6fc81.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -31,8 +31,6 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:280510379185:ios:52af12a619d5443119de90 - DATABASE_URL - https://teso-ghana-default-rtdb.firebaseio.com + 1:675860686596:ios:41d840f75d89875ccd9251 \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 8fe164a..b3a451a 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -34,6 +34,7 @@ CFBundleURLSchemes com.googleusercontent.apps.280510379185-67vianhh973klriv75ip2tb9cf8ibitl + com.googleusercontent.apps.675860686596-8dsd5qf42n1gej04f2m2rmt27neft8vg fb1759156777594606 diff --git a/ios/Runner/ProdGoogleService-Info.plist b/ios/Runner/ProdGoogleService-Info.plist new file mode 100644 index 0000000..a306f47 --- /dev/null +++ b/ios/Runner/ProdGoogleService-Info.plist @@ -0,0 +1,38 @@ + + + + + CLIENT_ID + 280510379185-67vianhh973klriv75ip2tb9cf8ibitl.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.280510379185-67vianhh973klriv75ip2tb9cf8ibitl + ANDROID_CLIENT_ID + 280510379185-0shp8sia3i5m589bov645t3kuddb1032.apps.googleusercontent.com + API_KEY + AIzaSyCBDtZO2_Z5JjrNj1TocK6YAlk_wDbzZHs + GCM_SENDER_ID + 280510379185 + PLIST_VERSION + 1 + BUNDLE_ID + com.tesoapp + PROJECT_ID + teso-ghana + STORAGE_BUCKET + teso-ghana.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:280510379185:ios:52af12a619d5443119de90 + DATABASE_URL + https://teso-ghana-default-rtdb.firebaseio.com + + \ No newline at end of file diff --git a/ios/firebase_app_id_file.json b/ios/firebase_app_id_file.json index 65919f5..df3ad8a 100644 --- a/ios/firebase_app_id_file.json +++ b/ios/firebase_app_id_file.json @@ -1,7 +1,7 @@ { "file_generated_by": "FlutterFire CLI", "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", - "GOOGLE_APP_ID": "1:280510379185:ios:52af12a619d5443119de90", - "FIREBASE_PROJECT_ID": "teso-ghana", - "GCM_SENDER_ID": "280510379185" + "GOOGLE_APP_ID": "1:675860686596:ios:41d840f75d89875ccd9251", + "FIREBASE_PROJECT_ID": "teso-test-6fc81", + "GCM_SENDER_ID": "675860686596" } \ No newline at end of file diff --git a/lib/Classes/API Clasess/BusinessProfile.dart b/lib/Classes/API Clasess/BusinessProfile.dart index fbfef27..57524a1 100644 --- a/lib/Classes/API Clasess/BusinessProfile.dart +++ b/lib/Classes/API Clasess/BusinessProfile.dart @@ -4,10 +4,10 @@ import 'package:teso/Classes/API%20Clasess/Product.dart'; import '../TesoUser.dart'; class BusinessProfileClass { - List products; - List coupons; - List subscribers; - bool subscribed; + List? products; + List? coupons; + List? subscribers; + bool? subscribed; BusinessProfileClass({ this.coupons, diff --git a/lib/Classes/API Clasess/CampAd.dart b/lib/Classes/API Clasess/CampAd.dart index 2b23306..0988321 100644 --- a/lib/Classes/API Clasess/CampAd.dart +++ b/lib/Classes/API Clasess/CampAd.dart @@ -1,7 +1,7 @@ class CampAd { - String postId; - String campaignId; - bool approved; + String? postId; + String? campaignId; + bool? approved; CampAd({ this.approved, diff --git a/lib/Classes/API Clasess/Campaign.dart b/lib/Classes/API Clasess/Campaign.dart index 7dc5c72..cb8d753 100644 --- a/lib/Classes/API Clasess/Campaign.dart +++ b/lib/Classes/API Clasess/Campaign.dart @@ -1,12 +1,12 @@ class Campaign { - String campaignID; - String description; - String businessID; - String status; - String title; - DateTime startDate; - String targetProduct; - int rewards; + String? campaignID; + String? description; + String? businessID; + String? status; + String? title; + DateTime? startDate; + String? targetProduct; + int? rewards; Campaign({ this.businessID, diff --git a/lib/Classes/API Clasess/CommentsPost.dart b/lib/Classes/API Clasess/CommentsPost.dart index be54b3c..079c630 100644 --- a/lib/Classes/API Clasess/CommentsPost.dart +++ b/lib/Classes/API Clasess/CommentsPost.dart @@ -1,9 +1,9 @@ class CommentsPost { - String postId; - String commentId; - String comment; - String timestamp; - String commenterId; + String? postId; + String? commentId; + String? comment; + String? timestamp; + String? commenterId; CommentsPost({ this.postId, diff --git a/lib/Classes/API Clasess/CouponDetails.dart b/lib/Classes/API Clasess/CouponDetails.dart index 8bc174e..70ac5c8 100644 --- a/lib/Classes/API Clasess/CouponDetails.dart +++ b/lib/Classes/API Clasess/CouponDetails.dart @@ -2,20 +2,20 @@ import 'TesoBusinessDetail.dart'; import 'Product.dart'; class CouponDetails { - String couponId; - String businessId; - Product targetProduct; - String type; - int quantity; - DateTime expiration; - double worth; - String state; - TesoBusinessDetail issuer; - double productCost; - double lowerLimit; - double upperLimit; - String countID; - String condition; + String? couponId; + String? businessId; + Product? targetProduct; + String? type; + int? quantity; + DateTime? expiration; + double? worth; + String? state; + TesoBusinessDetail? issuer; + double? productCost; + double? lowerLimit; + double? upperLimit; + String? countID; + String? condition; CouponDetails( {this.businessId, @@ -54,7 +54,7 @@ class CouponDetails { condition: json['condition'].toString()); } catch (e) { print(e); - return null; + return CouponDetails(); } } @@ -83,7 +83,7 @@ class CouponDetails { data['businessId'] = this.businessId; data['couponId'] = this.couponId; data['target'] = this.targetProduct; - data['expiration'] = this.expiration.toIso8601String(); + data['expiration'] = this.expiration!.toIso8601String(); data['issuer'] = this.issuer; data['productCost'] = this.productCost.toString(); data['quantity'] = this.quantity; diff --git a/lib/Classes/API Clasess/CouponHead.dart b/lib/Classes/API Clasess/CouponHead.dart index e46571f..c06388a 100644 --- a/lib/Classes/API Clasess/CouponHead.dart +++ b/lib/Classes/API Clasess/CouponHead.dart @@ -1,14 +1,14 @@ class CouponsHead { - String couponId; - String businessId; - String targetProduct; - String type; - int quantity; - DateTime expiration; - double lower; - double upper; - String state; - DateTime generated; + String? couponId; + String? businessId; + String? targetProduct; + String? type; + int? quantity; + DateTime? expiration; + double? lower; + double? upper; + String? state; + DateTime? generated; CouponsHead( {this.businessId, @@ -34,13 +34,13 @@ class CouponsHead { lower = double.parse((json['lower']).toString()), upper = double.parse((json['upper']).toString()); - Map toJson() { + Map toJson() { final Map data = Map(); data['businessID'] = this.businessId; data['couponID'] = this.couponId; - data['expiration'] = this.expiration.toIso8601String(); + data['expiration'] = this.expiration!.toIso8601String(); data['generated'] = this.generated != null - ? this.generated.toIso8601String() + ? this.generated!.toIso8601String() : DateTime.now().toIso8601String(); data['quantity'] = this.quantity; data['state'] = this.state; diff --git a/lib/Classes/API Clasess/Desire.dart b/lib/Classes/API Clasess/Desire.dart index 2b3682b..d69aca8 100644 --- a/lib/Classes/API Clasess/Desire.dart +++ b/lib/Classes/API Clasess/Desire.dart @@ -1,10 +1,10 @@ class Desire { - String productName; - String productID; - String productImage; - String enlisted; - double price; - String category; + String? productName; + String? productID; + String? productImage; + String? enlisted; + double? price; + String? category; Desire( {this.productName, diff --git a/lib/Classes/API Clasess/ExploreObject.dart b/lib/Classes/API Clasess/ExploreObject.dart index c879edb..a5933f8 100644 --- a/lib/Classes/API Clasess/ExploreObject.dart +++ b/lib/Classes/API Clasess/ExploreObject.dart @@ -1,8 +1,8 @@ import 'package:teso/Classes/API%20Clasess/Product.dart'; class ExploreClass { - List trending; - List latest; + List? trending; + List? latest; ExploreClass({ this.trending, diff --git a/lib/Classes/API Clasess/FacebookUser.dart b/lib/Classes/API Clasess/FacebookUser.dart index 1f27787..0503324 100644 --- a/lib/Classes/API Clasess/FacebookUser.dart +++ b/lib/Classes/API Clasess/FacebookUser.dart @@ -1,14 +1,14 @@ class FacebookUser { - String firstname; - String surname; - String email; - String gender; - String username; - String userGUID; - String country; - String pictureUri; - String deviceToken; - String referralCode; + String? firstname; + String? surname; + String? email; + String? gender; + String? username; + String? userGUID; + String? country; + String? pictureUri; + String? deviceToken; + String? referralCode; FacebookUser( {this.firstname, diff --git a/lib/Classes/API Clasess/GoogleUser.dart b/lib/Classes/API Clasess/GoogleUser.dart index 63a653d..aea8872 100644 --- a/lib/Classes/API Clasess/GoogleUser.dart +++ b/lib/Classes/API Clasess/GoogleUser.dart @@ -1,14 +1,14 @@ class GoogleUser { - String firstname; - String surname; - String email; - String gender; - String username; - String userGUID; - String country; - String pictureUri; - String deviceToken; - String referralCode; + String? firstname; + String? surname; + String? email; + String? gender; + String? username; + String? userGUID; + String? country; + String? pictureUri; + String? deviceToken; + String? referralCode; GoogleUser({ this.firstname, diff --git a/lib/Classes/API Clasess/Post.dart b/lib/Classes/API Clasess/Post.dart index c1d4af2..e1492c1 100644 --- a/lib/Classes/API Clasess/Post.dart +++ b/lib/Classes/API Clasess/Post.dart @@ -1,12 +1,12 @@ class Post { - String postID; - DateTime timestamp; - String playbackID; - String publisherID; - String title; - String assetID; - String aspect; - String rendition; + String? postID; + DateTime? timestamp; + String? playbackID; + String? publisherID; + String? title; + String? assetID; + String? aspect; + String? rendition; Post({ this.postID, @@ -36,7 +36,7 @@ class Post { data['postId'] = this.postID; data['playbackID'] = this.playbackID; data['title'] = this.title; - data['timestamp'] = this.timestamp.toIso8601String(); + data['timestamp'] = this.timestamp!.toIso8601String(); data['assetID'] = this.assetID; data['aspect'] = this.aspect; data['rendition'] = this.rendition; diff --git a/lib/Classes/API Clasess/PostFav.dart b/lib/Classes/API Clasess/PostFav.dart index 8826ed9..3d55e1e 100644 --- a/lib/Classes/API Clasess/PostFav.dart +++ b/lib/Classes/API Clasess/PostFav.dart @@ -1,8 +1,8 @@ class PostFav { - String postId; - String admirerId; - String timestamp; - String countId; + String? postId; + String? admirerId; + String? timestamp; + String? countId; PostFav({ this.postId, diff --git a/lib/Classes/API Clasess/PostUpload.dart b/lib/Classes/API Clasess/PostUpload.dart index 67f95b6..b644d27 100644 --- a/lib/Classes/API Clasess/PostUpload.dart +++ b/lib/Classes/API Clasess/PostUpload.dart @@ -1,9 +1,9 @@ class PostUpload { - String title; - String thumbnail; - String aspect; - String campaignID; - String path; + String? title; + String? thumbnail; + String? aspect; + String? campaignID; + String? path; PostUpload({ this.title, diff --git a/lib/Classes/API Clasess/PostedAd.dart b/lib/Classes/API Clasess/PostedAd.dart index a463380..561cc75 100644 --- a/lib/Classes/API Clasess/PostedAd.dart +++ b/lib/Classes/API Clasess/PostedAd.dart @@ -5,18 +5,18 @@ import 'package:teso/Classes/API%20Clasess/PostFav.dart'; import 'package:teso/Classes/TesoUser.dart'; class PostedAd { - Post post; - List likes; - List comments; - bool campaignAd; - CampAd campAdvert; - TesoUser publisher; + Post? post; + List? likes; + List? comments; + bool? campaignAd; + CampAd? campAdvert; + TesoUser? publisher; PostedAd({ this.post, this.likes, this.comments, - List friends, + List? friends, this.campaignAd, this.campAdvert, this.publisher, diff --git a/lib/Classes/API Clasess/PostionAP.dart b/lib/Classes/API Clasess/PostionAP.dart index de6a2e7..f414056 100644 --- a/lib/Classes/API Clasess/PostionAP.dart +++ b/lib/Classes/API Clasess/PostionAP.dart @@ -1,6 +1,6 @@ class Position1 { - double latitude; - double longitude; + double? latitude; + double? longitude; Position1({ this.latitude, diff --git a/lib/Classes/API Clasess/Product.dart b/lib/Classes/API Clasess/Product.dart index aa01850..16111dd 100644 --- a/lib/Classes/API Clasess/Product.dart +++ b/lib/Classes/API Clasess/Product.dart @@ -1,11 +1,11 @@ class Product { - String productName; - String businessID; - String productDesc; - String productID; - String categoryID; - double unitPrice; - String productImage; + String? productName; + String? businessID; + String? productDesc; + String? productID; + String? categoryID; + double? unitPrice; + String? productImage; Product( {this.businessID, diff --git a/lib/Classes/API Clasess/ProximityCoupon.dart b/lib/Classes/API Clasess/ProximityCoupon.dart index be40af4..08f9d50 100644 --- a/lib/Classes/API Clasess/ProximityCoupon.dart +++ b/lib/Classes/API Clasess/ProximityCoupon.dart @@ -1,20 +1,20 @@ import 'TesoBusinessDetail.dart'; class ProximityCoupon { - String couponId; - TesoBusinessDetail business; - String targetName; - String targetID; - String targetImage; - double targetCost; - String tagretDescription; - String type; - int quantity; - DateTime expiration; - double lowerLimit; - double upperLimit; - String state; - String condition; + String? couponId; + TesoBusinessDetail? business; + String? targetName; + String? targetID; + String? targetImage; + double? targetCost; + String? tagretDescription; + String? type; + int? quantity; + DateTime? expiration; + double? lowerLimit; + double? upperLimit; + String? state; + String? condition; ProximityCoupon({ this.business, diff --git a/lib/Classes/API Clasess/ReferralClass.dart b/lib/Classes/API Clasess/ReferralClass.dart index d1750b6..113fcfd 100644 --- a/lib/Classes/API Clasess/ReferralClass.dart +++ b/lib/Classes/API Clasess/ReferralClass.dart @@ -1,7 +1,7 @@ class ReferralClass { - String referrer; - String referred; - bool reward; + String? referrer; + String? referred; + bool? reward; ReferralClass({ this.referred, diff --git a/lib/Classes/API Clasess/Registrar.dart b/lib/Classes/API Clasess/Registrar.dart index 0198e03..c698d0a 100644 --- a/lib/Classes/API Clasess/Registrar.dart +++ b/lib/Classes/API Clasess/Registrar.dart @@ -2,9 +2,9 @@ import 'package:teso/Classes/API%20Clasess/TesoUserDetail.dart'; import 'package:teso/Classes/API%20Clasess/UserAuth.dart'; class Registrar { - UserAuth authentication; - TesoUserDetail user; - String referral; + UserAuth? authentication; + TesoUserDetail? user; + String? referral; Registrar({ this.authentication, this.user, diff --git a/lib/Classes/API Clasess/ResetClass.dart b/lib/Classes/API Clasess/ResetClass.dart index bafec46..68d680e 100644 --- a/lib/Classes/API Clasess/ResetClass.dart +++ b/lib/Classes/API Clasess/ResetClass.dart @@ -1,7 +1,7 @@ class ResetClass { - String password; - String resetGuid; - String resetcode; + String? password; + String? resetGuid; + String? resetcode; ResetClass({ this.password, diff --git a/lib/Classes/API Clasess/SilverPurchaseRequest.dart b/lib/Classes/API Clasess/SilverPurchaseRequest.dart index 4bac07c..1bfeb03 100644 --- a/lib/Classes/API Clasess/SilverPurchaseRequest.dart +++ b/lib/Classes/API Clasess/SilverPurchaseRequest.dart @@ -1,7 +1,7 @@ class SilverPurchaseRequest { - int coinamount; - String method; - double amount; + int? coinamount; + String? method; + double? amount; SilverPurchaseRequest({ this.coinamount, diff --git a/lib/Classes/API Clasess/TesoBusinessDetail.dart b/lib/Classes/API Clasess/TesoBusinessDetail.dart index d8d016d..72275e0 100644 --- a/lib/Classes/API Clasess/TesoBusinessDetail.dart +++ b/lib/Classes/API Clasess/TesoBusinessDetail.dart @@ -1,17 +1,17 @@ class TesoBusinessDetail { - String businessId; - String handle; - String businessName; - String businessTin; - String businessDescription; - String businessCategory; - String businessAddress; - String businessContact; - String businessLogo; - DateTime dateOfEst; - String businessEmail; - String businessLat; - String businessLng; + String? businessId; + String? handle; + String? businessName; + String? businessTin; + String? businessDescription; + String? businessCategory; + String? businessAddress; + String? businessContact; + String? businessLogo; + DateTime? dateOfEst; + String? businessEmail; + String? businessLat; + String? businessLng; TesoBusinessDetail( {this.businessId, @@ -56,7 +56,7 @@ class TesoBusinessDetail { data['businessLogo'] = this.businessLogo; data['businessName'] = this.businessName; data['businessTin'] = this.businessTin; - data['dateOfEst'] = this.dateOfEst.toIso8601String(); + data['dateOfEst'] = this.dateOfEst!.toIso8601String(); data['handle'] = this.handle; return data; } diff --git a/lib/Classes/API Clasess/TesoUserDetail.dart b/lib/Classes/API Clasess/TesoUserDetail.dart index bb98e11..63b3080 100644 --- a/lib/Classes/API Clasess/TesoUserDetail.dart +++ b/lib/Classes/API Clasess/TesoUserDetail.dart @@ -1,18 +1,18 @@ import 'package:teso/Classes/TesoUser.dart'; class TesoUserDetail { - String userGUID; - String username; - String firstname; - String surname; - String description; - String address; - String email; - String thumbnailDp; - String phonenumber; - String country; - String gender; - DateTime dateOfBirth; + String? userGUID; + String? username; + String? firstname; + String? surname; + String? description; + String? address; + String? email; + String? thumbnailDp; + String? phonenumber; + String? country; + String? gender; + DateTime? dateOfBirth; TesoUserDetail( {this.username, @@ -65,7 +65,7 @@ class TesoUserDetail { data['description'] = this.description; data['address'] = this.address; data['phonenumber'] = this.phonenumber; - data['dateOfBirth'] = this.dateOfBirth.toIso8601String(); + data['dateOfBirth'] = this.dateOfBirth!.toIso8601String(); data['thumbnailDp'] = this.thumbnailDp; data['email'] = this.email; data['gender'] = this.gender; diff --git a/lib/Classes/API Clasess/ThirdPerson.dart b/lib/Classes/API Clasess/ThirdPerson.dart index ebe56b3..b16b23c 100644 --- a/lib/Classes/API Clasess/ThirdPerson.dart +++ b/lib/Classes/API Clasess/ThirdPerson.dart @@ -1,12 +1,14 @@ +// ignore_for_file: unnecessary_null_comparison + import 'package:teso/Classes/TesoUser.dart'; import 'Post.dart'; class ThirdPerson { - TesoUser user; - List posts = []; - List following = []; - List friends = []; - String relation; + TesoUser? user; + List? posts = []; + List? following = []; + List? friends = []; + String? relation; ThirdPerson({ this.user, @@ -22,8 +24,8 @@ class ThirdPerson { return ThirdPerson( user: json["user"] != null ? TesoUser.fromJSON(json["user"]) : null, posts: adverts != null ? adverts : [], - following: json["following"] as List, - friends: json["friends"] as List, + following: json["following"] as List?, + friends: json["friends"] as List?, relation: json["relation"], ); } diff --git a/lib/Classes/API Clasess/TokenHandler.dart b/lib/Classes/API Clasess/TokenHandler.dart index 1e511b8..ca0bbbf 100644 --- a/lib/Classes/API Clasess/TokenHandler.dart +++ b/lib/Classes/API Clasess/TokenHandler.dart @@ -1,9 +1,9 @@ import 'package:teso/Classes/TesoUser.dart'; class TokenHandler { - String tokenTeso; - String tokenFirebase; - TesoUser user; + String? tokenTeso; + String? tokenFirebase; + TesoUser? user; TokenHandler({this.tokenTeso, this.user, this.tokenFirebase}); diff --git a/lib/Classes/API Clasess/TwitterUser.dart b/lib/Classes/API Clasess/TwitterUser.dart index 9badd07..fe01574 100644 --- a/lib/Classes/API Clasess/TwitterUser.dart +++ b/lib/Classes/API Clasess/TwitterUser.dart @@ -1,14 +1,14 @@ class TwitterUser { - String firstname; - String surname; - String email; - String gender; - String username; - String userGUID; - String country; - String pictureUri; - String deviceToken; - String referralCode; + String? firstname; + String? surname; + String? email; + String? gender; + String? username; + String? userGUID; + String? country; + String? pictureUri; + String? deviceToken; + String? referralCode; TwitterUser( {this.firstname, diff --git a/lib/Classes/API Clasess/UserAuth.dart b/lib/Classes/API Clasess/UserAuth.dart index d935568..5225f0e 100644 --- a/lib/Classes/API Clasess/UserAuth.dart +++ b/lib/Classes/API Clasess/UserAuth.dart @@ -1,10 +1,10 @@ class UserAuth { - String username; - String password; - String accountType; - String status; - String deviceToken; - String referralCode; + String? username; + String? password; + String? accountType; + String? status; + String? deviceToken; + String? referralCode; UserAuth({ this.username, this.password, diff --git a/lib/Classes/API Clasess/UserFavCategory.dart b/lib/Classes/API Clasess/UserFavCategory.dart index 6a2a014..633947b 100644 --- a/lib/Classes/API Clasess/UserFavCategory.dart +++ b/lib/Classes/API Clasess/UserFavCategory.dart @@ -1,7 +1,7 @@ class UserFavCategory { - String userGuid; - String categoryCode; - String countID; + String? userGuid; + String? categoryCode; + String? countID; UserFavCategory({ this.userGuid, diff --git a/lib/Classes/API Clasess/UserFinance.dart b/lib/Classes/API Clasess/UserFinance.dart index 2feadd9..06d9761 100644 --- a/lib/Classes/API Clasess/UserFinance.dart +++ b/lib/Classes/API Clasess/UserFinance.dart @@ -1,7 +1,7 @@ class UserFinance { - String userGUID; - int gold; - int silver; + String? userGUID; + int? gold; + int? silver; UserFinance({ this.userGUID, diff --git a/lib/Classes/ChatMessage.dart b/lib/Classes/ChatMessage.dart index 9efe4fb..abf8e21 100644 --- a/lib/Classes/ChatMessage.dart +++ b/lib/Classes/ChatMessage.dart @@ -1,9 +1,9 @@ class ChatMessage { - String idFrom; - String idTo; - String content; - int type; - DateTime timestamp; + String? idFrom; + String? idTo; + String? content; + int? type; + DateTime? timestamp; ChatMessage({ this.idFrom, diff --git a/lib/Classes/ColorFilters.dart b/lib/Classes/ColorFilters.dart index 776a3f8..baf8463 100644 --- a/lib/Classes/ColorFilters.dart +++ b/lib/Classes/ColorFilters.dart @@ -1,8 +1,8 @@ import 'package:flutter/painting.dart'; class ColorFilter { - Color code; - String name; + Color? code; + String? name; ColorFilter({ this.code, this.name, diff --git a/lib/Classes/Connection.dart b/lib/Classes/Connection.dart index 44dc966..a51236a 100644 --- a/lib/Classes/Connection.dart +++ b/lib/Classes/Connection.dart @@ -31,7 +31,7 @@ class MyConnectivity { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { // 'Content-type': 'application/json', - 'Authorization': prefs.getString("tokensTeso") + 'Authorization': prefs.getString("tokensTeso")! }; var register2 = serverLocation + 'serverstatus'; var client1 = await http diff --git a/lib/Classes/Firebase/Comments.dart b/lib/Classes/Firebase/Comments.dart index 8a81d80..7badeec 100644 --- a/lib/Classes/Firebase/Comments.dart +++ b/lib/Classes/Firebase/Comments.dart @@ -1,11 +1,11 @@ class FBComments { - String postID; - DateTime timestamp; - String thumbnail; - String commenterID; - String commenter; - String commentID; - String comment; + String? postID; + DateTime? timestamp; + String? thumbnail; + String? commenterID; + String? commenter; + String? commentID; + String? comment; FBComments( {this.postID, diff --git a/lib/Classes/Firebase/Posts.dart b/lib/Classes/Firebase/Posts.dart index 6643953..08a43ff 100644 --- a/lib/Classes/Firebase/Posts.dart +++ b/lib/Classes/Firebase/Posts.dart @@ -1,15 +1,15 @@ class FBPosts { - String postID; - DateTime timestamp; - String playbackID; - String publisherID; - String title; - String assetID; - String rendition; - String aspect; - String campaignID; - int likes; - int comments; + String? postID; + DateTime? timestamp; + String? playbackID; + String? publisherID; + String? title; + String? assetID; + String? rendition; + String? aspect; + String? campaignID; + int? likes; + int? comments; FBPosts( {this.postID, diff --git a/lib/Classes/NotificationSpliter.dart b/lib/Classes/NotificationSpliter.dart index 880f700..75e1977 100644 --- a/lib/Classes/NotificationSpliter.dart +++ b/lib/Classes/NotificationSpliter.dart @@ -14,38 +14,31 @@ class NotificationSplitter { payload.load2 = data["firstname"]; payload.load3 = data["surname"]; return payload; - break; case "likes": payload.loadID = "TESN000"; payload.load1 = data["post"]; return payload; - break; case "comments": payload.loadID = "TESN000"; payload.load1 = data["post"]; return payload; - break; case "friendapproval": Provider.of(context, listen: false).loadFriends(); payload.loadID = "TESN000"; return payload; - break; case "friendrequest": payload.loadID = "TESN000"; return payload; - break; case "gifted": Provider.of(context, listen: false).getCoupons(); payload.loadID = "TESN000"; payload.load1 = data["couponID"]; return payload; - break; case "cancellation": Provider.of(context, listen: false).getCoupons(); payload.loadID = "TESN000"; payload.load1 = data["couponID"]; return payload; - break; case "personalized": payload.loadID = "TESN000"; payload.load1 = data["coupon"]; @@ -56,7 +49,6 @@ class NotificationSplitter { payload.load6 = data["originalPrice"]; payload.load7 = data["productName"]; return payload; - break; case "campaign": var coup = jsonDecode(data["campaign"]); payload.loadID = "TESN005"; @@ -69,33 +61,27 @@ class NotificationSplitter { payload.load7 = coup["goldReward"].toString(); payload.load8 = coup["startDate"].toString(); return payload; - break; case "reward": payload.loadID = "TESN0R0"; return payload; - break; case "expired": Provider.of(context, listen: false).getCoupons(); payload.loadID = "TESN000"; payload.load1 = data["couponID"]; return payload; - break; case "refund": Provider.of(context, listen: false).getUserInformation(); payload.loadID = "TESN000"; payload.load1 = data["couponID"]; return payload; - break; case "coinpurchase": Provider.of(context, listen: false).getUserInformation(); payload.loadID = "TESN000"; payload.load1 = data["orderID"]; await closeInAppWebView(); return payload; - break; default: return payload; - break; } } } diff --git a/lib/Classes/Payload.dart b/lib/Classes/Payload.dart index e3e2b60..a340a6d 100644 --- a/lib/Classes/Payload.dart +++ b/lib/Classes/Payload.dart @@ -1,15 +1,15 @@ class Payload { - String loadID; - String load1; - String load2; - String load3; - String load4; - String load5; - String load6; - String load7; - String load8; - String load9; - String load10; + String? loadID; + String? load1; + String? load2; + String? load3; + String? load4; + String? load5; + String? load6; + String? load7; + String? load8; + String? load9; + String? load10; Payload({ this.load1, diff --git a/lib/Classes/Product.dart b/lib/Classes/Product.dart index 4163880..2a9ebbe 100644 --- a/lib/Classes/Product.dart +++ b/lib/Classes/Product.dart @@ -1,12 +1,12 @@ class Product { - String itemID; - String name; - String shopName; - String shopLocation; - String country; - String duration; - String adShort; - String adFull; + String? itemID; + String? name; + String? shopName; + String? shopLocation; + String? country; + String? duration; + String? adShort; + String? adFull; Product( {this.itemID, diff --git a/lib/Classes/QRClass.dart b/lib/Classes/QRClass.dart index d2ab12c..09b7f69 100644 --- a/lib/Classes/QRClass.dart +++ b/lib/Classes/QRClass.dart @@ -1,7 +1,7 @@ class QRClass { - String code; - String type; - List rawBytes; + String? code; + String? type; + List? rawBytes; QRClass({ this.code, diff --git a/lib/Classes/ReportedContent.dart b/lib/Classes/ReportedContent.dart index 4ba572c..e5f5a38 100644 --- a/lib/Classes/ReportedContent.dart +++ b/lib/Classes/ReportedContent.dart @@ -1,11 +1,11 @@ import 'dart:core'; class ReportedContent { - String userGuid; - String postID; - String publisherID; - DateTime timestamp; - int report; + String? userGuid; + String? postID; + String? publisherID; + DateTime? timestamp; + int? report; ReportedContent( {this.postID, diff --git a/lib/Classes/TesoShop.dart b/lib/Classes/TesoShop.dart index 0135843..76851bb 100644 --- a/lib/Classes/TesoShop.dart +++ b/lib/Classes/TesoShop.dart @@ -1,17 +1,17 @@ class TesoShop { - String shopID; - String shopName; - String shopTin; - String shopAddress; - double latitude; - double longitude; - String shopPhone; - DateTime dateEst; - String handle; - String categoryShop; - String shopDescription; - String logo; - String email; + String? shopID; + String? shopName; + String? shopTin; + String? shopAddress; + double? latitude; + double? longitude; + String? shopPhone; + DateTime? dateEst; + String? handle; + String? categoryShop; + String? shopDescription; + String? logo; + String? email; TesoShop( {this.shopID, diff --git a/lib/Classes/TesoUser.dart b/lib/Classes/TesoUser.dart index 30ce1c4..19cb63a 100644 --- a/lib/Classes/TesoUser.dart +++ b/lib/Classes/TesoUser.dart @@ -1,23 +1,23 @@ import 'API Clasess/TesoUserDetail.dart'; class TesoUser { - String userGUID; - String username; - String firstname; - String lastname; - String description; - String email; - String phonenumber; - String address; - String displaypicture; - DateTime dateOfBirth; + String? userGUID; + String? username; + String? firstname; + String? lastname; + String? description; + String? email; + String? phonenumber; + String? address; + String? displaypicture; + DateTime? dateOfBirth; // ignore: non_constant_identifier_names - String thumbnail_dp; - String gold; - String silver; - String friends; - String gender; - String country; + String? thumbnail_dp; + String? gold; + String? silver; + String? friends; + String? gender; + String? country; TesoUser( {this.userGUID, @@ -66,7 +66,7 @@ class TesoUser { data['lastname'] = this.lastname; data['description'] = this.description; data['address'] = this.address; - data["dateOfBirth"] = this.dateOfBirth.toIso8601String(); + data["dateOfBirth"] = this.dateOfBirth!.toIso8601String(); data['phonenumber'] = this.phonenumber; data['thumbnail_dp'] = this.thumbnail_dp; data['email'] = this.email; diff --git a/lib/Classes/TextE.dart b/lib/Classes/TextE.dart index a3ec81f..5108d87 100644 --- a/lib/Classes/TextE.dart +++ b/lib/Classes/TextE.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; class Textted { - String text; - TextStyle textStyle; - TextAlign textAlign; + String? text; + TextStyle? textStyle; + TextAlign? textAlign; Textted({ this.text, diff --git a/lib/Classes/categories.dart b/lib/Classes/categories.dart index cb2bf2e..c1541ff 100644 --- a/lib/Classes/categories.dart +++ b/lib/Classes/categories.dart @@ -1,7 +1,7 @@ class Category { - String id; - String name; - String image; + String? id; + String? name; + String? image; Category({this.id, this.name, this.image}); Category.fromJson(Map json) : id = json['catid'], diff --git a/lib/Classes/customLoginButton.dart b/lib/Classes/customLoginButton.dart index 912f277..41763b4 100644 --- a/lib/Classes/customLoginButton.dart +++ b/lib/Classes/customLoginButton.dart @@ -4,13 +4,13 @@ class CustomLoginButton extends StatelessWidget { final Widget child; final double width; final double height; - final Function onPressed; - final String icon; - final Color color; + final Function? onPressed; + final String? icon; + final Color? color; const CustomLoginButton({ - Key key, - @required this.child, + Key? key, + required this.child, this.width = double.infinity, this.height = 50.0, this.onPressed, @@ -67,12 +67,12 @@ class CustomLoginButton extends StatelessWidget { ), ), child: InkWell( - onTap: onPressed, + onTap: onPressed as void Function()?, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Image( - image: AssetImage(icon), + image: AssetImage(icon!), height: 20, ), child diff --git a/lib/Classes/customTesoButton.dart b/lib/Classes/customTesoButton.dart index 5f2c3da..fb7e050 100644 --- a/lib/Classes/customTesoButton.dart +++ b/lib/Classes/customTesoButton.dart @@ -2,14 +2,14 @@ import 'package:flutter/material.dart'; class RaisedGradientButton extends StatelessWidget { final Widget child; - final Gradient gradient; + final Gradient? gradient; final double width; final double height; - final Function onPressed; + final Function? onPressed; const RaisedGradientButton({ - Key key, - @required this.child, + Key? key, + required this.child, this.gradient, this.width = double.infinity, this.height = 50.0, @@ -30,7 +30,7 @@ class RaisedGradientButton extends StatelessWidget { height: 40.0, decoration: BoxDecoration(gradient: gradient, boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), @@ -43,7 +43,7 @@ class RaisedGradientButton extends StatelessWidget { ), color: Colors.transparent, child: InkWell( - onTap: onPressed, + onTap: onPressed as void Function()?, child: Center( child: child, )), diff --git a/lib/Classes/friend.dart b/lib/Classes/friend.dart index d88b00f..1855bd4 100644 --- a/lib/Classes/friend.dart +++ b/lib/Classes/friend.dart @@ -1,13 +1,13 @@ class Friend { - String userID; - String firstname; - String surname; - String dateOfBirth; - String thumbnail; - String description; - String posts; - String following; - String friendsNum; + String? userID; + String? firstname; + String? surname; + String? dateOfBirth; + String? thumbnail; + String? description; + String? posts; + String? following; + String? friendsNum; Friend( {this.userID, diff --git a/lib/Classes/inbox.dart b/lib/Classes/inbox.dart index ac54a87..71b2123 100644 --- a/lib/Classes/inbox.dart +++ b/lib/Classes/inbox.dart @@ -1,13 +1,13 @@ class InboxMessage { - String userID; - String firstname; - String surname; - String messageID; - String message; - String thumbnail; - String bio; - DateTime timestamp; - int unread; + String? userID; + String? firstname; + String? surname; + String? messageID; + String? message; + String? thumbnail; + String? bio; + DateTime? timestamp; + int? unread; InboxMessage( {this.userID, diff --git a/lib/Notifications/NotificationPlugin.dart b/lib/Notifications/NotificationPlugin.dart index 4d6119d..ef2c8a2 100644 --- a/lib/Notifications/NotificationPlugin.dart +++ b/lib/Notifications/NotificationPlugin.dart @@ -8,11 +8,11 @@ import 'package:rxdart/subjects.dart'; class NotificationPlugin { // - FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; + late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; final BehaviorSubject didReceivedLocalNotificationSubject = BehaviorSubject(); - var initializationSettings; + late var initializationSettings; NotificationPlugin._() { init(); @@ -48,7 +48,7 @@ class NotificationPlugin { _requestIOSPermission() { flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< - IOSFlutterLocalNotificationsPlugin>() + IOSFlutterLocalNotificationsPlugin>()! .requestPermissions( alert: true, badge: true, @@ -64,13 +64,13 @@ class NotificationPlugin { setOnNotificationClick(Function onNotificationClick) async { await flutterLocalNotificationsPlugin.initialize(initializationSettings, - onSelectNotification: (String payload) async { + onSelectNotification: (String? payload) async { onNotificationClick(payload); }); } Future showNotification( - String title, String body, String payload) async { + String? title, String? body, String payload) async { var androidChannelSpecifics = AndroidNotificationDetails( 'CHANNEL_ID', 'CHANNEL_NAME', @@ -258,14 +258,14 @@ NotificationPlugin notificationPlugin = NotificationPlugin._(); class ReceivedNotification { final int id; - final String title; - final String body; - final String payload; + final String? title; + final String? body; + final String? payload; ReceivedNotification({ - @required this.id, - @required this.title, - @required this.body, - @required this.payload, + required this.id, + required this.title, + required this.body, + required this.payload, }); } diff --git a/lib/Pages/BusinessLocator.dart b/lib/Pages/BusinessLocator.dart index 1710190..c195ef0 100644 --- a/lib/Pages/BusinessLocator.dart +++ b/lib/Pages/BusinessLocator.dart @@ -23,27 +23,27 @@ class BusinessLocator extends StatefulWidget { } class _BusinessLocatorState extends State { - String mapstyle; + String? mapstyle; var _future; - static LatLng _initialPosition; + static LatLng? _initialPosition; Set markers = {}; - List shops; - GoogleMapController mapController; + List? shops; + GoogleMapController? mapController; static const double CAMERA_ZOOM = 13.499910354614258; bool routing = false; List polylineCoordinates = []; Map polylines = {}; - String selectedshop = ""; + String? selectedshop = ""; Location location = Location(); String routingMessage = "Finding shops...."; - LocationData _location; - String _error; - String _placeDistance; + late LocationData _location; + String? _error; + String? _placeDistance; final startAddressController = TextEditingController(); final destinationAddressController = TextEditingController(); bool ios = false; - Future _determinePosition(context) async { + Future _determinePosition(context) async { setState(() { _error = null; }); @@ -51,7 +51,7 @@ class _BusinessLocatorState extends State { final LocationData _locationResult = await location.getLocation(); setState(() { _location = _locationResult; - _initialPosition = LatLng(_location.latitude, _location.longitude); + _initialPosition = LatLng(_location.latitude!, _location.longitude!); }); await getLocations(); @@ -68,7 +68,7 @@ class _BusinessLocatorState extends State { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'tesobusiness/available'; @@ -84,12 +84,12 @@ class _BusinessLocatorState extends State { } } - if (shops.length > 0 && shops != null) - shops.forEach((element) { - MarkerId markerId = MarkerId(element.shopID); + if (shops!.length > 0 && shops != null) + shops!.forEach((element) { + MarkerId markerId = MarkerId(element.shopID!); Marker marker = Marker( markerId: markerId, - position: LatLng(element.latitude, element.longitude), + position: LatLng(element.latitude!, element.longitude!), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan), infoWindow: InfoWindow( title: element.shopName, @@ -118,7 +118,7 @@ class _BusinessLocatorState extends State { super.initState(); ios = Platform.isIOS; SharedPreferences.getInstance().then((prefs) { - String currentTheme = prefs.getString("theme"); + String? currentTheme = prefs.getString("theme"); if (currentTheme == "light") { rootBundle.loadString('assets/styles/light.txt').then((string) { mapstyle = string; @@ -132,7 +132,7 @@ class _BusinessLocatorState extends State { _future = _determinePosition(context); location.onLocationChanged.listen((LocationData cLoc) { - _initialPosition = LatLng(cLoc.latitude, cLoc.longitude); + _initialPosition = LatLng(cLoc.latitude!, cLoc.longitude!); }); } @@ -140,10 +140,10 @@ class _BusinessLocatorState extends State { Position _northeastCoordinates; Position _southwestCoordinates; - MarkerId markerId = MarkerId(tesoShop.shopName + " Location"); + MarkerId markerId = MarkerId(tesoShop.shopName! + " Location"); Marker marker = Marker( markerId: markerId, - position: LatLng(tesoShop.latitude, tesoShop.longitude), + position: LatLng(tesoShop.latitude!, tesoShop.longitude!), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen), infoWindow: InfoWindow( title: tesoShop.shopName, @@ -155,12 +155,12 @@ class _BusinessLocatorState extends State { markers.clear(); markers.add(marker); selectedshop = tesoShop.shopName; - destinationAddressController.text = selectedshop; + destinationAddressController.text = selectedshop!; }); Position user = Position( - latitude: _initialPosition.latitude, - longitude: _initialPosition.longitude, + latitude: _initialPosition!.latitude, + longitude: _initialPosition!.longitude, accuracy: 100, altitude: 100, heading: 100, @@ -168,8 +168,8 @@ class _BusinessLocatorState extends State { speedAccuracy: 100, timestamp: DateTime.now()); Position shopLoc = Position( - latitude: tesoShop.latitude, - longitude: tesoShop.longitude, + latitude: tesoShop.latitude!, + longitude: tesoShop.longitude!, accuracy: 100, altitude: 100, heading: 100, @@ -177,7 +177,7 @@ class _BusinessLocatorState extends State { speedAccuracy: 100, timestamp: DateTime.now()); - if (_initialPosition.latitude <= tesoShop.latitude) { + if (_initialPosition!.latitude <= tesoShop.latitude!) { _southwestCoordinates = user; _northeastCoordinates = shopLoc; } else { @@ -187,7 +187,7 @@ class _BusinessLocatorState extends State { await createPolylines(user, shopLoc); _calculateDistance(user, shopLoc); - mapController.animateCamera( + mapController!.animateCamera( CameraUpdate.newLatLngBounds( LatLngBounds( northeast: LatLng( @@ -248,7 +248,7 @@ class _BusinessLocatorState extends State { @override void dispose() { - if (mapController != null) mapController.dispose(); + if (mapController != null) mapController!.dispose(); super.dispose(); } @@ -329,7 +329,7 @@ class _BusinessLocatorState extends State { myLocationEnabled: true, markers: markers, initialCameraPosition: CameraPosition( - target: _initialPosition, + target: _initialPosition!, zoom: CAMERA_ZOOM, //bearing: CAMERA_BEARING, ), @@ -377,7 +377,7 @@ class _BusinessLocatorState extends State { ), ), Visibility( - visible: selectedshop == null || selectedshop.isEmpty + visible: selectedshop == null || selectedshop!.isEmpty ? false : true, child: Align( @@ -489,7 +489,7 @@ class _BusinessLocatorState extends State { double _coordinateDistance(lat1, lon1, lat2, lon2) { var p = 0.017453292519943295; - var c = cos; + var c = cos as double Function(num?); var a = 0.5 - c((lat2 - lat1) * p) / 2 + c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p)) / 2; @@ -522,7 +522,7 @@ class _BusinessLocatorState extends State { // Accommodate the two locations within the // camera view of the map - mapController.animateCamera( + mapController!.animateCamera( CameraUpdate.newLatLngBounds( LatLngBounds( northeast: LatLng(northEastLatitude, northEastLongitude), @@ -569,13 +569,13 @@ class _BusinessLocatorState extends State { } Widget _textField({ - TextEditingController controller, - FocusNode focusNode, - String label, - String hint, - double width, - Icon prefixIcon, - Widget suffixIcon, + TextEditingController? controller, + FocusNode? focusNode, + String? label, + String? hint, + required double width, + Icon? prefixIcon, + Widget? suffixIcon, }) { return Container( width: width * 0.8, diff --git a/lib/Pages/DesireComeTrue.dart b/lib/Pages/DesireComeTrue.dart index a57b935..e6dbd6d 100644 --- a/lib/Pages/DesireComeTrue.dart +++ b/lib/Pages/DesireComeTrue.dart @@ -17,8 +17,8 @@ class DesireComeTrue extends StatefulWidget { class _DesireComeTrueState extends State with TickerProviderStateMixin { - AnimationController _controller; - Animation _fabScale; + late AnimationController _controller; + late Animation _fabScale; List desires = []; @override @@ -35,9 +35,9 @@ class _DesireComeTrueState extends State }); SharedPreferences.getInstance().then((value) { var jiffy = Jiffy()..add(months: 1); - if (value.getString("desire" + jiffy.format("MMMM, yyyy")).isNotEmpty) { + if (value.getString("desire" + jiffy.format("MMMM, yyyy"))!.isNotEmpty) { var desired = - jsonDecode(value.getString("desire" + jiffy.format("MMMM, yyyy"))); + jsonDecode(value.getString("desire" + jiffy.format("MMMM, yyyy"))!); setState(() { desires = List.from( desired.map((model) => Desire.fromJSON(model)).toList()); @@ -53,7 +53,7 @@ class _DesireComeTrueState extends State SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'monthly-desires/submit-newdesire'; diff --git a/lib/Pages/LandingPage.dart b/lib/Pages/LandingPage.dart index 9a59be8..9083997 100644 --- a/lib/Pages/LandingPage.dart +++ b/lib/Pages/LandingPage.dart @@ -14,9 +14,9 @@ import 'package:teso/util/consts.dart'; import 'PageWidgets/Settings/terms.dart'; class LandingPage extends StatefulWidget { - final List connectedCameras; + final List? connectedCameras; - const LandingPage({Key key, this.connectedCameras}) : super(key: key); + const LandingPage({Key? key, this.connectedCameras}) : super(key: key); @override _LandingPageState createState() => _LandingPageState(); } diff --git a/lib/Pages/PageWidgets/Alerts/AlertTile.dart b/lib/Pages/PageWidgets/Alerts/AlertTile.dart index 44c04a0..0a64379 100644 --- a/lib/Pages/PageWidgets/Alerts/AlertTile.dart +++ b/lib/Pages/PageWidgets/Alerts/AlertTile.dart @@ -4,12 +4,12 @@ import 'package:teso/util/consts.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildAlert( - {BuildContext context, - DateTime timestamp, - String description, - Icon icons, - String thumbnail, - String username}) { + {required BuildContext context, + required DateTime timestamp, + required String description, + Icon? icons, + String? thumbnail, + String? username}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 25.0), child: Material( @@ -85,7 +85,7 @@ buildAlert( color: Color.fromRGBO(0, 0, 0, 0.4), child: Center( child: Text( - username.characters + username!.characters .characterAt(0) .toString() .toUpperCase(), diff --git a/lib/Pages/PageWidgets/Alerts/Redeemable.dart b/lib/Pages/PageWidgets/Alerts/Redeemable.dart index 18f790d..f178eb8 100644 --- a/lib/Pages/PageWidgets/Alerts/Redeemable.dart +++ b/lib/Pages/PageWidgets/Alerts/Redeemable.dart @@ -6,11 +6,11 @@ import 'package:teso/util/consts.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildRedeemableAlert( - {BuildContext context, - DateTime timestamp, - Icon icons, - String thumbnail, - String message}) { + {required BuildContext context, + required DateTime timestamp, + Icon? icons, + required String thumbnail, + required String message}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 30.0), child: Material( diff --git a/lib/Pages/PageWidgets/Alerts/Refund.dart b/lib/Pages/PageWidgets/Alerts/Refund.dart index c7b8a6b..fd63057 100644 --- a/lib/Pages/PageWidgets/Alerts/Refund.dart +++ b/lib/Pages/PageWidgets/Alerts/Refund.dart @@ -5,7 +5,7 @@ import 'package:teso/util/consts.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildRefundAlert( - {BuildContext context, DateTime timestamp, Icon icons, String message}) { + {required BuildContext context, required DateTime timestamp, Icon? icons, required String message}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 30.0), child: Material( diff --git a/lib/Pages/PageWidgets/Alerts/header.dart b/lib/Pages/PageWidgets/Alerts/header.dart index a3dd9b4..65b5103 100644 --- a/lib/Pages/PageWidgets/Alerts/header.dart +++ b/lib/Pages/PageWidgets/Alerts/header.dart @@ -7,10 +7,10 @@ import 'package:flutter/material.dart'; buildNotficationHeader( BuildContext context, - Color fcurrentColor, - Color fcurrentColor1, + Color? fcurrentColor, + Color? fcurrentColor1, Color fTextColor1, - Color fTextColor2, + Color? fTextColor2, Function navigationTapped, bool status, TesoUser user) { @@ -40,14 +40,14 @@ buildNotficationHeader( child: user.thumbnail_dp == null ? Center( child: Text( - user.username.characters + user.username!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( - imageUrl: userdpURL + user.thumbnail_dp, + imageUrl: userdpURL + user.thumbnail_dp!, imageBuilder: (context, imageProvider) => FadeInImage( height: 90, width: 90, diff --git a/lib/Pages/PageWidgets/Alerts/personalizedCoupon.dart b/lib/Pages/PageWidgets/Alerts/personalizedCoupon.dart index fa31241..948d64a 100644 --- a/lib/Pages/PageWidgets/Alerts/personalizedCoupon.dart +++ b/lib/Pages/PageWidgets/Alerts/personalizedCoupon.dart @@ -6,13 +6,13 @@ import 'package:teso/util/consts.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildPersonalizedAlert( - {BuildContext context, - DateTime timestamp, - Icon icons, - String thumbnail, - String message, - Function accept, - Function decline}) { + {required BuildContext context, + required DateTime timestamp, + Icon? icons, + required String thumbnail, + required String message, + Function? accept, + Function? decline}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 30.0), child: Material( diff --git a/lib/Pages/PageWidgets/Alerts/post.dart b/lib/Pages/PageWidgets/Alerts/post.dart index 32c65a9..f796454 100644 --- a/lib/Pages/PageWidgets/Alerts/post.dart +++ b/lib/Pages/PageWidgets/Alerts/post.dart @@ -4,11 +4,11 @@ import 'package:teso/util/consts.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildPostAlert( - {BuildContext context, - DateTime timestamp, - Icon icons, - String thumbnail, - String message}) { + {required BuildContext context, + required DateTime timestamp, + Icon? icons, + String? thumbnail, + required String message}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 30.0), child: Material( diff --git a/lib/Pages/PageWidgets/Alerts/requestTile.dart b/lib/Pages/PageWidgets/Alerts/requestTile.dart index e94ba22..844391b 100644 --- a/lib/Pages/PageWidgets/Alerts/requestTile.dart +++ b/lib/Pages/PageWidgets/Alerts/requestTile.dart @@ -5,14 +5,14 @@ import 'package:teso/util/consts.dart'; import 'package:teso/Classes/customTesoButton.dart'; buildRequest( - {BuildContext context, - DateTime timestamp, - String description, - Icon icons, - String thumbnail, - String username, - Function approve, - Function decline}) { + {required BuildContext context, + required DateTime timestamp, + required String description, + Icon? icons, + String? thumbnail, + String? username, + Function? approve, + Function? decline}) { return Padding( padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 8.0), child: Material( @@ -159,7 +159,7 @@ buildRequest( color: Color.fromRGBO(0, 0, 0, 0.4), child: Center( child: Text( - username.characters + username!.characters .characterAt(0) .toString() .toUpperCase(), diff --git a/lib/Pages/PageWidgets/BusinessProfile/BusinessHead.dart b/lib/Pages/PageWidgets/BusinessProfile/BusinessHead.dart index 2b9ab89..39f2a76 100644 --- a/lib/Pages/PageWidgets/BusinessProfile/BusinessHead.dart +++ b/lib/Pages/PageWidgets/BusinessProfile/BusinessHead.dart @@ -5,11 +5,11 @@ import 'package:flutter/material.dart'; import 'package:teso/Classes/TesoShop.dart'; buildHead( - {BuildContext context, - TesoShop shopSelected, - int products, - int subscribers, - int coupons}) { + {required BuildContext context, + required TesoShop shopSelected, + required int products, + required int subscribers, + required int coupons}) { return Container( // height: MediaQuery.of(context).size.width - // (MediaQuery.of(context).size.width * 0.40), @@ -46,7 +46,7 @@ buildHead( ), child: shopSelected.logo != "null" ? CachedNetworkImage( - imageUrl: businessLogoURL + shopSelected.logo, + imageUrl: businessLogoURL + shopSelected.logo!, imageBuilder: (context, imageProvider) => FadeInImage( height: 90, @@ -133,7 +133,7 @@ buildHead( left: MediaQuery.of(context).size.width * 0.09, ), child: Text( - shopSelected.shopAddress, + shopSelected.shopAddress!, style: TextStyle( fontWeight: FontWeight.w400, //color: Colors.grey, @@ -147,7 +147,7 @@ buildHead( left: MediaQuery.of(context).size.width * 0.09, ), child: Text( - shopSelected.categoryShop, + shopSelected.categoryShop!, textAlign: TextAlign.left, style: TextStyle( fontSize: 12, @@ -163,8 +163,8 @@ buildHead( left: MediaQuery.of(context).size.width * 0.09, ), child: Text( - shopSelected.shopDescription.toLowerCase() != "null" - ? shopSelected.shopDescription + shopSelected.shopDescription!.toLowerCase() != "null" + ? shopSelected.shopDescription! : "", style: TextStyle( fontSize: 13, diff --git a/lib/Pages/PageWidgets/BusinessProfile/BusinessItems.dart b/lib/Pages/PageWidgets/BusinessProfile/BusinessItems.dart index 5372b7a..c87724d 100644 --- a/lib/Pages/PageWidgets/BusinessProfile/BusinessItems.dart +++ b/lib/Pages/PageWidgets/BusinessProfile/BusinessItems.dart @@ -14,7 +14,7 @@ buildItems(BuildContext context, Product product, double height) { // borderRadius: BorderRadius.circular(30.0), // ), child: Hero( - tag: product.productID, + tag: product.productID!, child: GestureDetector( onTap: () => Navigator.push( context, @@ -34,7 +34,7 @@ buildItems(BuildContext context, Product product, double height) { width: double.infinity, height: double.infinity, fit: BoxFit.fill, - image: NetworkImage(productURL + product.productImage), + image: NetworkImage(productURL + product.productImage!), placeholder: AssetImage("assets/images/loading.png"), ), Container( @@ -49,7 +49,7 @@ buildItems(BuildContext context, Product product, double height) { width: double.infinity, margin: EdgeInsets.only(bottom: 40), child: Text( - product.productName.toUpperCase(), + product.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, diff --git a/lib/Pages/PageWidgets/ChatScreen/header.dart b/lib/Pages/PageWidgets/ChatScreen/header.dart index 903e6bc..efb7f87 100644 --- a/lib/Pages/PageWidgets/ChatScreen/header.dart +++ b/lib/Pages/PageWidgets/ChatScreen/header.dart @@ -53,14 +53,14 @@ buildChatHead(BuildContext context, TesoUser user) { child: user.thumbnail_dp == null ? Center( child: Text( - user.firstname.characters + user.firstname!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( - imageUrl: userdpURL + user.thumbnail_dp, + imageUrl: userdpURL + user.thumbnail_dp!, imageBuilder: (context, imageProvider) => FadeInImage( height: 90, width: 90, @@ -86,7 +86,7 @@ buildChatHead(BuildContext context, TesoUser user) { direction: Axis.vertical, children: [ Text( - user.firstname + " " + user.lastname, + user.firstname! + " " + user.lastname!, style: TextStyle(fontSize: 15), textAlign: TextAlign.left, ), diff --git a/lib/Pages/PageWidgets/ChatScreen/recipient.dart b/lib/Pages/PageWidgets/ChatScreen/recipient.dart index b14315b..d8d919e 100644 --- a/lib/Pages/PageWidgets/ChatScreen/recipient.dart +++ b/lib/Pages/PageWidgets/ChatScreen/recipient.dart @@ -25,12 +25,12 @@ buildRecipient(BuildContext context, ChatMessage message) { spacing: 10.0, direction: Axis.horizontal, children: [ - Text(message.content), + Text(message.content!), Container( child: Align( alignment: Alignment.bottomRight, child: Text( - TimeElapsed.fromDateTime(message.timestamp), + TimeElapsed.fromDateTime(message.timestamp!), textAlign: TextAlign.right, style: TextStyle( fontSize: 10, diff --git a/lib/Pages/PageWidgets/ChatScreen/sender.dart b/lib/Pages/PageWidgets/ChatScreen/sender.dart index f46a26d..6fc78e9 100644 --- a/lib/Pages/PageWidgets/ChatScreen/sender.dart +++ b/lib/Pages/PageWidgets/ChatScreen/sender.dart @@ -25,12 +25,12 @@ buildSender(BuildContext context, ChatMessage document) { spacing: 10.0, direction: Axis.horizontal, children: [ - Text(document.content), + Text(document.content!), Container( child: Align( alignment: Alignment.bottomRight, child: Text( - TimeElapsed.fromDateTime(document.timestamp), + TimeElapsed.fromDateTime(document.timestamp!), textAlign: TextAlign.right, style: TextStyle( fontSize: 10, diff --git a/lib/Pages/PageWidgets/CoinPurchase/AmountInput.dart b/lib/Pages/PageWidgets/CoinPurchase/AmountInput.dart index c623b15..afacf9b 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/AmountInput.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/AmountInput.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:teso/util/consts.dart'; -buildAmount(BuildContext context, TextEditingController user) { +buildAmount(BuildContext context, TextEditingController? user) { return Container( width: double.infinity, height: 45, diff --git a/lib/Pages/PageWidgets/CoinPurchase/MomoType.dart b/lib/Pages/PageWidgets/CoinPurchase/MomoType.dart index fe26dcd..7525eb4 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/MomoType.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/MomoType.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:teso/util/consts.dart'; -buildType(BuildContext context, String image, String type, Function selected, - String tapped) { +buildType(BuildContext context, String image, String? type, Function selected, + String? tapped) { return Container( margin: EdgeInsets.all(5), width: 100, diff --git a/lib/Pages/PageWidgets/CoinPurchase/PayGold.dart b/lib/Pages/PageWidgets/CoinPurchase/PayGold.dart index 0baf728..b8239c8 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/PayGold.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/PayGold.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; payWithGold( - BuildContext context, String type, Function selected, String tapped) { + BuildContext context, String type, Function selected, String? tapped) { return Container( margin: EdgeInsets.all(5), width: 90, diff --git a/lib/Pages/PageWidgets/CoinPurchase/SilverAmountInput.dart b/lib/Pages/PageWidgets/CoinPurchase/SilverAmountInput.dart index 68731a4..9c84ad7 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/SilverAmountInput.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/SilverAmountInput.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:teso/util/consts.dart'; -buildAmount(BuildContext context, TextEditingController user) { +buildAmount(BuildContext context, TextEditingController? user) { return Container( width: 100, height: 65, diff --git a/lib/Pages/PageWidgets/CoinPurchase/SilverPurchase.dart b/lib/Pages/PageWidgets/CoinPurchase/SilverPurchase.dart index 1afcb45..3f0d395 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/SilverPurchase.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/SilverPurchase.dart @@ -4,11 +4,11 @@ import 'package:flutter/material.dart'; import 'package:teso/Pages/Sub_Pages/CoinsPurchase/SilverPurchaseFixed.dart'; buildSilverCard({ - BuildContext context, - String goldEquivalent, - String cashEquivalent, - String funds, - TesoUser user, + required BuildContext context, + required String goldEquivalent, + required String cashEquivalent, + required String funds, + TesoUser? user, }) { return Container( margin: EdgeInsets.all(10), diff --git a/lib/Pages/PageWidgets/CoinPurchase/phonenumber.dart b/lib/Pages/PageWidgets/CoinPurchase/phonenumber.dart index 3548def..247e6df 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/phonenumber.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/phonenumber.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:teso/util/consts.dart'; -inputTelNumber(BuildContext context, TextEditingController user) { +inputTelNumber(BuildContext context, TextEditingController? user) { return Container( width: double.infinity, height: 45, diff --git a/lib/Pages/PageWidgets/CoinPurchase/selector.dart b/lib/Pages/PageWidgets/CoinPurchase/selector.dart index cfbe216..6a28d32 100644 --- a/lib/Pages/PageWidgets/CoinPurchase/selector.dart +++ b/lib/Pages/PageWidgets/CoinPurchase/selector.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; buildSelector(BuildContext context, String title, double size, List color, Function tapped, Color textColor) { return InkWell( - onTap: tapped, + onTap: tapped as void Function()?, child: Container( width: size - size * 0.55, height: 42.5, diff --git a/lib/Pages/PageWidgets/Coupons/GiftFriend.dart b/lib/Pages/PageWidgets/Coupons/GiftFriend.dart index 01da598..9791c42 100644 --- a/lib/Pages/PageWidgets/Coupons/GiftFriend.dart +++ b/lib/Pages/PageWidgets/Coupons/GiftFriend.dart @@ -3,10 +3,10 @@ import 'package:teso/util/consts.dart'; import 'package:teso/Classes/TesoUser.dart'; buildGiftRecipient( - {BuildContext context, - TextEditingController searchkey, - TesoUser friend, - Function loadFriend}) { + {required BuildContext context, + TextEditingController? searchkey, + TesoUser? friend, + Function? loadFriend}) { return Container( height: 60.0, padding: EdgeInsets.all(10.0), @@ -35,7 +35,7 @@ buildGiftRecipient( : friend.thumbnail_dp == null ? Center( child: Text( - friend.username.characters + friend.username!.characters .characterAt(0) .toString() .toUpperCase(), @@ -45,7 +45,7 @@ buildGiftRecipient( height: 45, width: 45, fit: BoxFit.fill, - image: NetworkImage(userdpURL + friend.thumbnail_dp), + image: NetworkImage(userdpURL + friend.thumbnail_dp!), placeholder: AssetImage("assets/images/tesoDP/dp1.png"), ), @@ -53,7 +53,7 @@ buildGiftRecipient( ), new Expanded( child: InkWell( - onTap: loadFriend, + onTap: loadFriend as void Function()?, child: TextField( autofocus: false, enabled: false, diff --git a/lib/Pages/PageWidgets/Coupons/mycoupons.dart b/lib/Pages/PageWidgets/Coupons/mycoupons.dart index f448adb..2701325 100644 --- a/lib/Pages/PageWidgets/Coupons/mycoupons.dart +++ b/lib/Pages/PageWidgets/Coupons/mycoupons.dart @@ -1,3 +1,7 @@ +// ignore_for_file: unnecessary_null_comparison + +import 'dart:async'; + import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:location/location.dart'; @@ -44,7 +48,7 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, bottomRight: Radius.circular(30), ), child: CachedNetworkImage( - imageUrl: productURL + coupon.targetProduct.productImage, + imageUrl: productURL + coupon.targetProduct!.productImage!, imageBuilder: (context, imageProvider) => Image( width: MediaQuery.of(context).size.width * 0.28, height: 110, @@ -64,7 +68,7 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, Container( width: double.infinity, child: Text( - "Item Name : " + coupon.targetProduct.productName, + "Item Name : " + coupon.targetProduct!.productName!, style: TextStyle( fontSize: SizeConfig.safeBlockHorizontal * 2.8, ), @@ -73,7 +77,7 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, Container( width: double.infinity, child: Text( - "Shop Name : " + coupon.issuer.businessName, + "Shop Name : " + coupon.issuer!.businessName!, style: TextStyle( fontSize: SizeConfig.safeBlockHorizontal * 2.8, ), @@ -82,19 +86,19 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, Container( width: double.infinity, child: CountdownTimer( - endTime: coupon.expiration.millisecondsSinceEpoch, + endTime: coupon.expiration!.millisecondsSinceEpoch, widgetBuilder: (context, time) { - int day = time.days; - int hours = time.hours; - int min = time.min; - int sec = time.sec; + int? day = time!.days; + int? hours = time.hours; + int? min = time.min; + int? sec = time.sec; if (time.min == null) min = 0; if (time.days == null) day = 0; if (time.hours == null) hours = 0; if (time.sec == null) sec = 0; if (time == null) { return Text('Calculating..'); - } else if (time.days == null || time.days < 1) { + } else if (time.days == null || time.days! < 1) { return Text( "Expires in : ${hours}h : ${min}m : ${sec}s", style: TextStyle( @@ -130,9 +134,9 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, width: double.infinity, child: Text( "Pay only : GH¢ " + - (coupon.targetProduct.unitPrice - - (coupon.targetProduct.unitPrice * - (coupon.lowerLimit / 100))) + (coupon.targetProduct!.unitPrice! - + (coupon.targetProduct!.unitPrice! * + (coupon.lowerLimit! / 100))) .toStringAsFixed(2), style: TextStyle( color: Colors.red, @@ -162,11 +166,11 @@ buildMyCoupons(BuildContext context, CouponDetails coupon, Function dialog, PermissionStatus alreadyConsent = await Location.instance.hasPermission(); if (alreadyConsent != PermissionStatus.granted) { - bool results = await Navigator.push( + bool results = await (Navigator.push( context, PageTransition( child: ProminentDisclosure(), - type: PageTransitionType.leftToRight)); + type: PageTransitionType.leftToRight)) as FutureOr); if (results) { await Location.instance.requestPermission(); Navigator.push( diff --git a/lib/Pages/PageWidgets/Coupons/personalizedDiscount.dart b/lib/Pages/PageWidgets/Coupons/personalizedDiscount.dart index d46285a..d5d0f2a 100644 --- a/lib/Pages/PageWidgets/Coupons/personalizedDiscount.dart +++ b/lib/Pages/PageWidgets/Coupons/personalizedDiscount.dart @@ -39,7 +39,7 @@ buildPersonalizedDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: coupon.upperLimit < 50.1 + image: coupon.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -89,7 +89,7 @@ buildPersonalizedDiscountCoupon( child: Column( children: [ Text( - coupon.issuer.businessName.toUpperCase(), + coupon.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.white, fontSize: 18, @@ -128,7 +128,7 @@ buildPersonalizedDiscountCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - coupon.targetProduct.unitPrice.toString(), + coupon.targetProduct!.unitPrice.toString(), style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, @@ -136,8 +136,8 @@ buildPersonalizedDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (coupon.targetProduct.unitPrice- (coupon.targetProduct.unitPrice * - (coupon.lowerLimit / 100))) + (coupon.targetProduct!.unitPrice!- (coupon.targetProduct!.unitPrice! * + (coupon.lowerLimit! / 100))) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -155,7 +155,7 @@ buildPersonalizedDiscountCoupon( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - coupon.targetProduct.productName.toUpperCase(), + coupon.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -188,8 +188,8 @@ buildPersonalizedDiscountCoupon( Container( child: Text( "Pay : GH¢ " + - (coupon.targetProduct.unitPrice- (coupon.targetProduct.unitPrice * - (coupon.lowerLimit / 100))) + (coupon.targetProduct!.unitPrice!- (coupon.targetProduct!.unitPrice! * + (coupon.lowerLimit! / 100))) .toStringAsFixed(2) + " only", style: TextStyle( @@ -202,7 +202,7 @@ buildPersonalizedDiscountCoupon( ? Container() : Container( child: Text( - "Condition : " + coupon.condition, + "Condition : " + coupon.condition!, ), ), ], @@ -281,9 +281,9 @@ buildPersonalizedDiscountCoupon( ), child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: coupon.upperLimit < 50.1 ? tesoBlue : Colors.red, + primary: coupon.upperLimit! < 50.1 ? tesoBlue : Colors.red, ), - onPressed: acquiring, + onPressed: acquiring as void Function()?, child: Text( "Accept Coupon", style: TextStyle(color: Colors.white), diff --git a/lib/Pages/PageWidgets/Coupons/personalizedFreebie.dart b/lib/Pages/PageWidgets/Coupons/personalizedFreebie.dart index 5589788..f5d9798 100644 --- a/lib/Pages/PageWidgets/Coupons/personalizedFreebie.dart +++ b/lib/Pages/PageWidgets/Coupons/personalizedFreebie.dart @@ -83,7 +83,7 @@ buildPersonalizedFreebieCoupon( child: Column( children: [ Text( - coupon.issuer.businessName.toUpperCase(), + coupon.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.black, fontSize: 18, @@ -123,7 +123,7 @@ buildPersonalizedFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - coupon.targetProduct.unitPrice + coupon.targetProduct!.unitPrice! .toStringAsFixed(2), style: TextStyle( color: Colors.black, @@ -148,7 +148,7 @@ buildPersonalizedFreebieCoupon( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - coupon.targetProduct.productName.toUpperCase(), + coupon.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -192,7 +192,7 @@ buildPersonalizedFreebieCoupon( : Container( child: Text( "Condition : " + - coupon.condition + coupon.condition! .replaceAll('"', ""), style: TextStyle( color: Colors.black, @@ -267,7 +267,7 @@ buildPersonalizedFreebieCoupon( style: ElevatedButton.styleFrom( primary: accentMain, ), - onPressed: acquiring, + onPressed: acquiring as void Function()?, child: Text( "Accept Coupon", style: TextStyle(color: Colors.white), diff --git a/lib/Pages/PageWidgets/CouponsList/activeCoupon.dart b/lib/Pages/PageWidgets/CouponsList/activeCoupon.dart index 1bda217..ebca9ac 100644 --- a/lib/Pages/PageWidgets/CouponsList/activeCoupon.dart +++ b/lib/Pages/PageWidgets/CouponsList/activeCoupon.dart @@ -46,7 +46,7 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: coupon.upperLimit < 50.1 + image: coupon.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -96,7 +96,7 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, child: Column( children: [ Text( - coupon.issuer.businessName.toUpperCase(), + coupon.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.white, fontSize: 18, @@ -135,7 +135,7 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, children: [ Text( "ORIGINAL PRICE : GH¢ " + - coupon.targetProduct.unitPrice + coupon.targetProduct!.unitPrice .toString(), style: TextStyle( color: Colors.white, @@ -146,10 +146,10 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, ), Text( "DISCOUNTED PRICE : GH¢ " + - (coupon.targetProduct.unitPrice - - (coupon.targetProduct - .unitPrice * - (coupon.worth / 100))) + (coupon.targetProduct!.unitPrice! - + (coupon.targetProduct! + .unitPrice! * + (coupon.worth! / 100))) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -187,8 +187,8 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, ), child: Text( CouponRateCalculator.getRate(coupon - .targetProduct.unitPrice * - (coupon.worth / 100)) + .targetProduct!.unitPrice! * + (coupon.worth! / 100)) .toString(), style: TextStyle( color: Colors.white, @@ -212,7 +212,7 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - coupon.targetProduct.productName.toUpperCase(), + coupon.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -245,10 +245,10 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, Container( child: Text( "Pay : GH¢ " + - (coupon.targetProduct.unitPrice - - (coupon.targetProduct - .unitPrice * - (coupon.worth / 100))) + (coupon.targetProduct!.unitPrice! - + (coupon.targetProduct! + .unitPrice! * + (coupon.worth! / 100))) .toStringAsFixed(2) + " only", style: TextStyle( @@ -262,7 +262,7 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, : Container( child: Text( "Condition : " + - coupon.condition + coupon.condition! .replaceAll('"', ""), ), ), @@ -309,11 +309,11 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, mainAxisSize: MainAxisSize.min, children: [ Text( - coupon.worth.toStringAsFixed(1) + "%", + coupon.worth!.toStringAsFixed(1) + "%", style: TextStyle( color: Colors.white, fontSize: - SizeConfig.safeBlockHorizontal * 6, + SizeConfig.safeBlockHorizontal * 4, fontWeight: FontWeight.w900, ), ), @@ -349,20 +349,20 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, ), child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: coupon.upperLimit < 50.1 ? tesoBlue : Colors.red, + primary: coupon.upperLimit! < 50.1 ? tesoBlue : Colors.red, ), onPressed: () async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = coupon.issuer.businessId; + couponsHead.businessId = coupon.issuer!.businessId; couponsHead.expiration = coupon.expiration; couponsHead.couponId = coupon.couponId; couponsHead.quantity = 1; couponsHead.state = "active"; couponsHead.lower = coupon.worth; couponsHead.upper = coupon.upperLimit; - couponsHead.targetProduct = coupon.targetProduct.productID; + couponsHead.targetProduct = coupon.targetProduct!.productID; double price = - coupon.targetProduct.unitPrice * (coupon.worth / 100); + coupon.targetProduct!.unitPrice! * (coupon.worth! / 100); int cost = CouponRateCalculator.getRate(price); acquiring(couponsHead, cost); @@ -401,9 +401,9 @@ buildActiveDiscountCoupon(BuildContext context, CouponDetails coupon, child: new RotatedBox( quarterTurns: 3, child: Slider( - value: coupon.worth, - min: coupon.lowerLimit, - max: coupon.upperLimit, + value: coupon.worth!, + min: coupon.lowerLimit!, + max: coupon.upperLimit!, divisions: 20, activeColor: accentMain, inactiveColor: darkAccent, diff --git a/lib/Pages/PageWidgets/CouponsList/activeFreebieCoupon.dart b/lib/Pages/PageWidgets/CouponsList/activeFreebieCoupon.dart index 185f7da..ba50c39 100644 --- a/lib/Pages/PageWidgets/CouponsList/activeFreebieCoupon.dart +++ b/lib/Pages/PageWidgets/CouponsList/activeFreebieCoupon.dart @@ -87,7 +87,7 @@ buildFreebieCoupon( child: Column( children: [ Text( - coupon.issuer.businessName.toUpperCase(), + coupon.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.black, fontSize: 18, @@ -128,7 +128,7 @@ buildFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - coupon.targetProduct.unitPrice + coupon.targetProduct!.unitPrice! .toStringAsFixed(2), style: TextStyle( color: Colors.black, @@ -175,8 +175,8 @@ buildFreebieCoupon( ), child: Text( CouponRateCalculator.getRate( - coupon.targetProduct.unitPrice * - (coupon.worth / 100)) + coupon.targetProduct!.unitPrice! * + (coupon.worth! / 100)) .toString(), style: TextStyle( color: Colors.black, @@ -201,7 +201,7 @@ buildFreebieCoupon( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - coupon.targetProduct.productName.toUpperCase(), + coupon.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -245,7 +245,7 @@ buildFreebieCoupon( : Container( child: Text( "Condition : " + - coupon.condition + coupon.condition! .replaceAll('"', ""), style: TextStyle( color: Colors.black, @@ -322,16 +322,16 @@ buildFreebieCoupon( ), onPressed: () async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = coupon.issuer.businessId; + couponsHead.businessId = coupon.issuer!.businessId; couponsHead.expiration = coupon.expiration; couponsHead.couponId = coupon.couponId; couponsHead.quantity = 1; couponsHead.state = "active"; couponsHead.lower = 100; couponsHead.upper = 100; - couponsHead.targetProduct = coupon.targetProduct.productID; + couponsHead.targetProduct = coupon.targetProduct!.productID; double price = - coupon.targetProduct.unitPrice * (couponsHead.lower / 100); + coupon.targetProduct!.unitPrice! * (couponsHead.lower! / 100); int cost = CouponRateCalculator.getRate(price); acquiring(couponsHead, cost); }, diff --git a/lib/Pages/PageWidgets/DesireComeTrue/DesireTile.dart b/lib/Pages/PageWidgets/DesireComeTrue/DesireTile.dart index 5f88400..6726859 100644 --- a/lib/Pages/PageWidgets/DesireComeTrue/DesireTile.dart +++ b/lib/Pages/PageWidgets/DesireComeTrue/DesireTile.dart @@ -37,7 +37,7 @@ buildProductDesire(BuildContext context, Desire item, Function addItem) { width: MediaQuery.of(context).size.width * 0.28, fit: BoxFit.fill, //controller: controller, - image: NetworkImage(productURL + item.productImage), + image: NetworkImage(productURL + item.productImage!), ), ), ), @@ -48,7 +48,7 @@ buildProductDesire(BuildContext context, Desire item, Function addItem) { children: [ Container( width: double.infinity, - child: Text("Item Name : " + item.productName), + child: Text("Item Name : " + item.productName!), ), Container( width: double.infinity, diff --git a/lib/Pages/PageWidgets/DesireComeTrue/DesiredItem.dart b/lib/Pages/PageWidgets/DesireComeTrue/DesiredItem.dart index 79a906b..1853de2 100644 --- a/lib/Pages/PageWidgets/DesireComeTrue/DesiredItem.dart +++ b/lib/Pages/PageWidgets/DesireComeTrue/DesiredItem.dart @@ -4,10 +4,10 @@ import 'package:jiffy/jiffy.dart'; import 'package:shared_preferences/shared_preferences.dart'; class DesiredItem extends StatefulWidget { - final Desire item; - final int number; - final List selected; - const DesiredItem({Key key, this.item, this.number, this.selected}) + final Desire? item; + final int? number; + final List? selected; + const DesiredItem({Key? key, this.item, this.number, this.selected}) : super(key: key); @override _DesiredItemState createState() => _DesiredItemState(); @@ -15,10 +15,10 @@ class DesiredItem extends StatefulWidget { class _DesiredItemState extends State with TickerProviderStateMixin { - Animation _spaceWidth; - AnimationController _controller; - AnimationController _strikeController; - Animation _strikePercent; + late Animation _spaceWidth; + late AnimationController _controller; + late AnimationController _strikeController; + late Animation _strikePercent; bool cancelled = false; @@ -77,14 +77,14 @@ class _DesiredItemState extends State removeElement(item) { cancel(); if (cancelled) { - widget.selected.remove(item); + widget.selected!.remove(item); SharedPreferences.getInstance().then((value) { var jiffy = Jiffy()..add(months: 1); value.setString( "desire" + jiffy.format("MMMM, yyyy"), widget.selected.toString()); }); } else { - widget.selected.insert(widget.number - 1, item); + widget.selected!.insert(widget.number! - 1, item); SharedPreferences.getInstance().then((value) { var jiffy = Jiffy()..add(months: 1); value.setString( @@ -122,10 +122,10 @@ class _DesiredItemState extends State foregroundPainter: StrikeThroughPainter(_strikePercent.value), child: Text( - widget.item.productName.length > 20 - ? widget.item.productName.substring(0, 16) + + widget.item!.productName!.length > 20 + ? widget.item!.productName!.substring(0, 16) + "......" - : widget.item.productName, + : widget.item!.productName!, style: _getValidateStyle(true)), ), ), diff --git a/lib/Pages/PageWidgets/Editors/SampleThumbnail.dart b/lib/Pages/PageWidgets/Editors/SampleThumbnail.dart index 0cb800c..9a5ff7e 100644 --- a/lib/Pages/PageWidgets/Editors/SampleThumbnail.dart +++ b/lib/Pages/PageWidgets/Editors/SampleThumbnail.dart @@ -19,7 +19,7 @@ buildFilterThumb(BuildContext context, ColorFilter color, Uint8List thumb) { width: SizeConfig.safeBlockHorizontal * 25, color: Color.fromRGBO(0, 0, 0, 0.8), child: Text( - color.name, + color.name!, textAlign: TextAlign.center, style: TextStyle( fontSize: 15, @@ -39,9 +39,9 @@ buildFilterThumb(BuildContext context, ColorFilter color, Uint8List thumb) { Container( width: SizeConfig.safeBlockHorizontal * 25, height: 93, - color: color.name.toLowerCase() == "original" - ? color.code.withOpacity(0) - : color.code.withOpacity(0.5), + color: color.name!.toLowerCase() == "original" + ? color.code!.withOpacity(0) + : color.code!.withOpacity(0.5), ), ], ), diff --git a/lib/Pages/PageWidgets/Explore/business.dart b/lib/Pages/PageWidgets/Explore/business.dart index 18457eb..bd58b8d 100644 --- a/lib/Pages/PageWidgets/Explore/business.dart +++ b/lib/Pages/PageWidgets/Explore/business.dart @@ -27,7 +27,7 @@ buildBusiness(BuildContext context, TesoShop shop) { height: MediaQuery.of(context).size.width * 0.60, child: Wrap( children: [ - shop.logo.toLowerCase() == "null" || shop.logo == null + shop.logo!.toLowerCase() == "null" || shop.logo == null ? Image( width: double.infinity, height: MediaQuery.of(context).size.width * 0.45, @@ -35,7 +35,7 @@ buildBusiness(BuildContext context, TesoShop shop) { image: AssetImage("assets/images/store.png"), ) : CachedNetworkImage( - imageUrl: businessLogoURL + shop.logo, + imageUrl: businessLogoURL + shop.logo!, imageBuilder: (context, imageProvider) => FadeInImage( width: double.infinity, height: MediaQuery.of(context).size.width * 0.45, @@ -50,7 +50,7 @@ buildBusiness(BuildContext context, TesoShop shop) { color: Colors.white10, ), child: Text( - shop.shopName.toUpperCase(), + shop.shopName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( // color: Colors.black45, @@ -63,7 +63,7 @@ buildBusiness(BuildContext context, TesoShop shop) { width: MediaQuery.of(context).size.width, color: Colors.white10, child: Text( - shop.categoryShop, + shop.categoryShop!, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.normal, @@ -74,7 +74,7 @@ buildBusiness(BuildContext context, TesoShop shop) { width: MediaQuery.of(context).size.width, color: Colors.white10, child: Text( - shop.shopAddress, + shop.shopAddress!, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.normal, diff --git a/lib/Pages/PageWidgets/Explore/categoriesTile.dart b/lib/Pages/PageWidgets/Explore/categoriesTile.dart index 1fbaf6f..fadf86c 100644 --- a/lib/Pages/PageWidgets/Explore/categoriesTile.dart +++ b/lib/Pages/PageWidgets/Explore/categoriesTile.dart @@ -28,7 +28,7 @@ buildCategory(BuildContext context, Category category) { Container( margin: EdgeInsets.all(4.5), child: Image( - image: AssetImage(category.image), + image: AssetImage(category.image!), width: 24, height: 24, ), @@ -38,7 +38,7 @@ buildCategory(BuildContext context, Category category) { ), Container( margin: EdgeInsets.all(4.5), - child: Text(category.name), + child: Text(category.name!), ), ], ), diff --git a/lib/Pages/PageWidgets/Explore/popular.dart b/lib/Pages/PageWidgets/Explore/popular.dart index 6321fb0..806af53 100644 --- a/lib/Pages/PageWidgets/Explore/popular.dart +++ b/lib/Pages/PageWidgets/Explore/popular.dart @@ -58,7 +58,7 @@ buildPopularItem(BuildContext context, Product product) { ), Center( child: Text( - product.productName.toUpperCase(), + product.productName!.toUpperCase(), style: TextStyle( fontSize: SizeConfig.blockSizeHorizontal * 3.5, color: Colors.white, diff --git a/lib/Pages/PageWidgets/Explore/products.dart b/lib/Pages/PageWidgets/Explore/products.dart index aa1c9bc..19b48ce 100644 --- a/lib/Pages/PageWidgets/Explore/products.dart +++ b/lib/Pages/PageWidgets/Explore/products.dart @@ -46,7 +46,7 @@ buildProducts(BuildContext context, Product product) { ), child: Center( child: Text( - product.productName.toUpperCase(), + product.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, diff --git a/lib/Pages/PageWidgets/Explore/trending.dart b/lib/Pages/PageWidgets/Explore/trending.dart index b9202b0..69fd189 100644 --- a/lib/Pages/PageWidgets/Explore/trending.dart +++ b/lib/Pages/PageWidgets/Explore/trending.dart @@ -44,7 +44,7 @@ buildTrend(BuildContext context, Product product) { width: double.infinity, margin: EdgeInsets.only(bottom: 40), child: Text( - product.productName.toUpperCase(), + product.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, diff --git a/lib/Pages/PageWidgets/Friends/friendTile.dart b/lib/Pages/PageWidgets/Friends/friendTile.dart index 324e35d..677f193 100644 --- a/lib/Pages/PageWidgets/Friends/friendTile.dart +++ b/lib/Pages/PageWidgets/Friends/friendTile.dart @@ -22,14 +22,14 @@ buildFriend(BuildContext context, TesoUser friend) { child: friend.thumbnail_dp == null ? Center( child: Text( - friend.username.characters + friend.username!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( - imageUrl: userdpURL + friend.thumbnail_dp, + imageUrl: userdpURL + friend.thumbnail_dp!, imageBuilder: (context, imageProvider) => Image( height: 90, width: 90, @@ -54,7 +54,7 @@ buildFriend(BuildContext context, TesoUser friend) { child: Align( alignment: Alignment.centerLeft, child: Text( - friend.username, + friend.username!, style: TextStyle( fontSize: 12.5, color: Colors.grey, @@ -68,7 +68,7 @@ buildFriend(BuildContext context, TesoUser friend) { width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Text( - friend.firstname + " " + friend.lastname, + friend.firstname! + " " + friend.lastname!, textAlign: TextAlign.left, ), ), diff --git a/lib/Pages/PageWidgets/Friends/header.dart b/lib/Pages/PageWidgets/Friends/header.dart index 12aa981..878a9e6 100644 --- a/lib/Pages/PageWidgets/Friends/header.dart +++ b/lib/Pages/PageWidgets/Friends/header.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; buildFriendsHeader( - BuildContext context, TextEditingController searchkey, Function filter) { + BuildContext context, TextEditingController? searchkey, Function filter) { return Container( height: 60.0, //margin: EdgeInsets.all(10.0), diff --git a/lib/Pages/PageWidgets/HomeProximity/ActiveDiscount.dart b/lib/Pages/PageWidgets/HomeProximity/ActiveDiscount.dart index 30d1332..1a216dc 100644 --- a/lib/Pages/PageWidgets/HomeProximity/ActiveDiscount.dart +++ b/lib/Pages/PageWidgets/HomeProximity/ActiveDiscount.dart @@ -26,8 +26,8 @@ Positioned buildActiveDiscountCoupon( double worth, Function calWorth) { SizeConfig().init(context); - if (worth < img.lowerLimit) { - worth = img.lowerLimit; + if (worth < img.lowerLimit!) { + worth = img.lowerLimit!; } return new Positioned( bottom: bottom, @@ -54,7 +54,7 @@ Positioned buildActiveDiscountCoupon( InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.business.businessId; + head.businessId = img.business!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; @@ -65,7 +65,7 @@ Positioned buildActiveDiscountCoupon( head.type = img.type; CouponDetails details = new CouponDetails(); - details.businessId = img.business.businessId; + details.businessId = img.business!.businessId; details.countID = "null"; details.couponId = img.couponId; details.expiration = img.expiration; @@ -76,11 +76,11 @@ Positioned buildActiveDiscountCoupon( details.state = img.state; details.type = img.type; details.targetProduct = new Product(); - details.targetProduct.businessID = details.businessId; - details.targetProduct.productImage = img.targetImage; - details.targetProduct.productName = img.targetName; - details.targetProduct.unitPrice = img.targetCost; - details.targetProduct.productDesc = img.tagretDescription; + details.targetProduct!.businessID = details.businessId; + details.targetProduct!.productImage = img.targetImage; + details.targetProduct!.productName = img.targetName; + details.targetProduct!.unitPrice = img.targetCost; + details.targetProduct!.productDesc = img.tagretDescription; Provider.of(context, listen: false) .viewCoupon(head); @@ -132,7 +132,7 @@ Positioned buildActiveDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage( @@ -189,7 +189,7 @@ Positioned buildActiveDiscountCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.white, fontSize: 18, @@ -230,7 +230,7 @@ Positioned buildActiveDiscountCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost + img.targetCost! .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -242,8 +242,8 @@ Positioned buildActiveDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetCost - - (img.targetCost * + (img.targetCost! - + (img.targetCost! * (worth / 100))) .toStringAsFixed(2), style: TextStyle( @@ -287,7 +287,7 @@ Positioned buildActiveDiscountCoupon( child: Text( CouponRateCalculator .getRate( - img.targetCost * + img.targetCost! * (worth / 100)) .toString(), @@ -316,7 +316,7 @@ Positioned buildActiveDiscountCoupon( .width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -352,8 +352,8 @@ Positioned buildActiveDiscountCoupon( Container( child: Text( "Pay : GH¢ " + - (img.targetCost - - (img.targetCost * + (img.targetCost! - + (img.targetCost! * (worth / 100))) .toStringAsFixed(2) + " only", @@ -368,7 +368,7 @@ Positioned buildActiveDiscountCoupon( : Container( child: Text( "Condition : " + - img.condition + img.condition! .replaceAll( '"', ""), ), @@ -467,7 +467,7 @@ Positioned buildActiveDiscountCoupon( children: [ Container( child: Text( - img.upperLimit.toStringAsFixed(1) + " %", + img.upperLimit!.toStringAsFixed(1) + " %", textAlign: TextAlign.center, style: TextStyle( foreground: Paint() @@ -483,8 +483,8 @@ Positioned buildActiveDiscountCoupon( quarterTurns: 3, child: Slider( value: worth, - min: img.lowerLimit, - max: img.upperLimit, + min: img.lowerLimit!, + max: img.upperLimit!, divisions: 20, activeColor: accentMain, inactiveColor: darkAccent, diff --git a/lib/Pages/PageWidgets/HomeProximity/ActiveFreebie.dart b/lib/Pages/PageWidgets/HomeProximity/ActiveFreebie.dart index 71fd715..7e7887c 100644 --- a/lib/Pages/PageWidgets/HomeProximity/ActiveFreebie.dart +++ b/lib/Pages/PageWidgets/HomeProximity/ActiveFreebie.dart @@ -64,7 +64,7 @@ Positioned buildActiveFreebieCoupon( child: InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.business.businessId; + head.businessId = img.business!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; @@ -75,7 +75,7 @@ Positioned buildActiveFreebieCoupon( head.type = img.type; CouponDetails details = new CouponDetails(); - details.businessId = img.business.businessId; + details.businessId = img.business!.businessId; details.countID = "null"; details.couponId = img.couponId; details.expiration = img.expiration; @@ -86,11 +86,11 @@ Positioned buildActiveFreebieCoupon( details.state = img.state; details.type = img.type; details.targetProduct = new Product(); - details.targetProduct.businessID = details.businessId; - details.targetProduct.productImage = img.targetImage; - details.targetProduct.productName = img.targetName; - details.targetProduct.unitPrice = img.targetCost; - details.targetProduct.productDesc = img.tagretDescription; + details.targetProduct!.businessID = details.businessId; + details.targetProduct!.productImage = img.targetImage; + details.targetProduct!.productName = img.targetName; + details.targetProduct!.unitPrice = img.targetCost; + details.targetProduct!.productDesc = img.tagretDescription; Provider.of(context, listen: false) .viewCoupon(head); @@ -163,7 +163,7 @@ Positioned buildActiveFreebieCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.black, fontSize: 18, @@ -204,7 +204,7 @@ Positioned buildActiveFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost.toStringAsFixed(2), + img.targetCost!.toStringAsFixed(2), style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -252,8 +252,8 @@ Positioned buildActiveFreebieCoupon( ), child: Text( CouponRateCalculator.getRate( - img.targetCost * - (img.lowerLimit / 100)) + img.targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.black, @@ -278,7 +278,7 @@ Positioned buildActiveFreebieCoupon( MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -322,7 +322,7 @@ Positioned buildActiveFreebieCoupon( : Container( child: Text( "Condition : " + - img.condition + img.condition! .replaceAll('"', ""), ), ), diff --git a/lib/Pages/PageWidgets/HomeProximity/DummyDiscount.dart b/lib/Pages/PageWidgets/HomeProximity/DummyDiscount.dart index e8edf53..f919541 100644 --- a/lib/Pages/PageWidgets/HomeProximity/DummyDiscount.dart +++ b/lib/Pages/PageWidgets/HomeProximity/DummyDiscount.dart @@ -14,7 +14,7 @@ Positioned buildDummyDiscountCoupon( double skew, BuildContext context, String discount, - double selectedDiscount) { + double? selectedDiscount) { return new Positioned( bottom: 60 + bottom, child: Container( @@ -46,7 +46,7 @@ Positioned buildDummyDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -94,7 +94,7 @@ Positioned buildDummyDiscountCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.white, fontSize: 18, @@ -141,9 +141,9 @@ Positioned buildDummyDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetCost - - (img.targetCost * - (img.lowerLimit / 100))) + (img.targetCost! - + (img.targetCost! * + (img.lowerLimit! / 100))) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -166,8 +166,8 @@ Positioned buildDummyDiscountCoupon( AssetImage("assets/images/silver1.png"), ), Text( - CouponRateCalculator.getRate(img.targetCost * - (img.lowerLimit / 100)) + CouponRateCalculator.getRate(img.targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.white, @@ -186,7 +186,7 @@ Positioned buildDummyDiscountCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName, + img.targetName!, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -219,7 +219,7 @@ Positioned buildDummyDiscountCoupon( Container( child: Text( "Price : GH¢ " + - (img.targetCost * (img.lowerLimit / 100)) + (img.targetCost! * (img.lowerLimit! / 100)) .toStringAsFixed(2) + " only", style: TextStyle( @@ -233,7 +233,7 @@ Positioned buildDummyDiscountCoupon( : Container( child: Text( "Condition : " + - img.condition.replaceAll('"', ""), + img.condition!.replaceAll('"', ""), ), ), ], @@ -276,7 +276,7 @@ Positioned buildDummyDiscountCoupon( mainAxisSize: MainAxisSize.min, children: [ Text( - img.lowerLimit.toStringAsFixed(1) + "%", + img.lowerLimit!.toStringAsFixed(1) + "%", style: TextStyle( color: Colors.white, fontSize: SizeConfig.safeBlockHorizontal * 6, diff --git a/lib/Pages/PageWidgets/HomeProximity/DummyFreebie.dart b/lib/Pages/PageWidgets/HomeProximity/DummyFreebie.dart index 43288fe..bbd1a38 100644 --- a/lib/Pages/PageWidgets/HomeProximity/DummyFreebie.dart +++ b/lib/Pages/PageWidgets/HomeProximity/DummyFreebie.dart @@ -15,7 +15,7 @@ Positioned buildDummyFreebieCoupon( double skew, BuildContext context, String discount, - double selectedDiscount) { + double? selectedDiscount) { SizeConfig().init(context); return new Positioned( bottom: 60.0 + bottom, @@ -89,7 +89,7 @@ Positioned buildDummyFreebieCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.black, fontSize: 18, @@ -131,7 +131,7 @@ Positioned buildDummyFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost.toStringAsFixed(2), + img.targetCost!.toStringAsFixed(2), style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -160,8 +160,8 @@ Positioned buildDummyFreebieCoupon( AssetImage("assets/images/silver1.png"), ), Text( - CouponRateCalculator.getRate(img.targetCost * - (img.lowerLimit / 100)) + CouponRateCalculator.getRate(img.targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.black, @@ -181,7 +181,7 @@ Positioned buildDummyFreebieCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -225,7 +225,7 @@ Positioned buildDummyFreebieCoupon( : Container( child: Text( "Condition : " + - img.condition.replaceAll('"', ""), + img.condition!.replaceAll('"', ""), ), ), ], diff --git a/lib/Pages/PageWidgets/Inbox/inboxTile.dart b/lib/Pages/PageWidgets/Inbox/inboxTile.dart index 520a178..06eda5d 100644 --- a/lib/Pages/PageWidgets/Inbox/inboxTile.dart +++ b/lib/Pages/PageWidgets/Inbox/inboxTile.dart @@ -22,14 +22,14 @@ buildInboxTile(BuildContext context, InboxMessage message, bool read) { child: message.thumbnail == null ? Center( child: Text( - message.firstname.characters + message.firstname!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( - imageUrl: userdpURL + message.thumbnail, + imageUrl: userdpURL + message.thumbnail!, imageBuilder: (context, imageProvider) => FadeInImage( height: 90, width: 90, @@ -61,7 +61,7 @@ buildInboxTile(BuildContext context, InboxMessage message, bool read) { child: Align( alignment: Alignment.centerLeft, child: Text( - message.firstname + " " + message.surname, + message.firstname! + " " + message.surname!, style: TextStyle( fontSize: 12.5, color: Theme.of(context).primaryColorLight, @@ -76,10 +76,10 @@ buildInboxTile(BuildContext context, InboxMessage message, bool read) { width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Text( - message.message.length > 73 - ? message.message.substring(0, 73).toString() + + message.message!.length > 73 + ? message.message!.substring(0, 73).toString() + "...." - : message.message, + : message.message!, textAlign: TextAlign.left, style: TextStyle( fontSize: 11, @@ -99,7 +99,7 @@ buildInboxTile(BuildContext context, InboxMessage message, bool read) { // padding: EdgeInsets.symmetric(horizontal: 20.0), child: Center( child: Text( - TimeElapsed.fromDateTime(message.timestamp), + TimeElapsed.fromDateTime(message.timestamp!), style: TextStyle( color: Theme.of(context).colorScheme.secondary, @@ -132,7 +132,7 @@ buildInboxTile(BuildContext context, InboxMessage message, bool read) { height: 30, child: Center( child: Text( - TimeElapsed.fromDateTime(message.timestamp), + TimeElapsed.fromDateTime(message.timestamp!), ), ), ), diff --git a/lib/Pages/PageWidgets/Login/passwordSignUP.dart b/lib/Pages/PageWidgets/Login/passwordSignUP.dart index 81c0b99..bc8caa8 100644 --- a/lib/Pages/PageWidgets/Login/passwordSignUP.dart +++ b/lib/Pages/PageWidgets/Login/passwordSignUP.dart @@ -19,7 +19,7 @@ createPassword(BuildContext context, TextEditingController password) { borderSide: BorderSide(color: accentMain, width: 1.0), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.blueGrey[400], width: 1.0), + borderSide: BorderSide(color: Colors.blueGrey[400]!, width: 1.0), ), //contentPadding: EdgeInsets.only(top: 8.0), ), diff --git a/lib/Pages/PageWidgets/Login/phonenumber.dart b/lib/Pages/PageWidgets/Login/phonenumber.dart index 10d6b70..78cd9c3 100644 --- a/lib/Pages/PageWidgets/Login/phonenumber.dart +++ b/lib/Pages/PageWidgets/Login/phonenumber.dart @@ -37,7 +37,7 @@ inputTelNumber( theme: CountryTheme( isShowFlag: true, isShowCode: true, isShowTitle: false), //initialSelection: user.currentUser.country, - onChanged: (CountryCode code) => countryPrefix(code)), + onChanged: (CountryCode? code) => countryPrefix(code)), ), // suffix: InkWell( // onTap: () => user.clear(), diff --git a/lib/Pages/PageWidgets/Login/validation.dart b/lib/Pages/PageWidgets/Login/validation.dart index b24ca27..f41ada4 100644 --- a/lib/Pages/PageWidgets/Login/validation.dart +++ b/lib/Pages/PageWidgets/Login/validation.dart @@ -12,10 +12,10 @@ class ValidationItem extends StatefulWidget { class _ValidationItemState extends State with TickerProviderStateMixin { - AnimationController _controller; - AnimationController _strikeController; - Animation _spaceWidth; - Animation _strikePercent; + late AnimationController _controller; + late AnimationController _strikeController; + late Animation _spaceWidth; + late Animation _strikePercent; @override void didUpdateWidget(ValidationItem oldWidget) { diff --git a/lib/Pages/PageWidgets/Personal/header.dart b/lib/Pages/PageWidgets/Personal/header.dart index 0a14cdb..750e058 100644 --- a/lib/Pages/PageWidgets/Personal/header.dart +++ b/lib/Pages/PageWidgets/Personal/header.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unnecessary_null_comparison + import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:teso/util/SizeConfig.dart'; @@ -6,7 +8,7 @@ buildProfileHeader( BuildContext context, String gold, String silver, - String username, + String? username, String bytes, String friends, String fullname, @@ -29,13 +31,13 @@ buildProfileHeader( child: bytes == null ? Center( child: Text( - username.characters.characterAt(0).toString().toUpperCase(), + username!.characters.characterAt(0).toString().toUpperCase(), ), ) : bytes == "null" ? Center( child: Text( - username.characters + username!.characters .characterAt(0) .toString() .toUpperCase(), @@ -105,48 +107,6 @@ buildProfileHeader( SizedBox( height: 5, ), - Container( - height: 18, - width: double.infinity, - // transform: Matrix4.translationValues(0.0, -25.0, 0.0), - margin: - EdgeInsets.only(left: MediaQuery.of(context).size.width / 3.5), - child: Center( - child: Row( - children: [ - Image( - image: AssetImage("assets/images/gold1.png"), - ), - Container( - child: Center( - child: Text( - "Gold Coins : ", - style: TextStyle( - fontSize: SizeConfig.blockSizeHorizontal * 3.8, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Center( - child: Text( - gold, - style: TextStyle( - fontSize: SizeConfig.blockSizeHorizontal * 3.8, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ], - ), - ), - ), - SizedBox( - height: 5, - ), Container( height: 18, width: double.infinity, diff --git a/lib/Pages/PageWidgets/ProximityList/ActiveDiscount.dart b/lib/Pages/PageWidgets/ProximityList/ActiveDiscount.dart index b399621..0731e7e 100644 --- a/lib/Pages/PageWidgets/ProximityList/ActiveDiscount.dart +++ b/lib/Pages/PageWidgets/ProximityList/ActiveDiscount.dart @@ -29,8 +29,8 @@ Positioned buildActiveDiscountCoupon( double worth, Function calWorth) { SizeConfig().init(context); - if (worth < img.lowerLimit) { - worth = img.lowerLimit; + if (worth < img.lowerLimit!) { + worth = img.lowerLimit!; } return new Positioned( bottom: bottom, @@ -67,7 +67,7 @@ Positioned buildActiveDiscountCoupon( InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.business.businessId; + head.businessId = img.business!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; @@ -78,7 +78,7 @@ Positioned buildActiveDiscountCoupon( head.type = img.type; CouponDetails details = new CouponDetails(); - details.businessId = img.business.businessId; + details.businessId = img.business!.businessId; details.countID = "null"; details.couponId = img.couponId; details.expiration = img.expiration; @@ -89,11 +89,11 @@ Positioned buildActiveDiscountCoupon( details.state = img.state; details.type = img.type; details.targetProduct = new Product(); - details.targetProduct.businessID = details.businessId; - details.targetProduct.productImage = img.targetImage; - details.targetProduct.productName = img.targetName; - details.targetProduct.unitPrice = img.targetCost; - details.targetProduct.productDesc = img.tagretDescription; + details.targetProduct!.businessID = details.businessId; + details.targetProduct!.productImage = img.targetImage; + details.targetProduct!.productName = img.targetName; + details.targetProduct!.unitPrice = img.targetCost; + details.targetProduct!.productDesc = img.tagretDescription; await Provider.of(context, listen: false) .viewCoupon(head); @@ -145,7 +145,7 @@ Positioned buildActiveDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage( @@ -202,7 +202,7 @@ Positioned buildActiveDiscountCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.white, fontSize: 18, @@ -244,7 +244,7 @@ Positioned buildActiveDiscountCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost + img.targetCost! .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -256,8 +256,8 @@ Positioned buildActiveDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetCost - - (img.targetCost * + (img.targetCost! - + (img.targetCost! * (worth / 100))) .toStringAsFixed(2), style: TextStyle( @@ -301,7 +301,7 @@ Positioned buildActiveDiscountCoupon( child: Text( CouponRateCalculator .getRate( - img.targetCost * + img.targetCost! * (worth / 100)) .toString(), @@ -330,7 +330,7 @@ Positioned buildActiveDiscountCoupon( .width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -368,8 +368,8 @@ Positioned buildActiveDiscountCoupon( Container( child: Text( "Pay : GH¢ " + - (img.targetCost - - (img.targetCost * + (img.targetCost! - + (img.targetCost! * (worth / 100))) .toStringAsFixed(2) + @@ -385,7 +385,7 @@ Positioned buildActiveDiscountCoupon( : Container( child: Text( "Condition : " + - img.condition + img.condition! .replaceAll( '"', ""), ), @@ -492,8 +492,8 @@ Positioned buildActiveDiscountCoupon( quarterTurns: 3, child: Slider( value: worth, - min: img.lowerLimit, - max: img.upperLimit, + min: img.lowerLimit!, + max: img.upperLimit!, divisions: 20, activeColor: accentMain, inactiveColor: darkAccent, diff --git a/lib/Pages/PageWidgets/ProximityList/ActiveFreebie.dart b/lib/Pages/PageWidgets/ProximityList/ActiveFreebie.dart index 71cbd50..f31b7d8 100644 --- a/lib/Pages/PageWidgets/ProximityList/ActiveFreebie.dart +++ b/lib/Pages/PageWidgets/ProximityList/ActiveFreebie.dart @@ -77,7 +77,7 @@ Positioned buildActiveFreebieCoupon( child: InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.business.businessId; + head.businessId = img.business!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; @@ -88,7 +88,7 @@ Positioned buildActiveFreebieCoupon( head.type = img.type; CouponDetails details = new CouponDetails(); - details.businessId = img.business.businessId; + details.businessId = img.business!.businessId; details.countID = "null"; details.couponId = img.couponId; details.expiration = img.expiration; @@ -99,11 +99,11 @@ Positioned buildActiveFreebieCoupon( details.state = img.state; details.type = img.type; details.targetProduct = new Product(); - details.targetProduct.businessID = details.businessId; - details.targetProduct.productImage = img.targetImage; - details.targetProduct.productName = img.targetName; - details.targetProduct.unitPrice = img.targetCost; - details.targetProduct.productDesc = img.tagretDescription; + details.targetProduct!.businessID = details.businessId; + details.targetProduct!.productImage = img.targetImage; + details.targetProduct!.productName = img.targetName; + details.targetProduct!.unitPrice = img.targetCost; + details.targetProduct!.productDesc = img.tagretDescription; await Provider.of(context, listen: false) .viewCoupon(head); @@ -176,7 +176,7 @@ Positioned buildActiveFreebieCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.black, fontSize: 18, @@ -217,7 +217,7 @@ Positioned buildActiveFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost.toStringAsFixed(2), + img.targetCost!.toStringAsFixed(2), style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -267,8 +267,8 @@ Positioned buildActiveFreebieCoupon( ), child: Text( CouponRateCalculator.getRate(img - .targetCost * - (img.lowerLimit / 100)) + .targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.black, @@ -293,7 +293,7 @@ Positioned buildActiveFreebieCoupon( MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -338,7 +338,7 @@ Positioned buildActiveFreebieCoupon( : Container( child: Text( "Condition : " + - img.condition + img.condition! .replaceAll('"', ""), ), ), diff --git a/lib/Pages/PageWidgets/ProximityList/DummyDiscount.dart b/lib/Pages/PageWidgets/ProximityList/DummyDiscount.dart index 1ea7bb2..ee6c5d3 100644 --- a/lib/Pages/PageWidgets/ProximityList/DummyDiscount.dart +++ b/lib/Pages/PageWidgets/ProximityList/DummyDiscount.dart @@ -13,7 +13,7 @@ Positioned buildDummyDiscountCoupon( double skew, BuildContext context, String discount, - double selectedDiscount) { + double? selectedDiscount) { return new Positioned( bottom: 60 + bottom, child: Container( @@ -45,7 +45,7 @@ Positioned buildDummyDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -93,7 +93,7 @@ Positioned buildDummyDiscountCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.white, fontSize: 18, @@ -140,9 +140,9 @@ Positioned buildDummyDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetCost - - (img.targetCost * - (img.lowerLimit / 100))) + (img.targetCost! - + (img.targetCost! * + (img.lowerLimit! / 100))) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -165,8 +165,8 @@ Positioned buildDummyDiscountCoupon( AssetImage("assets/images/silver1.png"), ), Text( - CouponRateCalculator.getRate(img.targetCost * - (img.lowerLimit / 100)) + CouponRateCalculator.getRate(img.targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.white, @@ -185,7 +185,7 @@ Positioned buildDummyDiscountCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName, + img.targetName!, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -218,7 +218,7 @@ Positioned buildDummyDiscountCoupon( Container( child: Text( "Price : GH¢ " + - (img.targetCost * (img.lowerLimit / 100)) + (img.targetCost! * (img.lowerLimit! / 100)) .toStringAsFixed(2) + " only", style: TextStyle( @@ -232,7 +232,7 @@ Positioned buildDummyDiscountCoupon( : Container( child: Text( "Condition : " + - img.condition.replaceAll('"', ""), + img.condition!.replaceAll('"', ""), ), ), ], diff --git a/lib/Pages/PageWidgets/ProximityList/DummyFreebie.dart b/lib/Pages/PageWidgets/ProximityList/DummyFreebie.dart index 8dd01f7..6576d12 100644 --- a/lib/Pages/PageWidgets/ProximityList/DummyFreebie.dart +++ b/lib/Pages/PageWidgets/ProximityList/DummyFreebie.dart @@ -14,7 +14,7 @@ Positioned buildDummyFreebieCoupon( double skew, BuildContext context, String discount, - double selectedDiscount) { + double? selectedDiscount) { return new Positioned( bottom: 60.0 + bottom, child: Container( @@ -87,7 +87,7 @@ Positioned buildDummyFreebieCoupon( child: Column( children: [ Text( - img.business.businessName, + img.business!.businessName!, style: TextStyle( color: Colors.black, fontSize: 18, @@ -129,7 +129,7 @@ Positioned buildDummyFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetCost.toStringAsFixed(2), + img.targetCost!.toStringAsFixed(2), style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -158,8 +158,8 @@ Positioned buildDummyFreebieCoupon( AssetImage("assets/images/silver1.png"), ), Text( - CouponRateCalculator.getRate(img.targetCost * - (img.lowerLimit / 100)) + CouponRateCalculator.getRate(img.targetCost! * + (img.lowerLimit! / 100)) .toString(), style: TextStyle( color: Colors.black, @@ -179,7 +179,7 @@ Positioned buildDummyFreebieCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetName.toUpperCase(), + img.targetName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -223,7 +223,7 @@ Positioned buildDummyFreebieCoupon( : Container( child: Text( "Condition : " + - img.condition.replaceAll('"', ""), + img.condition!.replaceAll('"', ""), ), ), ], diff --git a/lib/Pages/PageWidgets/Recently Viewed/viewedItem.dart b/lib/Pages/PageWidgets/Recently Viewed/viewedItem.dart index 90f2d5a..5b702d5 100644 --- a/lib/Pages/PageWidgets/Recently Viewed/viewedItem.dart +++ b/lib/Pages/PageWidgets/Recently Viewed/viewedItem.dart @@ -7,7 +7,7 @@ import 'package:teso/Classes/API Clasess/CouponHead.dart'; buildRecentItem( BuildContext context, CouponDetails couponDetails, Function purchase) { bool active; - if (couponDetails.quantity > 0) { + if (couponDetails.quantity! > 0) { active = true; } else { active = false; @@ -40,7 +40,7 @@ buildRecentItem( bottomRight: Radius.circular(30), ), child: CachedNetworkImage( - imageUrl: productURL + couponDetails.targetProduct.productImage, + imageUrl: productURL + couponDetails.targetProduct!.productImage!, imageBuilder: (context, imageProvider) => Image( width: MediaQuery.of(context).size.width * 0.28, height: 110, @@ -69,7 +69,7 @@ buildRecentItem( child: Align( alignment: Alignment.centerLeft, child: Text( - couponDetails.issuer.businessName, + couponDetails.issuer!.businessName!, style: TextStyle( fontSize: 12.5, color: Colors.grey, @@ -102,7 +102,7 @@ buildRecentItem( width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Text( - couponDetails.targetProduct.productName, + couponDetails.targetProduct!.productName!, textAlign: TextAlign.left, ), ), @@ -111,7 +111,7 @@ buildRecentItem( (MediaQuery.of(context).size.width * 0.35), child: Text( "Cost : GH¢ " + - couponDetails.targetProduct.unitPrice.toString(), + couponDetails.targetProduct!.unitPrice.toString(), textAlign: TextAlign.left, ), ), @@ -141,9 +141,9 @@ buildRecentItem( couponHeads.type = couponDetails.type; couponHeads.quantity = 1; couponHeads.targetProduct = - couponDetails.targetProduct.productID; + couponDetails.targetProduct!.productID; purchase(context, couponHeads, - couponDetails.targetProduct.unitPrice); + couponDetails.targetProduct!.unitPrice); }, child: Text("Acquire Coupon"), ), diff --git a/lib/Pages/PageWidgets/Redeem/activeCard.dart b/lib/Pages/PageWidgets/Redeem/activeCard.dart index 42f8bb3..abd963d 100644 --- a/lib/Pages/PageWidgets/Redeem/activeCard.dart +++ b/lib/Pages/PageWidgets/Redeem/activeCard.dart @@ -59,7 +59,7 @@ Positioned activeCard( turns: new AlwaysStoppedAnimation( flag == 0 ? rotation / 360 : -rotation / 360), child: new Hero( - tag: img.couponId, + tag: img.couponId!, child: new GestureDetector( // onTap: () { // // Navigator.push( @@ -161,7 +161,7 @@ Positioned activeCard( width: double.infinity, child: Center( child: Text( - img.targetName, + img.targetName!, style: TextStyle( fontSize: 18, color: Colors.white), ), @@ -226,7 +226,7 @@ Positioned activeCard( ), primary: Colors.red, padding: new EdgeInsets.all(10.0),), - onPressed: swipeLeft, + onPressed: swipeLeft as void Function()?, child: new Container( height: 30.0, width: 100.0, @@ -247,7 +247,7 @@ Positioned activeCard( ), primary: Colors.green[200], padding: new EdgeInsets.all(10.0),), - onPressed: swipeRight, + onPressed: swipeRight as void Function()?, child: new Container( height: 30.0, width: 100.0, diff --git a/lib/Pages/PageWidgets/Redeem/detail.dart b/lib/Pages/PageWidgets/Redeem/detail.dart index 09f7e67..40c68b9 100644 --- a/lib/Pages/PageWidgets/Redeem/detail.dart +++ b/lib/Pages/PageWidgets/Redeem/detail.dart @@ -5,8 +5,8 @@ import 'package:teso/util/consts.dart'; import 'package:teso/Classes/API Clasess/CouponDetails.dart'; class DetailPage extends StatefulWidget { - final CouponDetails type; - const DetailPage({Key key, this.type}) : super(key: key); + final CouponDetails? type; + const DetailPage({Key? key, this.type}) : super(key: key); @override _DetailPageState createState() => new _DetailPageState(type: type); } @@ -14,10 +14,10 @@ class DetailPage extends StatefulWidget { enum AppBarBehavior { normal, pinned, floating, snapping } class _DetailPageState extends State with TickerProviderStateMixin { - AnimationController _containerController; - Animation width; - Animation heigth; - CouponDetails type; + late AnimationController _containerController; + late Animation width; + late Animation heigth; + CouponDetails? type; _DetailPageState({this.type}); double _appBarHeight = 256.0; AppBarBehavior _appBarBehavior = AppBarBehavior.pinned; @@ -73,7 +73,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { height: heigth.value, //color: const Color.fromRGBO(106, 94, 175, 1.0), child: new Hero( - tag: type.couponId, + tag: type!.couponId!, child: new Card( color: Colors.transparent, child: new Container( @@ -120,7 +120,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { child: Align( alignment: Alignment.bottomCenter, child: new Text( - type.targetProduct.productName, + type!.targetProduct!.productName!, // style: TextStyle( // // color: Theme.of(context).accentColor), ), @@ -136,7 +136,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { decoration: new BoxDecoration( image: DecorationImage( image: NetworkImage(productURL + - type.targetProduct.productImage), + type!.targetProduct!.productImage!), fit: BoxFit.fill, ), ), @@ -177,7 +177,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { padding: const EdgeInsets.all(8.0), child: new Text("GH¢ " + - type.targetProduct.unitPrice + type!.targetProduct!.unitPrice .toString()), ) ], @@ -185,7 +185,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { new Padding( padding: const EdgeInsets.all(8.0), child: new Text( - type.worth.toString() + "% off"), + type!.worth.toString() + "% off"), ), new Row( children: [ @@ -199,7 +199,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { padding: const EdgeInsets.all(8.0), child: new Text( - type.issuer.businessName), + type!.issuer!.businessName!), ) ], ), @@ -230,7 +230,7 @@ class _DetailPageState extends State with TickerProviderStateMixin { fontWeight: FontWeight.bold), ), ), - new Text(type.targetProduct.productDesc), + new Text(type!.targetProduct!.productDesc!), new Container( margin: new EdgeInsets.only(top: 25.0), padding: new EdgeInsets.only( diff --git a/lib/Pages/PageWidgets/Redeem/discountCoupon.dart b/lib/Pages/PageWidgets/Redeem/discountCoupon.dart index 4f13547..d3ed2bc 100644 --- a/lib/Pages/PageWidgets/Redeem/discountCoupon.dart +++ b/lib/Pages/PageWidgets/Redeem/discountCoupon.dart @@ -21,7 +21,7 @@ Positioned buildCoupon( Function swipeLeft, String discount, ) { - img.productCost = img.targetProduct.unitPrice; + img.productCost = img.targetProduct!.unitPrice; Size screenSize = MediaQuery.of(context).size; return new Positioned( bottom: 45.0 + bottom, @@ -59,14 +59,14 @@ Positioned buildCoupon( InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.issuer.businessId; + head.businessId = img.issuer!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; head.upper = img.upperLimit; head.quantity = img.quantity; head.state = img.state; - head.targetProduct = img.targetProduct.productID; + head.targetProduct = img.targetProduct!.productID; head.type = img.type; await Provider.of(context, listen: false) .viewCoupon(head); @@ -161,7 +161,7 @@ Positioned buildCoupon( width: double.infinity, child: Center( child: Text( - img.targetProduct.productName, + img.targetProduct!.productName!, style: TextStyle( fontSize: 18, color: Colors.white), ), @@ -173,7 +173,7 @@ Positioned buildCoupon( child: Center( child: Text( "Item Original Price : " + - img.targetProduct.unitPrice.toString(), + img.targetProduct!.unitPrice.toString(), style: TextStyle( fontSize: 18, color: Colors.white), ), @@ -227,7 +227,7 @@ Positioned buildCoupon( ), primary: Colors.red, padding: new EdgeInsets.all(10.0),), - onPressed: swipeLeft, + onPressed: swipeLeft as void Function()?, child: new Container( height: 30.0, width: 100.0, @@ -248,7 +248,7 @@ Positioned buildCoupon( ), primary: Colors.green[200], padding: new EdgeInsets.all(10.0),), - onPressed: swipeRight, + onPressed: swipeRight as void Function()?, child: new Container( height: 30.0, width: 100.0, diff --git a/lib/Pages/PageWidgets/Redeem/dummyCard.dart b/lib/Pages/PageWidgets/Redeem/dummyCard.dart index 4087b30..cb69666 100644 --- a/lib/Pages/PageWidgets/Redeem/dummyCard.dart +++ b/lib/Pages/PageWidgets/Redeem/dummyCard.dart @@ -121,7 +121,7 @@ Positioned cardDemoDummy( width: double.infinity, child: Center( child: Text( - img.targetName, + img.targetName!, style: TextStyle(fontSize: 18, color: Colors.white), ), ), diff --git a/lib/Pages/PageWidgets/Redeem/scannedDummy.dart b/lib/Pages/PageWidgets/Redeem/scannedDummy.dart index b4ce0c3..8ea74e0 100644 --- a/lib/Pages/PageWidgets/Redeem/scannedDummy.dart +++ b/lib/Pages/PageWidgets/Redeem/scannedDummy.dart @@ -121,7 +121,7 @@ Positioned cardDemoDummy( width: double.infinity, child: Center( child: Text( - img.targetProduct.productName, + img.targetProduct!.productName!, style: TextStyle(fontSize: 18, color: Colors.white), ), ), @@ -133,7 +133,7 @@ Positioned cardDemoDummy( child: Text( "Item Original Price : " + "GH¢ " + - img.targetProduct.unitPrice.toString(), + img.targetProduct!.unitPrice.toString(), style: TextStyle(fontSize: 18, color: Colors.white), ), ), diff --git a/lib/Pages/PageWidgets/Settings/AccountSettings.dart b/lib/Pages/PageWidgets/Settings/AccountSettings.dart index 8296dd7..fc21028 100644 --- a/lib/Pages/PageWidgets/Settings/AccountSettings.dart +++ b/lib/Pages/PageWidgets/Settings/AccountSettings.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:country_list_pick/country_list_pick.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -14,7 +16,7 @@ class AccountSettings extends StatefulWidget { } class _AccountSettingsState extends State { - bool show = false; + bool? show = false; @override void initState() { @@ -30,7 +32,7 @@ class _AccountSettingsState extends State { Widget build(BuildContext context) { UserProvider userProvider = Provider.of(context); return Consumer( - builder: (BuildContext context, UserProvider user, Widget child) { + builder: (BuildContext context, UserProvider user, Widget? child) { return Container( height: MediaQuery.of(context).size.height * 0.9, child: SingleChildScrollView( @@ -74,10 +76,10 @@ class _AccountSettingsState extends State { trailing: CountryListPick( theme: CountryTheme( isShowFlag: true, isShowCode: true, isShowTitle: true), - initialSelection: user.currentUser.country, - onChanged: (CountryCode code) { - TesoUser newuser = user.currentUser; - newuser.country = code.dialCode; + initialSelection: user.currentUser!.country, + onChanged: (CountryCode? code) { + TesoUser newuser = user.currentUser!; + newuser.country = code!.dialCode; Provider.of(context, listen: false) .updateUser(newuser); }, @@ -89,7 +91,7 @@ class _AccountSettingsState extends State { spacing: 10, children: [ new Text( - userProvider.currentUser.gender, + userProvider.currentUser!.gender!, style: TextStyle( fontSize: 16, ), @@ -99,8 +101,8 @@ class _AccountSettingsState extends State { ), title: new Text('Gender'), onTap: () async { - int orientation = 5; - switch (userProvider.currentUser.gender) { + int? orientation = 5; + switch (userProvider.currentUser!.gender) { case "Male": orientation = 0; break; @@ -111,7 +113,7 @@ class _AccountSettingsState extends State { orientation = 2; break; } - orientation = await Navigator.push( + orientation = await (Navigator.push( context, PageTransition( child: Gender( @@ -119,13 +121,13 @@ class _AccountSettingsState extends State { ), type: PageTransitionType.leftToRight, ), - ); - TesoUser newuser = user.currentUser; + ) as FutureOr); + TesoUser? newuser = user.currentUser; Provider.of(context, listen: false) .updateUser(newuser); }), Visibility( - visible: show, + visible: show!, child: new ListTile( trailing: new Icon(Icons.arrow_forward_ios), title: new Text('Change password'), diff --git a/lib/Pages/PageWidgets/Settings/EditProfile.dart b/lib/Pages/PageWidgets/Settings/EditProfile.dart index 64ccd16..61af188 100644 --- a/lib/Pages/PageWidgets/Settings/EditProfile.dart +++ b/lib/Pages/PageWidgets/Settings/EditProfile.dart @@ -16,9 +16,9 @@ import 'package:teso/providers/user_provider.dart'; import 'package:teso/util/consts.dart'; class EditProfile extends StatefulWidget { - final TesoUser userProfile; - final List connectedCameras; - const EditProfile({Key key, this.userProfile, this.connectedCameras}) + final TesoUser? userProfile; + final List? connectedCameras; + const EditProfile({Key? key, this.userProfile, this.connectedCameras}) : super(key: key); @override _EditProfileState createState() => @@ -32,12 +32,12 @@ enum AppState { } class _EditProfileState extends State { - TesoUser userProfile; + TesoUser? userProfile; _EditProfileState({this.userProfile}); - AppState state; + AppState? state; bool imageAvailable = false; - File _image; - String thumb; + File? _image; + String? thumb; bool passed = false; bool failed = false; final picker = ImagePicker(); @@ -54,7 +54,7 @@ class _EditProfileState extends State { context, PageTransition( type: PageTransitionType.leftToRight, - child: TakeDP(connectedCameras: widget.connectedCameras), + child: TakeDP(connectedCameras: widget.connectedCameras!), )); if (pickedFile != null) { @@ -68,8 +68,8 @@ class _EditProfileState extends State { Future _cropImage() async { ImageCropper imageCropper = new ImageCropper(); - CroppedFile croppedFile = await imageCropper.cropImage( - sourcePath: _image.path, + CroppedFile? croppedFile = await imageCropper.cropImage( + sourcePath: _image!.path, cropStyle: CropStyle.circle, aspectRatioPresets: Platform.isAndroid ? [CropAspectRatioPreset.original] @@ -105,15 +105,15 @@ class _EditProfileState extends State { Future _updateUser() async { try { - String thumbnail; + String? thumbnail; if (_image != null) { - List imageBytes = await _image.readAsBytes(); + List imageBytes = await _image!.readAsBytes(); thumbnail = base64Encode(imageBytes); } else if (thumb != null) { thumbnail = thumb; } TesoUser updateuser = new TesoUser(); - updateuser.userGUID = userProfile.userGUID; + updateuser.userGUID = userProfile!.userGUID; updateuser.username = username.text; updateuser.firstname = firstname.text; updateuser.lastname = surname.text; @@ -121,14 +121,14 @@ class _EditProfileState extends State { updateuser.description = description.text; updateuser.email = email.text; updateuser.phonenumber = telephone.text; - updateuser.gold = userProfile.gold; - updateuser.silver = userProfile.silver; - updateuser.friends = userProfile.friends; + updateuser.gold = userProfile!.gold; + updateuser.silver = userProfile!.silver; + updateuser.friends = userProfile!.friends; updateuser.displaypicture = thumbnail; - updateuser.thumbnail_dp = userProfile.thumbnail_dp; - updateuser.country = userProfile.country; - updateuser.gender = userProfile.gender; - updateuser.dateOfBirth = userProfile.dateOfBirth; + updateuser.thumbnail_dp = userProfile!.thumbnail_dp; + updateuser.country = userProfile!.country; + updateuser.gender = userProfile!.gender; + updateuser.dateOfBirth = userProfile!.dateOfBirth; print(updateuser.toString()); UserProvider userProvider = Provider.of(context, listen: false); @@ -171,14 +171,14 @@ class _EditProfileState extends State { @override void initState() { - username.text = userProfile.username.toString(); - firstname.text = userProfile.firstname; - surname.text = userProfile.lastname; - address.text = userProfile.address; - email.text = userProfile.email; - telephone.text = userProfile.phonenumber; - description.text = userProfile.description; - thumb = userProfile.thumbnail_dp; + username.text = userProfile!.username.toString(); + firstname.text = userProfile!.firstname!; + surname.text = userProfile!.lastname!; + address.text = userProfile!.address!; + email.text = userProfile!.email!; + telephone.text = userProfile!.phonenumber!; + description.text = userProfile!.description!; + thumb = userProfile!.thumbnail_dp; super.initState(); } @@ -336,7 +336,7 @@ class _EditProfileState extends State { fit: BoxFit.fill, image: FileImage( File( - _image.path, + _image!.path, ), ), ), @@ -360,7 +360,7 @@ class _EditProfileState extends State { width: 130, fit: BoxFit.fill, image: - NetworkImage(userdpURL + thumb), + NetworkImage(userdpURL + thumb!), placeholder: AssetImage( "assets/images/tesoDP/dp1.png"), ), diff --git a/lib/Pages/PageWidgets/Third Person Profile/header.dart b/lib/Pages/PageWidgets/Third Person Profile/header.dart index a618388..8270ec0 100644 --- a/lib/Pages/PageWidgets/Third Person Profile/header.dart +++ b/lib/Pages/PageWidgets/Third Person Profile/header.dart @@ -4,19 +4,19 @@ import 'package:teso/util/consts.dart'; import 'package:flutter/material.dart'; buildHead( - {BuildContext context, - TesoUser user, - String posts, - List friends, - List following, - bool relation, - bool pending, - bool approveRequest, - bool loading, - Function unFriend, - Function approve, - Function cancelRequest, - Function decline}) { + {required BuildContext context, + required TesoUser user, + String? posts, + List? friends, + List? following, + bool? relation, + bool? pending, + bool? approveRequest, + bool? loading, + Function? unFriend, + Function? approve, + Function? cancelRequest, + Function? decline}) { return Container( color: Theme.of(context).backgroundColor, width: MediaQuery.of(context).size.width, @@ -33,7 +33,7 @@ buildHead( child: user.thumbnail_dp == null ? Center( child: Text( - user.username.characters + user.username!.characters .characterAt(0) .toString() .toUpperCase(), @@ -53,7 +53,7 @@ buildHead( bottomRight: Radius.circular(40), ), child: CachedNetworkImage( - imageUrl: userdpURL + user.thumbnail_dp, + imageUrl: userdpURL + user.thumbnail_dp!, imageBuilder: (context, imageProvider) => Image( height: 70, width: 70, @@ -73,7 +73,7 @@ buildHead( ), child: Center( child: Text( - user.firstname + " " + user.lastname, + user.firstname! + " " + user.lastname!, style: TextStyle( fontWeight: FontWeight.bold, ), @@ -87,7 +87,7 @@ buildHead( bottom: 10, ), child: Text( - user.description != null ? user.description : "", + user.description != null ? user.description! : "", textAlign: TextAlign.center, style: TextStyle( fontSize: 12, diff --git a/lib/Pages/PageWidgets/WalkIn Coupons/ActiveDiscount.dart b/lib/Pages/PageWidgets/WalkIn Coupons/ActiveDiscount.dart index 44e1482..bc71eb1 100644 --- a/lib/Pages/PageWidgets/WalkIn Coupons/ActiveDiscount.dart +++ b/lib/Pages/PageWidgets/WalkIn Coupons/ActiveDiscount.dart @@ -13,7 +13,7 @@ buildActiveDiscountCoupon( double cardWidth, BuildContext context, ) { - img.productCost = img.targetProduct.unitPrice; + img.productCost = img.targetProduct!.unitPrice; return Container( width: (MediaQuery.of(context).size.width * 0.80) - cardWidth, height: MediaQuery.of(context).size.height * 0.68, @@ -32,14 +32,14 @@ buildActiveDiscountCoupon( InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.issuer.businessId; + head.businessId = img.issuer!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; head.upper = img.upperLimit; head.quantity = img.quantity; head.state = img.state; - head.targetProduct = img.targetProduct.productID; + head.targetProduct = img.targetProduct!.productID; head.type = img.type; await Provider.of(context, listen: false) .viewCoupon(head); @@ -82,7 +82,7 @@ buildActiveDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -132,7 +132,7 @@ buildActiveDiscountCoupon( child: Column( children: [ Text( - img.issuer.businessName.toUpperCase(), + img.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.white, fontSize: 18, @@ -171,7 +171,7 @@ buildActiveDiscountCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetProduct.unitPrice.toString(), + img.targetProduct!.unitPrice.toString(), style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, @@ -179,8 +179,8 @@ buildActiveDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetProduct.unitPrice * - (img.lowerLimit / 100)) + (img.targetProduct!.unitPrice! * + (img.lowerLimit! / 100)) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -198,7 +198,7 @@ buildActiveDiscountCoupon( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetProduct.productName.toUpperCase(), + img.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -231,8 +231,8 @@ buildActiveDiscountCoupon( Container( child: Text( "Price : GH¢ " + - (img.targetProduct.unitPrice * - (img.lowerLimit / 100)) + (img.targetProduct!.unitPrice! * + (img.lowerLimit! / 100)) .toStringAsFixed(2) + " only", style: TextStyle( @@ -245,7 +245,7 @@ buildActiveDiscountCoupon( ? Container() : Container( child: Text( - "Condition : " + img.condition, + "Condition : " + img.condition!, ), ), ], diff --git a/lib/Pages/PageWidgets/WalkIn Coupons/ActiveFreebie.dart b/lib/Pages/PageWidgets/WalkIn Coupons/ActiveFreebie.dart index aba4676..2169600 100644 --- a/lib/Pages/PageWidgets/WalkIn Coupons/ActiveFreebie.dart +++ b/lib/Pages/PageWidgets/WalkIn Coupons/ActiveFreebie.dart @@ -11,7 +11,7 @@ import 'package:teso/Pages/Sub_Pages/@Generic/RedeemingCoupon.dart'; buildActiveFreebieCoupon( CouponDetails img, double cardWidth, BuildContext context) { - img.productCost = img.targetProduct.unitPrice; + img.productCost = img.targetProduct!.unitPrice; return Container( width: (MediaQuery.of(context).size.width * 0.80) - cardWidth, height: MediaQuery.of(context).size.height * 0.68, @@ -22,14 +22,14 @@ buildActiveFreebieCoupon( InkWell( onTap: () async { CouponsHead head = new CouponsHead(); - head.businessId = img.issuer.businessId; + head.businessId = img.issuer!.businessId; head.couponId = img.couponId; head.expiration = img.expiration; head.lower = img.lowerLimit; head.upper = img.upperLimit; head.quantity = img.quantity; head.state = img.state; - head.targetProduct = img.targetProduct.productID; + head.targetProduct = img.targetProduct!.productID; head.type = img.type; await Provider.of(context, listen: false) .viewCoupon(head); @@ -107,7 +107,7 @@ buildActiveFreebieCoupon( child: Column( children: [ Text( - img.issuer.businessName.toUpperCase(), + img.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.black, fontSize: 18, @@ -148,7 +148,7 @@ buildActiveFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetProduct.unitPrice + img.targetProduct!.unitPrice! .toStringAsFixed(2), style: TextStyle( color: Colors.black, @@ -173,7 +173,7 @@ buildActiveFreebieCoupon( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetProduct.productName.toUpperCase(), + img.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -216,7 +216,7 @@ buildActiveFreebieCoupon( ? Container() : Container( child: Text( - "Condition : " + img.condition, + "Condition : " + img.condition!, ), ), ], diff --git a/lib/Pages/PageWidgets/WalkIn Coupons/DummyDiscount.dart b/lib/Pages/PageWidgets/WalkIn Coupons/DummyDiscount.dart index fc3c9fe..c41d0e7 100644 --- a/lib/Pages/PageWidgets/WalkIn Coupons/DummyDiscount.dart +++ b/lib/Pages/PageWidgets/WalkIn Coupons/DummyDiscount.dart @@ -13,7 +13,7 @@ Positioned buildDummyDiscountCoupon( BuildContext context, String discount, double selectedDiscount) { - img.productCost = img.targetProduct.unitPrice; + img.productCost = img.targetProduct!.unitPrice; return new Positioned( bottom: 100.0 + bottom, child: Container( @@ -34,7 +34,7 @@ Positioned buildDummyDiscountCoupon( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, - image: img.upperLimit < 50.1 + image: img.upperLimit! < 50.1 ? DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/blue.png"), @@ -82,7 +82,7 @@ Positioned buildDummyDiscountCoupon( child: Column( children: [ Text( - img.issuer.businessName.toUpperCase(), + img.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.white, fontSize: 18, @@ -121,7 +121,7 @@ Positioned buildDummyDiscountCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetProduct.unitPrice.toString(), + img.targetProduct!.unitPrice.toString(), style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, @@ -129,8 +129,8 @@ Positioned buildDummyDiscountCoupon( ), Text( "DISCOUNTED PRICE : GH¢ " + - (img.targetProduct.unitPrice * - (img.lowerLimit / 100)) + (img.targetProduct!.unitPrice! * + (img.lowerLimit! / 100)) .toStringAsFixed(2), style: TextStyle( color: Colors.white, @@ -147,7 +147,7 @@ Positioned buildDummyDiscountCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetProduct.productName.toUpperCase(), + img.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -180,8 +180,8 @@ Positioned buildDummyDiscountCoupon( Container( child: Text( "Price : GH¢ " + - (img.targetProduct.unitPrice * - (img.lowerLimit / 100)) + (img.targetProduct!.unitPrice! * + (img.lowerLimit! / 100)) .toStringAsFixed(2) + " only", style: TextStyle( @@ -194,7 +194,7 @@ Positioned buildDummyDiscountCoupon( ? Container() : Container( child: Text( - "Condition : " + img.condition, + "Condition : " + img.condition!, ), ), ], diff --git a/lib/Pages/PageWidgets/WalkIn Coupons/DummyFreebie.dart b/lib/Pages/PageWidgets/WalkIn Coupons/DummyFreebie.dart index f084969..5115a80 100644 --- a/lib/Pages/PageWidgets/WalkIn Coupons/DummyFreebie.dart +++ b/lib/Pages/PageWidgets/WalkIn Coupons/DummyFreebie.dart @@ -14,7 +14,7 @@ Positioned buildDummyFreebieCoupon( BuildContext context, String discount, double selectedDiscount) { - img.productCost = img.targetProduct.unitPrice; + img.productCost = img.targetProduct!.unitPrice; return new Positioned( bottom: 80.0 + bottom, child: Container( @@ -74,7 +74,7 @@ Positioned buildDummyFreebieCoupon( child: Column( children: [ Text( - img.issuer.businessName.toUpperCase(), + img.issuer!.businessName!.toUpperCase(), style: TextStyle( color: Colors.black, fontSize: 18, @@ -114,7 +114,7 @@ Positioned buildDummyFreebieCoupon( children: [ Text( "ORIGINAL PRICE : GH¢ " + - img.targetProduct.unitPrice.toStringAsFixed(2), + img.targetProduct!.unitPrice!.toStringAsFixed(2), style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -137,7 +137,7 @@ Positioned buildDummyFreebieCoupon( margin: EdgeInsets.symmetric( vertical: MediaQuery.of(context).size.width * 0.15), child: Text( - img.targetProduct.productName.toUpperCase(), + img.targetProduct!.productName!.toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.black, @@ -180,7 +180,7 @@ Positioned buildDummyFreebieCoupon( ? Container() : Container( child: Text( - "Condition : " + img.condition, + "Condition : " + img.condition!, ), ), ], diff --git a/lib/Pages/Personnal.dart b/lib/Pages/Personnal.dart index ab752aa..83d4677 100644 --- a/lib/Pages/Personnal.dart +++ b/lib/Pages/Personnal.dart @@ -12,7 +12,7 @@ import 'package:provider/provider.dart'; class Personnal extends StatefulWidget { final Function showSettings; - const Personnal({Key key, this.showSettings}) : super(key: key); + const Personnal({Key? key, required this.showSettings}) : super(key: key); @override _PersonnalState createState() => _PersonnalState(showSettings: this.showSettings); @@ -21,35 +21,35 @@ class Personnal extends StatefulWidget { enum AppBarBehavior { normal, pinned, floating, snapping } class _PersonnalState extends State with TickerProviderStateMixin { - TesoUser currentUser; + TesoUser? currentUser; Function showSettings; - double scale; - _PersonnalState({this.showSettings}); - double _appBarHeightSpecial = 275.0; + double? scale; + _PersonnalState({required this.showSettings}); + double _appBarHeightSpecial = 270.0; RefreshController _refreshController = RefreshController(initialRefresh: false); - TabController tabsController; + TabController? tabsController; Widget _randomHeightWidgets(BuildContext context) { return Consumer( - builder: (BuildContext context, UserProvider user, Widget child) { + builder: (BuildContext context, UserProvider user, Widget? child) { user.getCurrentUser(); currentUser = user.currentUser; if (user.currentUser == null || currentUser == null) { return Container(); } else { - String dp = userdpURL + currentUser.thumbnail_dp; + String dp = userdpURL + currentUser!.thumbnail_dp!; return buildProfileHeader( context, - currentUser.gold, - currentUser.silver, - currentUser.username, + currentUser!.gold!, + currentUser!.silver!, + currentUser!.username, dp, - user.friends != null + user.friends.isNotEmpty ? user.friends.length.toString() - : currentUser.friends, - currentUser.firstname + " " + currentUser.lastname, + : currentUser!.friends!, + currentUser!.firstname! + " " + currentUser!.lastname!, _appBarHeightSpecial); } }); @@ -58,7 +58,7 @@ class _PersonnalState extends State with TickerProviderStateMixin { void _onRefresh() async { Provider.of(context, listen: false).getUserInformation(); - switch (tabsController.index) { + switch (tabsController!.index) { case 0: Provider.of(context, listen: false).loadFriends(); Provider.of(context, listen: false).getCoupons(); @@ -81,7 +81,7 @@ class _PersonnalState extends State with TickerProviderStateMixin { @override void dispose() { - tabsController.dispose(); + tabsController!.dispose(); _refreshController.dispose(); super.dispose(); } @@ -101,12 +101,12 @@ class _PersonnalState extends State with TickerProviderStateMixin { automaticallyImplyLeading: false, title: Consumer( builder: - (BuildContext context, UserProvider user, Widget child) { + (BuildContext context, UserProvider user, Widget? child) { currentUser = user.currentUser; if (user.currentUser == null || currentUser == null) { return Container(); } else { - return Text(user.currentUser.username, + return Text(user.currentUser!.username!, style: TextStyle( color: Theme.of(context).primaryColorLight, )); diff --git a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/PictureReview.dart b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/PictureReview.dart index 7b27dfc..f5f452f 100644 --- a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/PictureReview.dart +++ b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/PictureReview.dart @@ -4,7 +4,7 @@ import 'dart:io'; class PictureReview extends StatefulWidget { final image; - const PictureReview({Key key, this.image}) : super(key: key); + const PictureReview({Key? key, this.image}) : super(key: key); @override _PictureReviewState createState() => _PictureReviewState(); } diff --git a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakeDP.dart b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakeDP.dart index 973cd92..38d86fc 100644 --- a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakeDP.dart +++ b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakeDP.dart @@ -8,29 +8,29 @@ import 'package:image_picker/image_picker.dart'; class TakeDP extends StatefulWidget { List connectedCameras; - TakeDP({Key key, this.connectedCameras}) : super(key: key); + TakeDP({Key? key, required this.connectedCameras}) : super(key: key); @override _TakeDPState createState() => _TakeDPState(); } class _TakeDPState extends State with TickerProviderStateMixin { - CameraController _controller; + CameraController? _controller; int selectedCamera = 0; bool flash = false; bool frontFlash = false; double _currentScale = 1.0; double _baseScale = 1.0; - double _minAvailableZoom; - double _maxAvailableZoom; + late double _minAvailableZoom; + late double _maxAvailableZoom; int _pointers = 0; final picker = ImagePicker(); setCamera(int camera) async { _controller = CameraController(widget.connectedCameras[camera], ResolutionPreset.max); - _controller.initialize().then((_) { - _controller.setFocusMode(FocusMode.auto); + _controller!.initialize().then((_) { + _controller!.setFocusMode(FocusMode.auto); if (!mounted) { return; } @@ -43,14 +43,14 @@ class _TakeDPState extends State with TickerProviderStateMixin { details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); - _controller.setExposurePoint(offset); - _controller.setFocusPoint(offset); + _controller!.setExposurePoint(offset); + _controller!.setFocusPoint(offset); } @override void initState() { - if (widget.connectedCameras == null || - widget.connectedCameras.length == 0) { + if + (widget.connectedCameras.length == 0) { availableCameras().then((value) { widget.connectedCameras = value; setCamera(0); @@ -64,9 +64,9 @@ class _TakeDPState extends State with TickerProviderStateMixin { sayCheese() async { try { - final image = await _controller.takePicture(); + final image = await _controller!.takePicture(); - if (image != null) Navigator.pop(context, image); + Navigator.pop(context, image); } catch (e) { print(e); } @@ -85,7 +85,7 @@ class _TakeDPState extends State with TickerProviderStateMixin { _currentScale = (_baseScale * details.scale) .clamp(_minAvailableZoom, _maxAvailableZoom); - await _controller.setZoomLevel(_currentScale); + await _controller!.setZoomLevel(_currentScale); } @override @@ -96,7 +96,7 @@ class _TakeDPState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - if (_controller == null || !_controller.value.isInitialized) { + if (_controller == null || !_controller!.value.isInitialized) { return Container(); } else { return Scaffold( @@ -114,9 +114,9 @@ class _TakeDPState extends State with TickerProviderStateMixin { child: InkWell( onTap: () { if (flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.off); + _controller!.setFlashMode(FlashMode.off); setState(() { flash = false; }); @@ -153,23 +153,23 @@ class _TakeDPState extends State with TickerProviderStateMixin { onTap: () { try { if (!flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.torch); + _controller!.setFlashMode(FlashMode.torch); setState(() { flash = true; }); } else if (!flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.front) { setState(() { flash = true; frontFlash = true; }); } else if (flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.off); + _controller!.setFlashMode(FlashMode.off); setState(() { flash = false; }); @@ -288,7 +288,7 @@ class _TakeDPState extends State with TickerProviderStateMixin { } Widget cameraWidget(context) { - var camera = _controller.value; + var camera = _controller!.value; final size = MediaQuery.of(context).size; var scale = size.aspectRatio * camera.aspectRatio; if (scale < 1) scale = 1 / scale; @@ -297,7 +297,7 @@ class _TakeDPState extends State with TickerProviderStateMixin { scale: scale, child: Center( child: CameraPreview( - _controller, + _controller!, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return GestureDetector( diff --git a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakePicture.dart b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakePicture.dart index 04cff91..73efcc7 100644 --- a/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakePicture.dart +++ b/lib/Pages/Sub_Pages/@Generic/Camera/Picture/TakePicture.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:camera/camera.dart'; @@ -9,9 +11,9 @@ import 'dart:io'; // ignore: must_be_immutable class TakePicture extends StatefulWidget { - List connectedCameras; + List? connectedCameras; - TakePicture({Key key, this.connectedCameras}) : super(key: key); + TakePicture({Key? key, this.connectedCameras}) : super(key: key); @override _TakePictureState createState() => _TakePictureState(); @@ -19,22 +21,22 @@ class TakePicture extends StatefulWidget { class _TakePictureState extends State with TickerProviderStateMixin { - CameraController _controller; + CameraController? _controller; int selectedCamera = 0; bool flash = false; bool frontFlash = false; double _currentScale = 1.0; double _baseScale = 1.0; - double _minAvailableZoom; - double _maxAvailableZoom; + late double _minAvailableZoom; + late double _maxAvailableZoom; int _pointers = 0; final picker = ImagePicker(); setCamera(int camera) async { _controller = - CameraController(widget.connectedCameras[camera], ResolutionPreset.max); - _controller.initialize().then((_) { - _controller.setFocusMode(FocusMode.auto); + CameraController(widget.connectedCameras![camera], ResolutionPreset.max); + _controller!.initialize().then((_) { + _controller!.setFocusMode(FocusMode.auto); if (!mounted) { return; } @@ -47,14 +49,14 @@ class _TakePictureState extends State details.localPosition.dx / constraints.maxWidth, details.localPosition.dy / constraints.maxHeight, ); - _controller.setExposurePoint(offset); - _controller.setFocusPoint(offset); + _controller!.setExposurePoint(offset); + _controller!.setFocusPoint(offset); } @override void initState() { if (widget.connectedCameras == null || - widget.connectedCameras.length == 0) { + widget.connectedCameras!.length == 0) { availableCameras().then((value) { widget.connectedCameras = value; }); @@ -68,17 +70,17 @@ class _TakePictureState extends State sayCheese() async { try { - final image = await _controller.takePicture(); + final image = await _controller!.takePicture(); - bool result = false; - result = await Navigator.push( + bool? result = false; + result = await (Navigator.push( context, PageTransition( type: PageTransitionType.leftToRight, child: PictureReview( image: image.path, ), - )); + )) as FutureOr); if (result) Navigator.pop(context, image); } catch (e) { @@ -99,7 +101,7 @@ class _TakePictureState extends State _currentScale = (_baseScale * details.scale) .clamp(_minAvailableZoom, _maxAvailableZoom); - await _controller.setZoomLevel(_currentScale); + await _controller!.setZoomLevel(_currentScale); } @override @@ -110,7 +112,7 @@ class _TakePictureState extends State @override Widget build(BuildContext context) { - if (_controller == null || !_controller.value.isInitialized) { + if (_controller == null || !_controller!.value.isInitialized) { return Container(); } else { return Scaffold( @@ -137,9 +139,9 @@ class _TakePictureState extends State child: InkWell( onTap: () { if (flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.off); + _controller!.setFlashMode(FlashMode.off); setState(() { flash = false; }); @@ -150,7 +152,7 @@ class _TakePictureState extends State }); } selectedCamera++; - if (selectedCamera < widget.connectedCameras.length) { + if (selectedCamera < widget.connectedCameras!.length) { setCamera(selectedCamera); } else { selectedCamera = 0; @@ -176,23 +178,23 @@ class _TakePictureState extends State onTap: () { try { if (!flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.torch); + _controller!.setFlashMode(FlashMode.torch); setState(() { flash = true; }); } else if (!flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.front) { setState(() { flash = true; frontFlash = true; }); } else if (flash && - _controller.description.lensDirection == + _controller!.description.lensDirection == CameraLensDirection.back) { - _controller.setFlashMode(FlashMode.off); + _controller!.setFlashMode(FlashMode.off); setState(() { flash = false; }); @@ -291,7 +293,7 @@ class _TakePictureState extends State if (pickedFile != null) { final image = File(pickedFile.path); - bool result; + bool? result; result = await Navigator.push( context, PageTransition( @@ -301,7 +303,7 @@ class _TakePictureState extends State ), )); - if (result) Navigator.pop(context, image); + if (result!) Navigator.pop(context, image); } else { print('No image selected.'); } @@ -309,7 +311,7 @@ class _TakePictureState extends State } Widget cameraWidget(context) { - var camera = _controller.value; + var camera = _controller!.value; final size = MediaQuery.of(context).size; var scale = size.aspectRatio * camera.aspectRatio; if (scale < 1) scale = 1 / scale; @@ -318,7 +320,7 @@ class _TakePictureState extends State scale: scale, child: Center( child: CameraPreview( - _controller, + _controller!, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return GestureDetector( diff --git a/lib/Pages/Sub_Pages/@Generic/Error.dart b/lib/Pages/Sub_Pages/@Generic/Error.dart index b9c584e..7856482 100644 --- a/lib/Pages/Sub_Pages/@Generic/Error.dart +++ b/lib/Pages/Sub_Pages/@Generic/Error.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; class ErrorPage extends StatefulWidget { - final String error; + final String? error; - const ErrorPage({Key key, this.error}) : super(key: key); + const ErrorPage({Key? key, this.error}) : super(key: key); @override _ErrorPageState createState() => _ErrorPageState(); } @@ -14,7 +14,7 @@ class _ErrorPageState extends State { return Scaffold( body: Center( child: Text( - widget.error, + widget.error!, ), ), ); diff --git a/lib/Pages/Sub_Pages/@Generic/ProductImage.dart b/lib/Pages/Sub_Pages/@Generic/ProductImage.dart index 12ed3f8..1fe1e66 100644 --- a/lib/Pages/Sub_Pages/@Generic/ProductImage.dart +++ b/lib/Pages/Sub_Pages/@Generic/ProductImage.dart @@ -8,7 +8,7 @@ class ProductImage extends StatefulWidget { final productTag; final productImageSRC; const ProductImage( - {Key key, @required this.productTag, @required this.productImageSRC}) + {Key? key, required this.productTag, required this.productImageSRC}) : super(key: key); @override diff --git a/lib/Pages/Sub_Pages/@Generic/RedeemingCoupon.dart b/lib/Pages/Sub_Pages/@Generic/RedeemingCoupon.dart index 964007b..d1e09a6 100644 --- a/lib/Pages/Sub_Pages/@Generic/RedeemingCoupon.dart +++ b/lib/Pages/Sub_Pages/@Generic/RedeemingCoupon.dart @@ -8,7 +8,7 @@ import 'package:teso/providers/user_provider.dart'; class RedeemingCoupon extends StatefulWidget { final CouponDetails couponDetails; - const RedeemingCoupon({Key key, @required this.couponDetails}) + const RedeemingCoupon({Key? key, required this.couponDetails}) : super(key: key); @override _RedeemingCouponState createState() => _RedeemingCouponState(); diff --git a/lib/Pages/Sub_Pages/@Generic/SuccessRedeem.dart b/lib/Pages/Sub_Pages/@Generic/SuccessRedeem.dart index 0546a47..e8fbc28 100644 --- a/lib/Pages/Sub_Pages/@Generic/SuccessRedeem.dart +++ b/lib/Pages/Sub_Pages/@Generic/SuccessRedeem.dart @@ -7,11 +7,11 @@ import 'package:teso/util/consts.dart'; class SuccessfullyRedeemed extends StatefulWidget { final CouponDetails couponDetails; - final int returns; + final int? returns; const SuccessfullyRedeemed({ - Key key, - @required this.couponDetails, + Key? key, + required this.couponDetails, this.returns, }) : super(key: key); @override @@ -67,7 +67,7 @@ class _SuccessfullyRedeemedState extends State { child: CachedNetworkImage( imageUrl: widget.couponDetails.targetProduct != null ? productURL + - widget.couponDetails.targetProduct.productImage + widget.couponDetails.targetProduct!.productImage! : "", imageBuilder: (context, imageProvider) => Image( width: MediaQuery.of(context).size.width * 0.28, @@ -100,7 +100,7 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: widget.couponDetails.targetProduct.productID), + text: widget.couponDetails.targetProduct!.productID), ], ), ), @@ -126,7 +126,7 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: widget.couponDetails.targetProduct.productName), + text: widget.couponDetails.targetProduct!.productName), ], ), ), @@ -152,7 +152,7 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: widget.couponDetails.issuer.businessName), + text: widget.couponDetails.issuer!.businessName), ], ), ), @@ -228,7 +228,7 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: (widget.couponDetails.productCost) + text: widget.couponDetails.productCost! .toStringAsFixed(2)), ], ), @@ -255,8 +255,8 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: ((widget.couponDetails.productCost * - (widget.couponDetails.worth / 100))) + text: (widget.couponDetails.productCost! * + (widget.couponDetails.worth! / 100)) .toStringAsFixed(2), style: new TextStyle( color: Colors.green, @@ -311,9 +311,9 @@ class _SuccessfullyRedeemedState extends State { ), ), new TextSpan( - text: (widget.couponDetails.productCost - - (widget.couponDetails.productCost * - (widget.couponDetails.worth / 100))) + text: (widget.couponDetails.productCost! - + (widget.couponDetails.productCost! * + (widget.couponDetails.worth! / 100))) .toStringAsFixed(2), style: new TextStyle( color: Colors.red, diff --git a/lib/Pages/Sub_Pages/@Generic/productDetails.dart b/lib/Pages/Sub_Pages/@Generic/productDetails.dart index 02fd7a3..efb9e7f 100644 --- a/lib/Pages/Sub_Pages/@Generic/productDetails.dart +++ b/lib/Pages/Sub_Pages/@Generic/productDetails.dart @@ -14,9 +14,9 @@ import 'dart:convert'; import 'ProductImage.dart'; class ProductDetails extends StatefulWidget { - final Product product; + final Product? product; - const ProductDetails({Key key, this.product}) : super(key: key); + const ProductDetails({Key? key, this.product}) : super(key: key); @override _ProductDetailsState createState() => _ProductDetailsState(); } @@ -25,25 +25,25 @@ enum AppBarBehavior { normal, pinned, floating, snapping } class _ProductDetailsState extends State with TickerProviderStateMixin { - AnimationController _containerController; - Animation width; - Animation heigth; + late AnimationController _containerController; + late Animation width; + late Animation heigth; double _appBarHeight = 256.0; AppBarBehavior _appBarBehavior = AppBarBehavior.pinned; - List coupons; + List? coupons; int number = 0; var _future; - Future> getProductCoupons() async { + Future?> getProductCoupons() async { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'coupons/productCoupon'; var client1 = await http.post(Uri.parse(register2), - body: json.encode(widget.product.productID), headers: requestHeaders); + body: json.encode(widget.product!.productID), headers: requestHeaders); if (client1.statusCode == 200) { try { @@ -51,7 +51,7 @@ class _ProductDetailsState extends State coupons = List.from( details.map((model) => CouponDetails.fromJSON(model)).toList()); setState(() { - number = coupons.length; + number = coupons!.length; }); return coupons; } catch (e) { @@ -163,9 +163,9 @@ class _ProductDetailsState extends State Navigator.push(context, MaterialPageRoute(builder: (context) { return ProductImage( - productTag: widget.product.productID, + productTag: widget.product!.productID, productImageSRC: - widget.product.productImage, + widget.product!.productImage, ); })); }, @@ -173,10 +173,10 @@ class _ProductDetailsState extends State width: width.value, height: _appBarHeight, child: Hero( - tag: widget.product.productID, + tag: widget.product!.productID!, child: CachedNetworkImage( imageUrl: tesoProductThumbnail( - productLogo: widget.product.productImage, + productLogo: widget.product!.productImage, width: 640, height: 640, ), @@ -222,7 +222,7 @@ class _ProductDetailsState extends State children: [ new Center( child: new Text( - widget.product.productName + widget.product!.productName! .toUpperCase(), style: TextStyle( fontWeight: FontWeight.bold, @@ -249,7 +249,7 @@ class _ProductDetailsState extends State padding: const EdgeInsets.all(8.0), child: new Text("GH¢ " + - widget.product.unitPrice + widget.product!.unitPrice .toString()), ) ], @@ -297,10 +297,10 @@ class _ProductDetailsState extends State new Padding( padding: const EdgeInsets.all(8.0), - child: new Text(widget.product + child: new Text(widget.product! .businessID != null - ? widget.product.businessID + ? widget.product!.businessID! .toUpperCase() : ""), ) @@ -320,8 +320,8 @@ class _ProductDetailsState extends State ), ), new Text( - widget.product.productDesc != null - ? widget.product.productDesc + widget.product!.productDesc != null + ? widget.product!.productDesc! : "", style: TextStyle( fontSize: diff --git a/lib/Pages/Sub_Pages/@Generic/prominentDisclosure.dart b/lib/Pages/Sub_Pages/@Generic/prominentDisclosure.dart index 9558af6..88f3b58 100644 --- a/lib/Pages/Sub_Pages/@Generic/prominentDisclosure.dart +++ b/lib/Pages/Sub_Pages/@Generic/prominentDisclosure.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:teso/util/SizeConfig.dart'; class ProminentDisclosure extends StatefulWidget { - const ProminentDisclosure({Key key}) : super(key: key); + const ProminentDisclosure({Key? key}) : super(key: key); @override _ProminentDisclosureState createState() => _ProminentDisclosureState(); diff --git a/lib/Pages/Sub_Pages/@Generic/prominentDisclosureBackground.dart b/lib/Pages/Sub_Pages/@Generic/prominentDisclosureBackground.dart index d4adbad..72f0302 100644 --- a/lib/Pages/Sub_Pages/@Generic/prominentDisclosureBackground.dart +++ b/lib/Pages/Sub_Pages/@Generic/prominentDisclosureBackground.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:teso/util/SizeConfig.dart'; class ProminentDisclosure extends StatefulWidget { - const ProminentDisclosure({Key key}) : super(key: key); + const ProminentDisclosure({Key? key}) : super(key: key); @override _ProminentDisclosureState createState() => _ProminentDisclosureState(); diff --git a/lib/Pages/Sub_Pages/AccountSettings/BlockedUser.dart b/lib/Pages/Sub_Pages/AccountSettings/BlockedUser.dart index c2a31e3..0282ae3 100644 --- a/lib/Pages/Sub_Pages/AccountSettings/BlockedUser.dart +++ b/lib/Pages/Sub_Pages/AccountSettings/BlockedUser.dart @@ -9,7 +9,7 @@ import 'package:teso/util/SizeConfig.dart'; import 'package:teso/util/consts.dart'; class BlockAccounts extends StatefulWidget { - const BlockAccounts({Key key}) : super(key: key); + const BlockAccounts({Key? key}) : super(key: key); @override _BlockAccountsState createState() => _BlockAccountsState(); @@ -51,7 +51,7 @@ class _BlockAccountsState extends State { ), body: Consumer( builder: (context, value, child) { - if (value.blockUserList == null) { + if (value.blockUserList.isEmpty) { return Center( child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation( diff --git a/lib/Pages/Sub_Pages/AccountSettings/changePassword.dart b/lib/Pages/Sub_Pages/AccountSettings/changePassword.dart index 7d21c94..d378a9e 100644 --- a/lib/Pages/Sub_Pages/AccountSettings/changePassword.dart +++ b/lib/Pages/Sub_Pages/AccountSettings/changePassword.dart @@ -29,7 +29,7 @@ class _ChangePasswordState extends State { Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'users/verifypassword'; diff --git a/lib/Pages/Sub_Pages/AccountSettings/genderPicker.dart b/lib/Pages/Sub_Pages/AccountSettings/genderPicker.dart index b643ac7..aae20da 100644 --- a/lib/Pages/Sub_Pages/AccountSettings/genderPicker.dart +++ b/lib/Pages/Sub_Pages/AccountSettings/genderPicker.dart @@ -5,15 +5,15 @@ import 'package:teso/providers/user_provider.dart'; import 'package:provider/provider.dart'; class Gender extends StatefulWidget { - final int value; + final int? value; - const Gender({Key key, this.value}) : super(key: key); + const Gender({Key? key, this.value}) : super(key: key); @override _GenderState createState() => _GenderState(value: this.value); } class _GenderState extends State { - int value; + int? value; _GenderState({this.value}); List genders = ["Male", "Female", "Other"]; bool light = true; @@ -54,8 +54,8 @@ class _GenderState extends State { ), onPressed: () { Provider.of(context, listen: false) - .currentUser - .gender = genders[value]; + .currentUser! + .gender = genders[value!]; Navigator.of(context).pop(value); }, child: Text("Done"), @@ -73,7 +73,7 @@ class _GenderState extends State { ListTile( title: Text( genders[i], - style: Theme.of(context).textTheme.subtitle1.copyWith( + style: Theme.of(context).textTheme.subtitle1!.copyWith( color: light ? i == 3 ? Colors.black38 @@ -89,7 +89,7 @@ class _GenderState extends State { activeColor: accentMain, onChanged: i == 3 ? null - : (int _value) { + : (int? _value) { setState(() { value = _value; }); diff --git a/lib/Pages/Sub_Pages/AccountSettings/newPassword.dart b/lib/Pages/Sub_Pages/AccountSettings/newPassword.dart index 4951d6f..fa6a24c 100644 --- a/lib/Pages/Sub_Pages/AccountSettings/newPassword.dart +++ b/lib/Pages/Sub_Pages/AccountSettings/newPassword.dart @@ -16,8 +16,8 @@ class CreateNewPassword extends StatefulWidget { class _CreateNewPasswordState extends State with TickerProviderStateMixin { TextEditingController password = new TextEditingController(); - AnimationController _controller; - Animation _fabScale; + late AnimationController _controller; + late Animation _fabScale; bool eightChars = false; bool specialChar = false; bool upperCaseChar = false; @@ -38,7 +38,7 @@ class _CreateNewPasswordState extends State Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'users/changepassword'; @@ -220,7 +220,7 @@ class _CreateNewPasswordState extends State ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/Business/BusinessProducts.dart b/lib/Pages/Sub_Pages/Business/BusinessProducts.dart index 7aee8ad..091700e 100644 --- a/lib/Pages/Sub_Pages/Business/BusinessProducts.dart +++ b/lib/Pages/Sub_Pages/Business/BusinessProducts.dart @@ -5,9 +5,9 @@ import 'package:teso/Classes/API Clasess/Product.dart'; import 'package:teso/Pages/PageWidgets/BusinessProfile/BusinessItems.dart'; class BusinessProducts extends StatefulWidget { - final String shopName; - final List product; - const BusinessProducts({Key key, this.shopName, this.product}) + final String? shopName; + final List? product; + const BusinessProducts({Key? key, this.shopName, this.product}) : super(key: key); @override @@ -16,13 +16,13 @@ class BusinessProducts extends StatefulWidget { } class _BusinessProductsState extends State { - final String shopName; - ScrollController _controller; - SharedPreferences prefs; - final List product; + final String? shopName; + late ScrollController _controller; + SharedPreferences? prefs; + final List? product; List show = []; _BusinessProductsState({this.shopName, this.product}); - int count; + int count = 0; void _scrollListener() { if (_controller.offset >= _controller.position.maxScrollExtent && !_controller.position.outOfRange) { @@ -35,7 +35,7 @@ class _BusinessProductsState extends State { count = show.length; for (int i = 1; i <= 5; i++) { setState(() { - show.add(product.elementAt(count)); + show.add(product!.elementAt(count)); count++; imageCache.clear(); }); diff --git a/lib/Pages/Sub_Pages/Business/BusinessProfile.dart b/lib/Pages/Sub_Pages/Business/BusinessProfile.dart index 68dd4e9..2df07c8 100644 --- a/lib/Pages/Sub_Pages/Business/BusinessProfile.dart +++ b/lib/Pages/Sub_Pages/Business/BusinessProfile.dart @@ -14,8 +14,8 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; class BusinessProfile extends StatefulWidget { - final TesoShop shop; - const BusinessProfile({Key key, this.shop}) : super(key: key); + final TesoShop? shop; + const BusinessProfile({Key? key, this.shop}) : super(key: key); @override _BusinessProfileState createState() => new _BusinessProfileState(shop: shop); } @@ -24,27 +24,27 @@ enum AppBarBehavior { normal, pinned, floating, snapping } class _BusinessProfileState extends State with TickerProviderStateMixin { - AnimationController _containerController; - Animation width; - Animation heigth; - final TesoShop shop; + late AnimationController _containerController; + Animation? width; + late Animation heigth; + final TesoShop? shop; _BusinessProfileState({this.shop}); - bool subscribed = false; - SharedPreferences prefs; + bool? subscribed = false; + late SharedPreferences prefs; var stats; int productTotal = 0; int adsTotal = 0; int couponsTotal = 0; - List products; - List coupons; - BusinessProfileClass profile; - List subscribers; + List? products; + List? coupons; + late BusinessProfileClass profile; + List? subscribers; - List _randomChildren; + List? _randomChildren; Future subscribe() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -52,7 +52,7 @@ class _BusinessProfileState extends State var register = serverLocation + 'relationships/business-subscription'; var client = await http.post(Uri.parse(register), - headers: requestHeaders, body: json.encode(shop.shopID)); + headers: requestHeaders, body: json.encode(shop!.shopID)); if (client.statusCode == 200) { setState(() { subscribed = true; @@ -64,7 +64,7 @@ class _BusinessProfileState extends State Future unsubscribe() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -72,7 +72,7 @@ class _BusinessProfileState extends State var register = serverLocation + 'relationships/business-unsubscribe'; var client = await http.post(Uri.parse(register), - headers: requestHeaders, body: json.encode(shop.shopID)); + headers: requestHeaders, body: json.encode(shop!.shopID)); if (client.statusCode == 200) { setState(() { subscribed = false; @@ -84,7 +84,7 @@ class _BusinessProfileState extends State fetchProfile() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -92,17 +92,17 @@ class _BusinessProfileState extends State var register = serverLocation + 'tesobusiness/profile'; var client = await http.post(Uri.parse(register), - headers: requestHeaders, body: json.encode(shop.shopID)); + headers: requestHeaders, body: json.encode(shop!.shopID)); if (client.statusCode == 200) { var details = jsonDecode(client.body); setState(() { profile = BusinessProfileClass.fromJSON(details); products = profile.products; coupons = profile.coupons; - couponsTotal = coupons.length; + couponsTotal = coupons!.length; subscribed = profile.subscribed; subscribers = profile.subscribers; - productTotal = products.length; + productTotal = products!.length; }); } else { return null; @@ -156,12 +156,12 @@ class _BusinessProfileState extends State super.dispose(); } - List _randomHeightWidgets(BuildContext context) { + List? _randomHeightWidgets(BuildContext context) { _randomChildren ??= List.generate(1, (index) { return buildHead( context: context, - shopSelected: shop, - subscribers: subscribers.length, + shopSelected: shop!, + subscribers: subscribers!.length, coupons: couponsTotal, products: productTotal); }); @@ -175,7 +175,7 @@ class _BusinessProfileState extends State backgroundColor: Colors.transparent, toolbarHeight: 50, automaticallyImplyLeading: false, - title: Text(shop.shopName.toUpperCase()), + title: Text(shop!.shopName!.toUpperCase()), leadingWidth: 40, leading: IconButton( icon: Icon(Icons.arrow_back_ios), @@ -199,12 +199,12 @@ class _BusinessProfileState extends State } else { return IconButton( icon: Icon( - subscribed + subscribed! ? Icons.notifications_active : Icons.notifications_none, ), onPressed: () async { - if (subscribed) { + if (subscribed!) { await unsubscribe(); } else { await subscribe(); @@ -236,7 +236,7 @@ class _BusinessProfileState extends State return [ SliverList( delegate: SliverChildListDelegate( - _randomHeightWidgets(context), + _randomHeightWidgets(context)!, ), ), ]; @@ -244,7 +244,7 @@ class _BusinessProfileState extends State body: TabBarView( children: [ BusinessProducts( - shopName: shop.shopName, + shopName: shop!.shopName, product: products, ), // BusinessPosts(), diff --git a/lib/Pages/Sub_Pages/BusinessDetails.dart b/lib/Pages/Sub_Pages/BusinessDetails.dart index 91f4a9b..6116ee5 100644 --- a/lib/Pages/Sub_Pages/BusinessDetails.dart +++ b/lib/Pages/Sub_Pages/BusinessDetails.dart @@ -17,7 +17,7 @@ buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { width: double.infinity, margin: EdgeInsets.symmetric(vertical: 2), child: Text( - shop.shopName, + shop.shopName!, style: TextStyle( fontSize: 25.0, fontWeight: FontWeight.w900, @@ -26,19 +26,19 @@ buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { Container( width: double.infinity, child: new Text( - shop.categoryShop, + shop.categoryShop!, ), ), Container( width: double.infinity, child: new Text( - shop.shopAddress, + shop.shopAddress!, ), ), new InkWell( onTap: () async { - if (await canLaunchUrlString("tel:" + shop.shopPhone)) { - await launchUrlString("tel:" + shop.shopPhone); + if (await canLaunchUrlString("tel:" + shop.shopPhone!)) { + await launchUrlString("tel:" + shop.shopPhone!); } else { throw 'call not possible'; } @@ -57,7 +57,7 @@ buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { ), Container( child: Text( - shop.shopPhone, + shop.shopPhone!, style: TextStyle( color: Colors.blue, ), @@ -112,8 +112,8 @@ buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { width: double.infinity, child: new Text( shop.shopDescription != null - ? shop.shopDescription.toLowerCase() != "null" - ? shop.shopDescription + ? shop.shopDescription!.toLowerCase() != "null" + ? shop.shopDescription! : "Registered Teso Business" : "Registered Teso Business", ), @@ -137,7 +137,7 @@ buildShopDetails(BuildContext context, TesoShop shop, Function navigate) { await navigate(shop); }, child: Text( - "Navigate to " + shop.shopName, + "Navigate to " + shop.shopName!, style: TextStyle( color: Colors.white, ), diff --git a/lib/Pages/Sub_Pages/CoinPurchase.dart b/lib/Pages/Sub_Pages/CoinPurchase.dart index 104ae06..6e6b241 100644 --- a/lib/Pages/Sub_Pages/CoinPurchase.dart +++ b/lib/Pages/Sub_Pages/CoinPurchase.dart @@ -8,13 +8,13 @@ import 'CoinsPurchase/SilverTransaction.dart'; class Coins extends StatefulWidget { final int initalPage; - const Coins({Key key, @required this.initalPage}) : super(key: key); + const Coins({Key? key, required this.initalPage}) : super(key: key); @override _CoinsState createState() => _CoinsState(); } class _CoinsState extends State { - PageController _pageController; + PageController? _pageController; Color goldText = Colors.white; Color silverText = tesoBlue; List gold = [ @@ -59,10 +59,10 @@ class _CoinsState extends State { void selectedPage(int pages) { if (pages == 0) { selectGold(); - _pageController.jumpToPage(0); + _pageController!.jumpToPage(0); } else { selectSilver(); - _pageController.jumpToPage(1); + _pageController!.jumpToPage(1); } } @@ -77,7 +77,7 @@ class _CoinsState extends State { @override void dispose() { super.dispose(); - _pageController.dispose(); + _pageController!.dispose(); } @override diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/GoldTransactions.dart b/lib/Pages/Sub_Pages/CoinsPurchase/GoldTransactions.dart index 0c968c7..f63608e 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/GoldTransactions.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/GoldTransactions.dart @@ -69,7 +69,7 @@ class _GoldTransactionsState extends State { child: Center( child: Text( value.currentUser != null - ? value.currentUser.gold + ? value.currentUser!.gold! : "00", style: TextStyle( fontSize: 20, diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/GoldWithdrawal.dart b/lib/Pages/Sub_Pages/CoinsPurchase/GoldWithdrawal.dart index 7b3b5b0..4c1a1f0 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/GoldWithdrawal.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/GoldWithdrawal.dart @@ -14,9 +14,9 @@ class GoldCoinWithdrawal extends StatefulWidget { class _GoldCoinWithdrawalState extends State { bool loading = false; - TextEditingController amount; - TextEditingController momoNumber; - String tapped; + TextEditingController? amount; + TextEditingController? momoNumber; + String? tapped; @override void initState() { @@ -38,8 +38,8 @@ class _GoldCoinWithdrawalState extends State { context, PageTransition( child: WithdrawalPage( - amount: amount.text, - momonumber: momoNumber.text, + amount: amount!.text, + momonumber: momoNumber!.text, provider: tapped, ), type: PageTransitionType.fade, diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/PurchaseingSilver.dart b/lib/Pages/Sub_Pages/CoinsPurchase/PurchaseingSilver.dart index 19f3c8c..f867286 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/PurchaseingSilver.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/PurchaseingSilver.dart @@ -18,14 +18,14 @@ class ProcessSilverPurchase extends StatefulWidget { final int silverAmount; final String method; final double cost; - final TesoUser user; + final TesoUser? user; const ProcessSilverPurchase({ - Key key, - @required this.user, - @required this.cost, - @required this.method, - @required this.silverAmount, + Key? key, + required this.user, + required this.cost, + required this.method, + required this.silverAmount, }) : super(key: key); @override _ProcessSilverPurchaseState createState() => _ProcessSilverPurchaseState(); @@ -47,7 +47,7 @@ class _ProcessSilverPurchaseState extends State { ); } else { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -67,7 +67,7 @@ class _ProcessSilverPurchaseState extends State { if (client.statusCode == 200) { var posts = jsonDecode(client.body); UserFinance finance = UserFinance.fromJSON(posts); - TesoUser user = widget.user; + TesoUser user = widget.user!; user.gold = finance.gold.toString(); user.silver = finance.silver.toString(); diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchase.dart b/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchase.dart index e2ef59f..bf27c65 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchase.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchase.dart @@ -10,16 +10,16 @@ class SilverPurchase extends StatefulWidget { } class _SilverPurchaseState extends State { - TextEditingController amount; - TextEditingController momoNumber; - String tapped; + TextEditingController? amount; + TextEditingController? momoNumber; + String? tapped; @override void initState() { amount = new TextEditingController(); momoNumber = new TextEditingController(); super.initState(); - amount.addListener(() { + amount!.addListener(() { setState(() {}); }); } @@ -121,7 +121,7 @@ class _SilverPurchaseState extends State { Visibility( visible: tapped != null && tapped != "goldcoins" && - amount.text.isNotEmpty + amount!.text.isNotEmpty ? true : false, child: Container( @@ -138,14 +138,14 @@ class _SilverPurchaseState extends State { Visibility( visible: tapped != null && tapped != "goldcoins" && - amount.text.isNotEmpty + amount!.text.isNotEmpty ? true : false, child: SizedBox(height: 10.0)), Visibility( visible: tapped != null && tapped != "goldcoins" && - amount.text.isNotEmpty + amount!.text.isNotEmpty ? true : false, child: Padding( @@ -155,7 +155,7 @@ class _SilverPurchaseState extends State { ), Visibility( visible: - tapped != null && amount.text.isNotEmpty ? true : false, + tapped != null && amount!.text.isNotEmpty ? true : false, child: new Container( margin: EdgeInsets.symmetric( vertical: 20.0, diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchaseFixed.dart b/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchaseFixed.dart index 975168e..911f0f6 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchaseFixed.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/SilverPurchaseFixed.dart @@ -9,20 +9,20 @@ import 'package:url_launcher/url_launcher_string.dart'; import 'PurchaseingSilver.dart'; class SilverPurchaseFixed extends StatefulWidget { - final String amount; - final String goldCost; - final String cashCost; - final TesoUser user; + final String? amount; + final String? goldCost; + final String? cashCost; + final TesoUser? user; const SilverPurchaseFixed( - {Key key, this.amount, this.goldCost, this.cashCost, this.user}) + {Key? key, this.amount, this.goldCost, this.cashCost, this.user}) : super(key: key); @override _SilverPurchaseFixedState createState() => _SilverPurchaseFixedState(); } class _SilverPurchaseFixedState extends State { - TextEditingController momoNumber; + TextEditingController? momoNumber; String tapped = "goldcoins"; @override @@ -128,6 +128,7 @@ class _SilverPurchaseFixedState extends State { ), SizedBox(height: 10.0), Visibility( + // ignore: unnecessary_null_comparison visible: tapped != null ? true : false, child: new Container( margin: EdgeInsets.symmetric( @@ -149,9 +150,9 @@ class _SilverPurchaseFixedState extends State { context, PageTransition( child: ProcessSilverPurchase( - cost: double.parse(widget.goldCost), + cost: double.parse(widget.goldCost!), method: tapped, - silverAmount: int.parse(widget.amount), + silverAmount: int.parse(widget.amount!), user: widget.user, ), type: PageTransitionType.leftToRight, @@ -159,7 +160,7 @@ class _SilverPurchaseFixedState extends State { ); } else { String _url = paymentServer + - "purchasesilver/user=${widget.user.userGUID}/amount=${widget.amount}/cointype=TESCNS01"; + "purchasesilver/user=${widget.user!.userGUID}/amount=${widget.amount}/cointype=TESCNS01"; await canLaunchUrlString(_url) ? await launchUrlString( _url, diff --git a/lib/Pages/Sub_Pages/CoinsPurchase/SilverTransaction.dart b/lib/Pages/Sub_Pages/CoinsPurchase/SilverTransaction.dart index 63eb378..b94f28e 100644 --- a/lib/Pages/Sub_Pages/CoinsPurchase/SilverTransaction.dart +++ b/lib/Pages/Sub_Pages/CoinsPurchase/SilverTransaction.dart @@ -82,7 +82,7 @@ class _SilverTransactionState extends State { child: Center( child: Text( value.currentUser != null - ? value.currentUser.silver + ? value.currentUser!.silver! : "00", style: TextStyle( fontSize: 20, diff --git a/lib/Pages/Sub_Pages/Coupons/Acquire.dart b/lib/Pages/Sub_Pages/Coupons/Acquire.dart index 818dc97..965e813 100644 --- a/lib/Pages/Sub_Pages/Coupons/Acquire.dart +++ b/lib/Pages/Sub_Pages/Coupons/Acquire.dart @@ -6,18 +6,18 @@ import 'package:teso/providers/device_provider.dart'; import 'package:teso/util/consts.dart'; class AcquireCoupon extends StatefulWidget { - final CouponsHead head; - final double price; + final CouponsHead? head; + final double? price; - const AcquireCoupon({Key key, this.head, this.price}) : super(key: key); + const AcquireCoupon({Key? key, this.head, this.price}) : super(key: key); @override _AcquireCouponState createState() => _AcquireCouponState(head: this.head); } class _AcquireCouponState extends State { - final CouponsHead head; + final CouponsHead? head; _AcquireCouponState({this.head}); - double _value; + double? _value; int _n = 1; int coinCost = 0; @@ -29,7 +29,7 @@ class _AcquireCouponState extends State { } calcCost() { - double price = widget.price * (_value / 100); + double price = widget.price! * (_value! / 100); coinCost = CouponRateCalculator.getRate(price); @@ -38,7 +38,7 @@ class _AcquireCouponState extends State { @override void initState() { - _value = head.lower; + _value = head!.lower; calcCost(); super.initState(); } @@ -126,24 +126,24 @@ class _AcquireCouponState extends State { ), ), Container( - child: head.type.toLowerCase().contains("freebie") + child: head!.type!.toLowerCase().contains("freebie") ? Center( child: Text("Coupon Type : FREEBIE"), ) : Row( children: [ - Text(head.lower.toString() + " %"), + Text(head!.lower.toString() + " %"), Slider( - value: _value, - min: head.lower, - max: head.upper, + value: _value!, + min: head!.lower!, + max: head!.upper!, divisions: 20, activeColor: accentMain, inactiveColor: darkAccent, label: _value.toString() + "%", onChanged: (double newValue) => changeValue(newValue), ), - Text(head.upper.toString() + " %"), + Text(head!.upper.toString() + " %"), ], ), ), @@ -210,10 +210,10 @@ class _AcquireCouponState extends State { onPressed: coinCost == 0 ? null : () async { - head.lower = _value; - head.quantity = _n; + head!.lower = _value; + head!.quantity = _n; await Provider.of(context, listen: false) - .acceptCoupon(head, coinCost, context); + .acceptCoupon(head!, coinCost, context); }, child: Text("Confirm"), ), diff --git a/lib/Pages/Sub_Pages/Coupons/CouponLocation.dart b/lib/Pages/Sub_Pages/Coupons/CouponLocation.dart index 103d3cf..744fab9 100644 --- a/lib/Pages/Sub_Pages/Coupons/CouponLocation.dart +++ b/lib/Pages/Sub_Pages/Coupons/CouponLocation.dart @@ -16,43 +16,43 @@ import 'package:flutter_polyline_points/flutter_polyline_points.dart'; import 'package:teso/util/consts.dart'; class CouponLocator extends StatefulWidget { - final TesoBusinessDetail shop; + final TesoBusinessDetail? shop; - const CouponLocator({Key key, this.shop}) : super(key: key); + const CouponLocator({Key? key, this.shop}) : super(key: key); @override _CouponLocatorState createState() => _CouponLocatorState( shop: new TesoShop( - categoryShop: this.shop.businessCategory, - dateEst: this.shop.dateOfEst, - email: this.shop.businessEmail, - handle: this.shop.handle, - latitude: double.parse(this.shop.businessLat), - logo: this.shop.businessLogo, - longitude: double.parse(this.shop.businessLng), - shopAddress: this.shop.businessAddress, - shopDescription: this.shop.businessDescription, - shopID: this.shop.businessId, - shopName: this.shop.businessName, - shopPhone: this.shop.businessContact, - shopTin: this.shop.businessTin, + categoryShop: this.shop!.businessCategory, + dateEst: this.shop!.dateOfEst, + email: this.shop!.businessEmail, + handle: this.shop!.handle, + latitude: double.parse(this.shop!.businessLat!), + logo: this.shop!.businessLogo, + longitude: double.parse(this.shop!.businessLng!), + shopAddress: this.shop!.businessAddress, + shopDescription: this.shop!.businessDescription, + shopID: this.shop!.businessId, + shopName: this.shop!.businessName, + shopPhone: this.shop!.businessContact, + shopTin: this.shop!.businessTin, )); } class _CouponLocatorState extends State { - String mapstyle; + String? mapstyle; var _future; - static LatLng _initialPosition; + static late LatLng _initialPosition; Map markers = {}; - GoogleMapController mapController; + late GoogleMapController mapController; static const double CAMERA_ZOOM = 14.4746; static const double CAMERA_TILT = 80; static const double CAMERA_BEARING = 30; - TesoShop shop; + TesoShop? shop; _CouponLocatorState({this.shop}); Map polylines = {}; - String selectedshop = ""; + String? selectedshop = ""; Location location = Location(); - LocationData _location; + late LocationData _location; bool ios = false; Future _determinePosition() async { @@ -60,10 +60,10 @@ class _CouponLocatorState extends State { final LocationData _locationResult = await location.getLocation(); setState(() { _location = _locationResult; - _initialPosition = LatLng(_location.latitude, _location.longitude); + _initialPosition = LatLng(_location.latitude!, _location.longitude!); }); await getLocations(); - return await navigateToShop(shop); + return await navigateToShop(shop!); } on PlatformException catch (err) { setState(() { print(err.code); @@ -73,15 +73,15 @@ class _CouponLocatorState extends State { } getLocations() async { - MarkerId markerId = MarkerId(widget.shop.businessId); + MarkerId markerId = MarkerId(widget.shop!.businessId!); Marker marker = Marker( markerId: markerId, - position: LatLng(double.parse(widget.shop.businessLat), - double.parse(widget.shop.businessLng)), + position: LatLng(double.parse(widget.shop!.businessLat!), + double.parse(widget.shop!.businessLng!)), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueCyan), infoWindow: InfoWindow( - title: widget.shop.businessName, - snippet: widget.shop.businessAddress, + title: widget.shop!.businessName, + snippet: widget.shop!.businessAddress, ), onTap: () => showModalBottomSheet( context: context, @@ -89,7 +89,7 @@ class _CouponLocatorState extends State { borderRadius: BorderRadius.vertical(top: Radius.circular(30.0)), ), builder: (BuildContext bc) { - return buildShopDetails(bc, shop, navigateToShop); + return buildShopDetails(bc, shop!, navigateToShop); }, ), ); @@ -105,7 +105,7 @@ class _CouponLocatorState extends State { super.initState(); ios = Platform.isIOS; SharedPreferences.getInstance().then((prefs) { - String currentTheme = prefs.getString("theme"); + String? currentTheme = prefs.getString("theme"); if (currentTheme == "light") { rootBundle.loadString('assets/styles/light.txt').then((string) { mapstyle = string; @@ -119,15 +119,15 @@ class _CouponLocatorState extends State { _future = _determinePosition(); location.onLocationChanged.listen((LocationData cLoc) { - _initialPosition = LatLng(cLoc.latitude, cLoc.longitude); + _initialPosition = LatLng(cLoc.latitude!, cLoc.longitude!); }); } navigateToShop(TesoShop tesoShop) async { - MarkerId markerId = MarkerId(tesoShop.shopName + " Location"); + MarkerId markerId = MarkerId(tesoShop.shopName! + " Location"); Marker marker = Marker( markerId: markerId, - position: LatLng(tesoShop.latitude, tesoShop.longitude), + position: LatLng(tesoShop.latitude!, tesoShop.longitude!), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen), infoWindow: InfoWindow( title: tesoShop.shopName, @@ -151,8 +151,8 @@ class _CouponLocatorState extends State { speedAccuracy: 100, timestamp: DateTime.now()); Position shopLoc = Position( - latitude: tesoShop.latitude, - longitude: tesoShop.longitude, + latitude: tesoShop.latitude!, + longitude: tesoShop.longitude!, accuracy: 100, altitude: 100, heading: 100, diff --git a/lib/Pages/Sub_Pages/Coupons/LoadGiftRecipient.dart b/lib/Pages/Sub_Pages/Coupons/LoadGiftRecipient.dart index 2ac6693..3c381f6 100644 --- a/lib/Pages/Sub_Pages/Coupons/LoadGiftRecipient.dart +++ b/lib/Pages/Sub_Pages/Coupons/LoadGiftRecipient.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unnecessary_null_comparison + import 'package:provider/provider.dart'; import 'package:teso/Classes/TesoUser.dart'; import 'package:teso/Pages/PageWidgets/Friends/friendTile.dart'; @@ -13,10 +15,10 @@ class LoadGiftRecipient extends StatefulWidget { } class _LoadGiftRecipientState extends State { - TextEditingController searchkey; + TextEditingController? searchkey; List recipientMain= []; - List recipient; - SharedPreferences prefs; + List? recipient; + SharedPreferences? prefs; void clearText() { setState(() {}); @@ -34,8 +36,8 @@ class _LoadGiftRecipientState extends State { .where((element) => element.username.toLowerCase().contains(name.toLowerCase())) .toList(); - recipient.sort((a, b) { - return b.firstname.compareTo(a.firstname); + recipient!.sort((a, b) { + return b.firstname!.compareTo(a.firstname!); }); }); } @@ -67,16 +69,16 @@ class _LoadGiftRecipientState extends State { recipientMain = value.friends; recipient = value.friends; } - recipient.sort((a, b) { - return b.firstname.compareTo(a.firstname); + recipient!.sort((a, b) { + return b.firstname!.compareTo(a.firstname!); }); return ListView.builder( - itemCount: recipient.length, + itemCount: recipient!.length, itemBuilder: (context, int index) { return InkWell( onTap: () => - Navigator.pop(context, recipient.elementAt(index)), - child: buildFriend(context, recipient.elementAt(index)), + Navigator.pop(context, recipient!.elementAt(index)), + child: buildFriend(context, recipient!.elementAt(index)), ); }, ); diff --git a/lib/Pages/Sub_Pages/Coupons/MyCouponOptions.dart b/lib/Pages/Sub_Pages/Coupons/MyCouponOptions.dart index c0a2676..c15341b 100644 --- a/lib/Pages/Sub_Pages/Coupons/MyCouponOptions.dart +++ b/lib/Pages/Sub_Pages/Coupons/MyCouponOptions.dart @@ -15,22 +15,22 @@ import 'package:teso/Classes/API Clasess/CouponHead.dart'; import 'package:flutter/cupertino.dart'; class AcquiredOptions extends StatefulWidget { - final CouponDetails head; + final CouponDetails? head; - const AcquiredOptions({Key key, this.head}) : super(key: key); + const AcquiredOptions({Key? key, this.head}) : super(key: key); @override _AcquiredOptionsState createState() => _AcquiredOptionsState(head: this.head); } class _AcquiredOptionsState extends State { - final CouponDetails head; + final CouponDetails? head; _AcquiredOptionsState({this.head}); - double _value; - String result = ""; - TextEditingController friendName; - TesoUser selectedFriend = new TesoUser(); + double? _value; + String? result = ""; + TextEditingController? friendName; + TesoUser? selectedFriend = new TesoUser(); bool loading = false; - double _n; + double? _n; int coinCost = 0; int _time = 0; bool freebie = false; @@ -45,8 +45,8 @@ class _AcquiredOptionsState extends State { calcCost() { if (mounted) setState(() { - _n = head.worth - (_value / 100) * head.worth; - _n.roundToDouble(); + _n = head!.worth! - (_value! / 100) * head!.worth!; + _n!.roundToDouble(); }); } @@ -60,7 +60,7 @@ class _AcquiredOptionsState extends State { child: QRCodeScanner(), ), ); - if (result != null && result.isNotEmpty) { + if (result != null && result!.isNotEmpty) { print("confirm purchase"); } } @@ -80,12 +80,12 @@ class _AcquiredOptionsState extends State { setState(() { selectedFriend = selectedFriend; }); - friendName.text = - selectedFriend.firstname + " " + selectedFriend.lastname; - if (friendName.text.length > 15) - friendName.text = friendName.text.substring(0, 15) + "..."; + friendName!.text = + selectedFriend!.firstname! + " " + selectedFriend!.lastname!; + if (friendName!.text.length > 15) + friendName!.text = friendName!.text.substring(0, 15) + "..."; } else { - friendName.text = ""; + friendName!.text = ""; setState(() { selectedFriend = new TesoUser(); }); @@ -96,25 +96,25 @@ class _AcquiredOptionsState extends State { setState(() { loading = true; }); - if (head.worth > 0 && selectedFriend.userGUID != null) { + if (head!.worth! > 0 && selectedFriend!.userGUID != null) { CouponsHead gift = new CouponsHead(); - gift.businessId = head.issuer.businessName; - gift.targetProduct = head.targetProduct.productID; - gift.couponId = head.couponId; + gift.businessId = head!.issuer!.businessName; + gift.targetProduct = head!.targetProduct!.productID; + gift.couponId = head!.couponId; if (freebie) { gift.lower = 100; } else { gift.lower = _value; } - gift.state = head.countID; + gift.state = head!.countID; gift.upper = 0; - gift.type = selectedFriend.userGUID; - gift.expiration = head.expiration; + gift.type = selectedFriend!.userGUID; + gift.expiration = head!.expiration; SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; try { var register2 = serverLocation + 'coupons/giftCoupon'; @@ -138,10 +138,10 @@ class _AcquiredOptionsState extends State { @override void initState() { - _value = head.worth; + _value = head!.worth; friendName = new TextEditingController(); - _n = head.worth; - if (widget.head.type.toLowerCase().contains("freebie")) { + _n = head!.worth; + if (widget.head!.type!.toLowerCase().contains("freebie")) { setState(() { freebie = true; }); @@ -220,7 +220,7 @@ class _AcquiredOptionsState extends State { ), Text("0 %"), Slider( - value: _value, + value: _value!, min: 0, max: 100, divisions: 20, diff --git a/lib/Pages/Sub_Pages/Coupons/ProximityCoupons.dart b/lib/Pages/Sub_Pages/Coupons/ProximityCoupons.dart index d179f74..d0deef2 100644 --- a/lib/Pages/Sub_Pages/Coupons/ProximityCoupons.dart +++ b/lib/Pages/Sub_Pages/Coupons/ProximityCoupons.dart @@ -20,15 +20,15 @@ class ProximityCoupons extends StatefulWidget { class _ProximityCouponsState extends State with TickerProviderStateMixin { - AnimationController _buttonController; - Animation rotate; - Animation right; - Animation bottom; - Animation width; + late AnimationController _buttonController; + late Animation rotate; + late Animation right; + late Animation bottom; + Animation? width; int flag = 0; List data = []; List selectedData = []; - double selectedDiscount; + double? selectedDiscount; double price = 0; @override @@ -101,7 +101,7 @@ class _ProximityCouponsState extends State dismissImg(ProximityCoupon img) async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = img.business.businessId; + couponsHead.businessId = img.business!.businessId; couponsHead.expiration = img.expiration; couponsHead.couponId = img.couponId; couponsHead.quantity = img.quantity; @@ -119,7 +119,7 @@ class _ProximityCouponsState extends State addImg(ProximityCoupon img) async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = img.business.businessId; + couponsHead.businessId = img.business!.businessId; couponsHead.expiration = img.expiration; couponsHead.couponId = img.couponId; couponsHead.quantity = 1; @@ -127,7 +127,7 @@ class _ProximityCouponsState extends State couponsHead.lower = double.parse(img.lowerLimit.toString()); couponsHead.upper = double.parse(img.upperLimit.toString()); couponsHead.targetProduct = img.targetID; - double price = (img.targetCost * (img.lowerLimit / 100)); + double price = (img.targetCost! * (img.lowerLimit! / 100)); //Calculations int cost = CouponRateCalculator.getRate(price); @@ -171,7 +171,7 @@ class _ProximityCouponsState extends State title: Text("Proximity Coupons"), actions: [ Consumer(builder: - (BuildContext context, UserProvider value, Widget child) { + (BuildContext context, UserProvider value, Widget? child) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -203,7 +203,7 @@ class _ProximityCouponsState extends State margin: EdgeInsets.only(left: 2), child: Center( child: Text( - value.currentUser.gold, + value.currentUser!.gold!, style: TextStyle(fontSize: 13.5), ), ), @@ -236,7 +236,7 @@ class _ProximityCouponsState extends State ), child: Center( child: Text( - value.currentUser.silver, + value.currentUser!.silver!, style: TextStyle(fontSize: 13.5), ), ), @@ -252,7 +252,7 @@ class _ProximityCouponsState extends State ), body: Consumer( builder: (context, value, child) { - if (!value.serviceEnabled) { + if (!value.serviceEnabled!) { return Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, @@ -302,8 +302,7 @@ class _ProximityCouponsState extends State ), ), ); - } else if (value.proximityCoupons == null || - value.proximityCoupons.length == 0) { + } else if (value.proximityCoupons.length == 0) { return Center( child: Text("No coupons available in your location"), ); @@ -323,7 +322,7 @@ class _ProximityCouponsState extends State alignment: AlignmentDirectional.center, children: data.map((item) { if (data.indexOf(item) == dataLength - 1 && - item.type.toLowerCase().contains("discount")) { + item.type!.toLowerCase().contains("discount")) { selectedDiscount = item.lowerLimit; return buildActiveDiscountCoupon( item, @@ -342,7 +341,7 @@ class _ProximityCouponsState extends State price, calculateWorth); } else if (data.indexOf(item) == dataLength - 1 && - item.type.toLowerCase().contains("freebie")) { + item.type!.toLowerCase().contains("freebie")) { return buildActiveFreebieCoupon( item, bottom.value, @@ -359,11 +358,11 @@ class _ProximityCouponsState extends State swipeLeft, ); } else if (data.indexOf(item) < dataLength - 1 && - item.type.toLowerCase().contains("discount")) { + item.type!.toLowerCase().contains("discount")) { backCardPosition = backCardPosition - 10; backCardWidth = backCardWidth + 10; - double price = item.targetCost - - (item.targetCost * item.lowerLimit / 100); + double price = item.targetCost! - + (item.targetCost! * item.lowerLimit! / 100); return buildDummyDiscountCoupon( item, backCardPosition, @@ -378,8 +377,8 @@ class _ProximityCouponsState extends State } else { backCardPosition = backCardPosition - 10; backCardWidth = backCardWidth + 10; - double price = item.targetCost - - (item.targetCost * item.lowerLimit / 100); + double price = item.targetCost! - + (item.targetCost! * item.lowerLimit! / 100); return buildDummyFreebieCoupon( item, backCardPosition, diff --git a/lib/Pages/Sub_Pages/Desires Come True/AddDesire.dart b/lib/Pages/Sub_Pages/Desires Come True/AddDesire.dart index 7c6607d..47f2612 100644 --- a/lib/Pages/Sub_Pages/Desires Come True/AddDesire.dart +++ b/lib/Pages/Sub_Pages/Desires Come True/AddDesire.dart @@ -11,9 +11,9 @@ import 'NotListed.dart'; import 'package:jiffy/jiffy.dart'; class NewDesire extends StatefulWidget { - final List selected; + final List? selected; - const NewDesire({Key key, this.selected}) : super(key: key); + const NewDesire({Key? key, this.selected}) : super(key: key); @override _NewDesireState createState() => _NewDesireState(); } @@ -22,8 +22,8 @@ class _NewDesireState extends State { List newdesire = []; List newdesireMain = []; var search = new TextEditingController(); - SharedPreferences prefs; - List selectList = []; + late SharedPreferences prefs; + List selectList = []; @override void initState() { @@ -37,12 +37,12 @@ class _NewDesireState extends State { }); } }); - selectList = widget.selected.map((e) => e.productID).toList(); + selectList = widget.selected!.map((e) => e.productID).toList(); } lookItem() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -73,7 +73,7 @@ class _NewDesireState extends State { .removeWhere((element) => selectList.contains(element.productID)); newdesire = newdesireMain; newdesire.sort((a, b) { - return b.productName.compareTo(a.productName); + return b.productName!.compareTo(a.productName!); }); }); } @@ -82,7 +82,7 @@ class _NewDesireState extends State { addItem(Desire item) { if (mounted) setState(() { - widget.selected.add(item); + widget.selected!.add(item); selectList.add(item.productID); newdesire.remove(item); }); @@ -178,7 +178,7 @@ class _NewDesireState extends State { body: newdesire.length == 0 && search.text.length != 0 ? InkWell( onTap: () async { - Desire unlistedDesire = await showDialog( + Desire? unlistedDesire = await showDialog( context: context, builder: (BuildContext bc) { return AlertDialog( @@ -187,7 +187,7 @@ class _NewDesireState extends State { ), ); }); - if (unlistedDesire != null) widget.selected.add(unlistedDesire); + if (unlistedDesire != null) widget.selected!.add(unlistedDesire); search.clear(); }, child: Container( @@ -222,7 +222,7 @@ class _NewDesireState extends State { if (newdesire.length == 0 && search.text.length == 0) { return Container(); } else { - if (!widget.selected.contains(newdesire.elementAt(index))) { + if (!widget.selected!.contains(newdesire.elementAt(index))) { return buildProductDesire( context, newdesire.elementAt(index), addItem); } else { diff --git a/lib/Pages/Sub_Pages/Desires Come True/NotListed.dart b/lib/Pages/Sub_Pages/Desires Come True/NotListed.dart index 7a24673..a836915 100644 --- a/lib/Pages/Sub_Pages/Desires Come True/NotListed.dart +++ b/lib/Pages/Sub_Pages/Desires Come True/NotListed.dart @@ -5,16 +5,16 @@ import 'package:teso/util/consts.dart'; import 'package:teso/Classes/API Clasess/Desire.dart'; class NotListed extends StatefulWidget { - final String productName; + final String? productName; - const NotListed({Key key, this.productName}) : super(key: key); + const NotListed({Key? key, this.productName}) : super(key: key); @override _NotListedState createState() => _NotListedState(); } class _NotListedState extends State { List categories = Category.category; - Category selectedCategory = new Category(); + Category? selectedCategory = new Category(); @override void initState() { @@ -32,7 +32,7 @@ class _NotListedState extends State { children: [ Container( child: Text( - widget.productName, + widget.productName!, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, @@ -53,7 +53,7 @@ class _NotListedState extends State { (category) => DropdownMenuItem( value: category, child: Text( - category.name, + category.name!, style: TextStyle(color: Colors.grey, fontSize: 17), ), ), @@ -81,7 +81,7 @@ class _NotListedState extends State { ), onPressed: () { Desire item = new Desire(); - item.category = selectedCategory.id; + item.category = selectedCategory!.id; item.enlisted = "false"; item.price = 0.0; item.productID = widget.productName; diff --git a/lib/Pages/Sub_Pages/Explore/Categories/ExploreCategory.dart b/lib/Pages/Sub_Pages/Explore/Categories/ExploreCategory.dart index 36020bb..f08ffb5 100644 --- a/lib/Pages/Sub_Pages/Explore/Categories/ExploreCategory.dart +++ b/lib/Pages/Sub_Pages/Explore/Categories/ExploreCategory.dart @@ -10,42 +10,42 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter/cupertino.dart'; class ExploreCategory extends StatefulWidget { - final Category selectedCategory; + final Category? selectedCategory; - const ExploreCategory({Key key, this.selectedCategory}) : super(key: key); + const ExploreCategory({Key? key, this.selectedCategory}) : super(key: key); @override _ExploreCategoryState createState() => _ExploreCategoryState(); } class _ExploreCategoryState extends State { - ScrollController _controller; - List products; + late ScrollController _controller; + List? products; List show = []; int count = 0; var _future; Future fetchImages() async { try { - if (products != null && show.length <= products.length) { + if (products != null && show.length <= products!.length) { count = show.length; for (int i = 0; i <= 9; i++) { - if (products.length > count) + if (products!.length > count) setState(() { - show.add(products.elementAt(count)); + show.add(products!.elementAt(count)); count++; imageCache.clear(); }); } } else { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; var register = serverLocation + 'search/category-products'; var client = await http.post(Uri.parse(register), - body: json.encode(widget.selectedCategory.id), + body: json.encode(widget.selectedCategory!.id), headers: requestHeaders); if (client.statusCode == 200) { var productItem = jsonDecode(client.body); @@ -54,9 +54,9 @@ class _ExploreCategoryState extends State { count = show.length; for (int i = 0; i <= 9; i++) { - if (products.length > count) + if (products!.length > count) setState(() { - show.add(products.elementAt(count)); + show.add(products!.elementAt(count)); count++; imageCache.clear(); }); @@ -89,10 +89,10 @@ class _ExploreCategoryState extends State { return Scaffold( appBar: AppBar( automaticallyImplyLeading: true, - title: Text(widget.selectedCategory.name), + title: Text(widget.selectedCategory!.name!), actions: [ Image( - image: AssetImage(widget.selectedCategory.image), + image: AssetImage(widget.selectedCategory!.image!), ), ], ), diff --git a/lib/Pages/Sub_Pages/Explore/ExploreBusiness.dart b/lib/Pages/Sub_Pages/Explore/ExploreBusiness.dart index acadc2f..71d6dd1 100644 --- a/lib/Pages/Sub_Pages/Explore/ExploreBusiness.dart +++ b/lib/Pages/Sub_Pages/Explore/ExploreBusiness.dart @@ -5,15 +5,15 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:teso/Pages/PageWidgets/Explore/business.dart'; class ExploreBusiness extends StatefulWidget { - final List businesses; + final List? businesses; - const ExploreBusiness({Key key, this.businesses}) : super(key: key); + const ExploreBusiness({Key? key, this.businesses}) : super(key: key); @override _ExploreBusinessState createState() => _ExploreBusinessState(); } class _ExploreBusinessState extends State { - ScrollController _controller; + late ScrollController _controller; List show = []; int count = 0; @@ -21,9 +21,9 @@ class _ExploreBusinessState extends State { try { count = show.length; for (int i = 0; i <= 9; i++) { - if (widget.businesses.length > count) + if (widget.businesses!.length > count) setState(() { - show.add(widget.businesses.elementAt(count)); + show.add(widget.businesses!.elementAt(count)); count++; imageCache.clear(); }); @@ -37,7 +37,7 @@ class _ExploreBusinessState extends State { void didUpdateWidget(covariant ExploreBusiness oldWidget) { super.didUpdateWidget(oldWidget); if (oldWidget.businesses != widget.businesses || - widget.businesses.length == 0) { + widget.businesses!.length == 0) { show = []; fetchImages(); } diff --git a/lib/Pages/Sub_Pages/Explore/ExplorePeople.dart b/lib/Pages/Sub_Pages/Explore/ExplorePeople.dart index 3f7b950..e46f54d 100644 --- a/lib/Pages/Sub_Pages/Explore/ExplorePeople.dart +++ b/lib/Pages/Sub_Pages/Explore/ExplorePeople.dart @@ -5,9 +5,9 @@ import 'package:teso/providers/pageAnimations.dart'; import 'package:flutter/material.dart'; class ExplorePeople extends StatefulWidget { - final List people; + final List? people; - const ExplorePeople({Key key, this.people}) : super(key: key); + const ExplorePeople({Key? key, this.people}) : super(key: key); @override _ExplorePeopleState createState() => _ExplorePeopleState(); } @@ -17,21 +17,21 @@ class _ExplorePeopleState extends State { Widget build(BuildContext context) { return Container( child: ListView.builder( - itemCount: widget.people.length, + itemCount: widget.people!.length, itemBuilder: (context, int index) { return InkWell( onTap: () => Navigator.push( context, PageTransition( child: UserProfileThirdPerson( - user: widget.people.elementAt(index), + user: widget.people!.elementAt(index), ), type: PageTransitionType.fade, ), ), child: Column( children: [ - buildFriend(context, widget.people.elementAt(index)), + buildFriend(context, widget.people!.elementAt(index)), Padding( padding: const EdgeInsets.all(8.0), child: Divider(), diff --git a/lib/Pages/Sub_Pages/Explore/ExploreProduct.dart b/lib/Pages/Sub_Pages/Explore/ExploreProduct.dart index 6d058b4..abf7017 100644 --- a/lib/Pages/Sub_Pages/Explore/ExploreProduct.dart +++ b/lib/Pages/Sub_Pages/Explore/ExploreProduct.dart @@ -4,15 +4,15 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:teso/Pages/PageWidgets/Explore/products.dart'; class ExploreProduct extends StatefulWidget { - final List products; + final List? products; - const ExploreProduct({Key key, this.products}) : super(key: key); + const ExploreProduct({Key? key, this.products}) : super(key: key); @override _ExploreProductState createState() => _ExploreProductState(); } class _ExploreProductState extends State { - ScrollController _controller; + late ScrollController _controller; List show = []; int count = 0; @@ -20,9 +20,9 @@ class _ExploreProductState extends State { try { count = show.length; for (int i = 0; i <= 9; i++) { - if (widget.products.length > count) + if (widget.products!.length > count) setState(() { - show.add(widget.products.elementAt(count)); + show.add(widget.products!.elementAt(count)); count++; imageCache.clear(); }); @@ -35,7 +35,7 @@ class _ExploreProductState extends State { @override void didUpdateWidget(covariant ExploreProduct oldWidget) { super.didUpdateWidget(oldWidget); - if (oldWidget.products != widget.products || widget.products.length == 0) { + if (oldWidget.products != widget.products || widget.products!.length == 0) { show = []; fetchImages(); } diff --git a/lib/Pages/Sub_Pages/Explore/Latest/AllLatest.dart b/lib/Pages/Sub_Pages/Explore/Latest/AllLatest.dart index 94942d0..8e62e0c 100644 --- a/lib/Pages/Sub_Pages/Explore/Latest/AllLatest.dart +++ b/lib/Pages/Sub_Pages/Explore/Latest/AllLatest.dart @@ -4,15 +4,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; class NewArrivals extends StatefulWidget { - final List products; + final List? products; - const NewArrivals({Key key, this.products}) : super(key: key); + const NewArrivals({Key? key, this.products}) : super(key: key); @override _NewArrivalsState createState() => _NewArrivalsState(); } class _NewArrivalsState extends State { - ScrollController _controller; + late ScrollController _controller; List show = []; int count = 0; @@ -20,9 +20,9 @@ class _NewArrivalsState extends State { try { count = show.length; for (int i = 0; i <= 9; i++) { - if (widget.products.length > count) + if (widget.products!.length > count) setState(() { - show.add(widget.products.elementAt(count)); + show.add(widget.products!.elementAt(count)); count++; imageCache.clear(); }); diff --git a/lib/Pages/Sub_Pages/Explore/ML/FindProduct.dart b/lib/Pages/Sub_Pages/Explore/ML/FindProduct.dart index 9761c4f..b9db6df 100644 --- a/lib/Pages/Sub_Pages/Explore/ML/FindProduct.dart +++ b/lib/Pages/Sub_Pages/Explore/ML/FindProduct.dart @@ -13,9 +13,9 @@ import 'package:teso/util/consts.dart'; import 'dart:convert'; class MLFindProduct extends StatefulWidget { - final File searchImage; + final File? searchImage; - const MLFindProduct({Key key, this.searchImage}) : super(key: key); + const MLFindProduct({Key? key, this.searchImage}) : super(key: key); @override _MLFindProductState createState() => _MLFindProductState(); } @@ -25,10 +25,10 @@ class _MLFindProductState extends State { List show = []; var searchkey = new TextEditingController(); var _future; - ScrollController _controller; + late ScrollController _controller; int count = 0; - List searchList = []; - SharedPreferences prefs; + List searchList = []; + late SharedPreferences prefs; void _scrollListener() { if (_controller.offset >= _controller.position.maxScrollExtent && @@ -40,7 +40,7 @@ class _MLFindProductState extends State { Future fetchImages() async { try { final GoogleVisionImage visionImage = - GoogleVisionImage.fromFile(widget.searchImage); + GoogleVisionImage.fromFile(widget.searchImage!); final ImageLabeler labeler = GoogleVision.instance.imageLabeler(); final List labels = await labeler.processImage(visionImage); @@ -50,17 +50,17 @@ class _MLFindProductState extends State { textRecognizer.close(); for (ImageLabel label in labels) { - final String name = label.text; - if (!searchList.contains(name) && name.length > 2) searchList.add(name); + final String? name = label.text; + if (!searchList.contains(name) && name!.length > 2) searchList.add(name); } for (TextBlock blocks in visionText.blocks) { - if (!searchList.contains(blocks.text) && blocks.text.length > 2) + if (!searchList.contains(blocks.text) && blocks.text!.length > 2) searchList.add(blocks.text); } prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -76,7 +76,7 @@ class _MLFindProductState extends State { count = show.length; for (int i = 0; i <= 9; i++) { - if (products != null && products.length > count) + if (products.length > count) setState(() { show.add(products.elementAt(count)); count++; diff --git a/lib/Pages/Sub_Pages/Explore/Trending/AllTrending.dart b/lib/Pages/Sub_Pages/Explore/Trending/AllTrending.dart index 6dd03ad..b54e8d2 100644 --- a/lib/Pages/Sub_Pages/Explore/Trending/AllTrending.dart +++ b/lib/Pages/Sub_Pages/Explore/Trending/AllTrending.dart @@ -4,15 +4,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; class TrendingAll extends StatefulWidget { - final List products; + final List? products; - const TrendingAll({Key key, this.products}) : super(key: key); + const TrendingAll({Key? key, this.products}) : super(key: key); @override _TrendingAllState createState() => _TrendingAllState(); } class _TrendingAllState extends State { - ScrollController _controller; + late ScrollController _controller; List show = []; int count = 0; @@ -20,9 +20,9 @@ class _TrendingAllState extends State { try { count = show.length; for (int i = 0; i <= 9; i++) { - if (widget.products.length > count) + if (widget.products!.length > count) setState(() { - show.add(widget.products.elementAt(count)); + show.add(widget.products!.elementAt(count)); count++; imageCache.clear(); }); diff --git a/lib/Pages/Sub_Pages/Explore/search.dart b/lib/Pages/Sub_Pages/Explore/search.dart index 2c215d8..ae08ba4 100644 --- a/lib/Pages/Sub_Pages/Explore/search.dart +++ b/lib/Pages/Sub_Pages/Explore/search.dart @@ -23,18 +23,18 @@ class _LookupState extends State with TickerProviderStateMixin { List productAlert = []; List businessAlert = []; List business = []; - TabController tabController; + TabController? tabController; var search = new TextEditingController(); - SharedPreferences prefs; + late SharedPreferences prefs; var future; @override void initState() { super.initState(); tabController = new TabController(length: 3, vsync: this); - tabController.addListener(() async { + tabController!.addListener(() async { if (search.text.isNotEmpty) { - switch (tabController.index) { + switch (tabController!.index) { case 0: await lookupUser(); break; @@ -53,7 +53,7 @@ class _LookupState extends State with TickerProviderStateMixin { search.addListener(() async { if (search.text.isNotEmpty) { - switch (tabController.index) { + switch (tabController!.index) { case 0: await lookupUser(); break; @@ -79,7 +79,7 @@ class _LookupState extends State with TickerProviderStateMixin { lookupUser() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -105,7 +105,7 @@ class _LookupState extends State with TickerProviderStateMixin { lookupProducts() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -131,7 +131,7 @@ class _LookupState extends State with TickerProviderStateMixin { lookupBusiness() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token diff --git a/lib/Pages/Sub_Pages/LandingPage/FinalProcess.dart b/lib/Pages/Sub_Pages/LandingPage/FinalProcess.dart index b995b15..8a66985 100644 --- a/lib/Pages/Sub_Pages/LandingPage/FinalProcess.dart +++ b/lib/Pages/Sub_Pages/LandingPage/FinalProcess.dart @@ -9,30 +9,30 @@ import 'package:teso/GeneralWidgets/generalInput.dart'; import 'package:http/http.dart' as http; class FinalProcess extends StatefulWidget { - final TesoUser newuser; - const FinalProcess({Key key, this.newuser}) : super(key: key); + final TesoUser? newuser; + const FinalProcess({Key? key, this.newuser}) : super(key: key); @override _FinalProcessState createState() => _FinalProcessState(newuser: this.newuser); } class _FinalProcessState extends State { - TesoUser newuser; + TesoUser? newuser; _FinalProcessState({this.newuser}); double phoneborder = 1.0; bool phone = true; bool email = false; double mailborder = 0.5; - String countryPrefix = ""; + String? countryPrefix = ""; TextEditingController firstname = new TextEditingController(); TextEditingController surname = new TextEditingController(); TextEditingController address = new TextEditingController(); TextEditingController emailaddress = new TextEditingController(); bool loading = false; - void _countryPrefix(CountryCode code) { + void _countryPrefix(CountryCode? code) { setState(() { - countryPrefix = code.dialCode; - newuser.country = code.dialCode; + countryPrefix = code!.dialCode; + newuser!.country = code.dialCode; }); } @@ -61,11 +61,11 @@ class _FinalProcessState extends State { serverLocation + "api/email/" + emailaddress.text.toString().trim())); print(client.body); if (client.statusCode == 200) { - newuser.firstname = firstname.text.trim(); - newuser.lastname = surname.text.trim(); - newuser.address = "NAN"; - newuser.country = countryPrefix; - newuser.email = emailaddress.text.toString().trim(); + newuser!.firstname = firstname.text.trim(); + newuser!.lastname = surname.text.trim(); + newuser!.address = "NAN"; + newuser!.country = countryPrefix; + newuser!.email = emailaddress.text.toString().trim(); Navigator.push( context, PageTransition( @@ -181,7 +181,7 @@ class _FinalProcessState extends State { isShowTitle: true), //initialSelection: user.currentUser.country, - onChanged: (CountryCode code) => + onChanged: (CountryCode? code) => _countryPrefix(code)), ), ], @@ -236,7 +236,7 @@ class _FinalProcessState extends State { ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/LandingPage/Login.dart b/lib/Pages/Sub_Pages/LandingPage/Login.dart index d1f7577..f2482a3 100644 --- a/lib/Pages/Sub_Pages/LandingPage/Login.dart +++ b/lib/Pages/Sub_Pages/LandingPage/Login.dart @@ -32,10 +32,10 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'facebookRedirect.dart'; class LoginPage extends StatefulWidget { - final List connectedCameras; - final String referrer; + final List? connectedCameras; + final String? referrer; - const LoginPage({Key key, this.connectedCameras, this.referrer}) + const LoginPage({Key? key, this.connectedCameras, this.referrer}) : super(key: key); @override _LoginPageState createState() => _LoginPageState(); @@ -45,17 +45,17 @@ class _LoginPageState extends State { TextEditingController usern = new TextEditingController(); TextEditingController password = new TextEditingController(); UserProvider user = UserProvider(); - User _user; + User? _user; bool loading = false; bool gloading = false; bool ios = false; bool error = false; String errorMessage = "An error occurred while verifying account try again!!"; - String deviceToken; - FirebaseAuth _auth; - GoogleSignIn _googleSignIn; + String? deviceToken; + late FirebaseAuth _auth; + FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; - Locale myLocale; + Locale? myLocale; void signIn() async { if (deviceToken == null) firebaseCloudMessaging_Listeners(); @@ -78,15 +78,15 @@ class _LoginPageState extends State { if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TokenHandler tokenHandler = TokenHandler.fromJSON(handler); + TokenHandler tokenHandler = TokenHandler.fromJSON(handler as Map); _auth = FirebaseAuth.instance; - await _auth.signInWithCustomToken(tokenHandler.tokenFirebase); + await _auth.signInWithCustomToken(tokenHandler.tokenFirebase!); - prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso); - prefs.setString("tokensFirebase", tokenHandler.tokenFirebase); + prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso!); + prefs.setString("tokensFirebase", tokenHandler.tokenFirebase!); prefs.setString("accountType", "email"); - prefs.setString("id", _auth.currentUser.uid); + prefs.setString("id", _auth.currentUser!.uid); prefs.setString("currentUser", tokenHandler.user.toString()); prefs.setBool("password", true); @@ -94,30 +94,30 @@ class _LoginPageState extends State { final QuerySnapshot result = await FirebaseFirestore.instance .collection('users') - .where('id', isEqualTo: _auth.currentUser.uid) + .where('id', isEqualTo: _auth.currentUser!.uid) .get(); final List documents = result.docs; if (documents.length == 0) { // Update data to server if new user FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .set({ - 'firstname': tokenHandler.user.firstname, - 'surname': tokenHandler.user.lastname, - 'id': _auth.currentUser.uid + 'firstname': tokenHandler.user!.firstname, + 'surname': tokenHandler.user!.lastname, + 'id': _auth.currentUser!.uid }); } FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .update({'deviceToken': deviceToken}); Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => MainScreens( - // connectedCameras: widget.connectedCameras + connectedCameras: widget.connectedCameras! )), (Route route) => false); } else { @@ -156,35 +156,34 @@ class _LoginPageState extends State { if (deviceToken == null) firebaseCloudMessaging_Listeners(); _auth = FirebaseAuth.instance; - _googleSignIn = GoogleSignIn(); - GoogleSignInAccount googleSignInAccount = await _googleSignIn.signIn(); - GoogleSignInAuthentication googleSignInAuthentication = - await googleSignInAccount.authentication; + + GoogleSignInAccount? googleSignInAccount = await GoogleSignIn().signIn(); + GoogleSignInAuthentication? googleSignInAuthentication = + await googleSignInAccount?.authentication; AuthCredential credential = GoogleAuthProvider.credential( - accessToken: googleSignInAuthentication.accessToken, - idToken: googleSignInAuthentication.idToken, + accessToken: googleSignInAuthentication?.accessToken, + idToken: googleSignInAuthentication?.idToken, ); var authResult = await _auth.signInWithCredential(credential); _user = authResult.user; - assert(!_user.isAnonymous); - assert(await _user.getIdToken() != null); - User currentUser = _auth.currentUser; - assert(_user.uid == currentUser.uid); + assert(!_user!.isAnonymous); + User currentUser = _auth.currentUser!; + assert(_user!.uid == currentUser.uid); - var names = googleSignInAccount.displayName.split(' '); + var names = googleSignInAccount?.displayName?.split(' '); GoogleUser googleUser = new GoogleUser(); googleUser.userGUID = currentUser.uid; - googleUser.firstname = names[0]; - googleUser.surname = names[1]; - googleUser.email = _user.email; - googleUser.pictureUri = _user.photoURL; + googleUser.firstname = names?[0]; + googleUser.surname = names?[1]; + googleUser.email = _user!.email; + googleUser.pictureUri = _user!.photoURL; googleUser.deviceToken = deviceToken; if (widget.referrer != null) googleUser.referralCode = widget.referrer; final QuerySnapshot result = await FirebaseFirestore.instance .collection('users') - .where('id', isEqualTo: _auth.currentUser.uid) + .where('id', isEqualTo: _auth.currentUser!.uid) .orderBy('surname', descending: true) .get(); final List documents = result.docs; @@ -192,20 +191,20 @@ class _LoginPageState extends State { // Update data to server if new user FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .set({ 'firstname': googleUser.firstname, 'surname': googleUser.surname, - 'id': _auth.currentUser.uid + 'id': _auth.currentUser!.uid }); } FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .update({'deviceToken': deviceToken}); - googleSignInAccount = await _googleSignIn.signOut(); + googleSignInAccount = await GoogleSignIn().signOut(); SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { @@ -217,10 +216,10 @@ class _LoginPageState extends State { body: json.encode(googleUser), headers: requestHeaders); if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TokenHandler tokenHandler = TokenHandler.fromJSON(handler); - prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso); - prefs.setString("id", _auth.currentUser.uid); - _user + TokenHandler tokenHandler = TokenHandler.fromJSON(handler as Map); + prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso!); + prefs.setString("id", _auth.currentUser!.uid); + _user! .getIdToken() .then((value) => prefs.setString("tokensFirebase", value)); prefs.setString("currentUser", tokenHandler.user.toString()); @@ -230,7 +229,7 @@ class _LoginPageState extends State { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => MainScreens( - // connectedCameras: widget.connectedCameras + connectedCameras: widget.connectedCameras! )), (Route route) => false); } else { @@ -298,10 +297,9 @@ class _LoginPageState extends State { final authResult = await _auth.signInWithCredential(oauthCredential); _user = authResult.user; - assert(!_user.isAnonymous); - assert(await _user.getIdToken() != null); - User currentUser = _auth.currentUser; - assert(_user.uid == currentUser.uid); + assert(!_user!.isAnonymous); + User currentUser = _auth.currentUser!; + assert(_user!.uid == currentUser.uid); GoogleUser googleUser = new GoogleUser(); googleUser.userGUID = currentUser.uid; @@ -309,30 +307,30 @@ class _LoginPageState extends State { appleCredential.givenName != null ? appleCredential.givenName : ""; googleUser.surname = appleCredential.familyName != null ? appleCredential.familyName : ""; - googleUser.email = _user.email; + googleUser.email = _user!.email; googleUser.deviceToken = deviceToken; if (widget.referrer != null) googleUser.referralCode = widget.referrer; final QuerySnapshot result = await FirebaseFirestore.instance .collection('users') - .where('id', isEqualTo: _auth.currentUser.uid) + .where('id', isEqualTo: _auth.currentUser!.uid) .get(); final List documents = result.docs; if (documents.length == 0) { // Update data to server if new user FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .set({ 'firstname': googleUser.firstname, 'surname': googleUser.surname, - 'id': _auth.currentUser.uid + 'id': _auth.currentUser!.uid }); } FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .update({'deviceToken': deviceToken}); SharedPreferences prefs = await SharedPreferences.getInstance(); @@ -346,10 +344,10 @@ class _LoginPageState extends State { body: json.encode(googleUser), headers: requestHeaders); if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TokenHandler tokenHandler = TokenHandler.fromJSON(handler); - prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso); - prefs.setString("id", _auth.currentUser.uid); - _user + TokenHandler tokenHandler = TokenHandler.fromJSON(handler as Map); + prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso!); + prefs.setString("id", _auth.currentUser!.uid); + _user! .getIdToken() .then((value) => prefs.setString("tokensFirebase", value)); prefs.setString("currentUser", tokenHandler.user.toString()); @@ -359,7 +357,7 @@ class _LoginPageState extends State { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => MainScreens( - // connectedCameras: widget.connectedCameras + connectedCameras: widget.connectedCameras! )), (Route route) => false); } else { @@ -388,7 +386,7 @@ class _LoginPageState extends State { gloading = true; error = false; }); - String results = await Navigator.push( + String? results = await Navigator.push( context, MaterialPageRoute( builder: (context) => CustomWebView( @@ -405,42 +403,41 @@ class _LoginPageState extends State { await _auth.signInWithCredential(facebookAuthCred); FacebookUser facebookUser = new FacebookUser(); - facebookUser.userGUID = _auth.currentUser.uid; - facebookUser.firstname = user.user.displayName; + facebookUser.userGUID = _auth.currentUser!.uid; + facebookUser.firstname = user.user!.displayName; facebookUser.surname = ""; - facebookUser.email = user.user.email; - facebookUser.pictureUri = user.user.photoURL; + facebookUser.email = user.user!.email; + facebookUser.pictureUri = user.user!.photoURL; facebookUser.deviceToken = deviceToken; - facebookUser.username = user.user.displayName.replaceAll(' ', ''); + facebookUser.username = user.user!.displayName!.replaceAll(' ', ''); if (widget.referrer != null) facebookUser.referralCode = widget.referrer; _user = user.user; - assert(!_user.isAnonymous); - assert(await _user.getIdToken() != null); - User currentUser = _auth.currentUser; - assert(_user.uid == currentUser.uid); + assert(!_user!.isAnonymous); + User currentUser = _auth.currentUser!; + assert(_user!.uid == currentUser.uid); final QuerySnapshot result = await FirebaseFirestore.instance .collection('users') - .where('id', isEqualTo: _auth.currentUser.uid) + .where('id', isEqualTo: _auth.currentUser!.uid) .get(); final List documents = result.docs; if (documents.length == 0) { // Update data to server if new user FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .set({ 'firstname': facebookUser.firstname, 'surname': facebookUser.surname, - 'id': _auth.currentUser.uid + 'id': _auth.currentUser!.uid }); } FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) + .doc(_auth.currentUser!.uid) .update({'deviceToken': deviceToken}); SharedPreferences prefs = await SharedPreferences.getInstance(); @@ -455,13 +452,13 @@ class _LoginPageState extends State { if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TokenHandler tokenHandler = TokenHandler.fromJSON(handler); - _user + TokenHandler tokenHandler = TokenHandler.fromJSON(handler as Map); + _user! .getIdToken() .then((value) => prefs.setString("tokensFirebase", value)); - prefs.setString("id", _auth.currentUser.uid); + prefs.setString("id", _auth.currentUser!.uid); prefs.setString("currentUser", tokenHandler.user.toString()); - prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso); + prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso!); prefs.setBool("password", false); this.user.setUser(tokenHandler.user); @@ -469,7 +466,7 @@ class _LoginPageState extends State { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => - MainScreens(connectedCameras: widget.connectedCameras)), + MainScreens(connectedCameras: widget.connectedCameras!)), (Route route) => false); } else { setState(() { @@ -502,7 +499,7 @@ class _LoginPageState extends State { void initState() { ios = Platform.isIOS; SharedPreferences.getInstance().then((value) { - String current = value.getString("api-version"); + String? current = value.getString("api-version"); value.clear(); if (current != null) value.setString("api-version", current); }); diff --git a/lib/Pages/Sub_Pages/LandingPage/NewProfile.dart b/lib/Pages/Sub_Pages/LandingPage/NewProfile.dart index 173e6b3..910e109 100644 --- a/lib/Pages/Sub_Pages/LandingPage/NewProfile.dart +++ b/lib/Pages/Sub_Pages/LandingPage/NewProfile.dart @@ -13,11 +13,11 @@ class CompleteNewProfile extends StatefulWidget { class _CompleteNewProfileState extends State { DateFormat dateFormat = DateFormat("EEEE dd-MM-yyyy"); DateTime selectedDate = DateTime.now(); - String selectedGender; + String? selectedGender; List gender = ["Male", "Female", "Other"]; bool error = false; String message = ""; - TesoUserDetail olduser; + TesoUserDetail? olduser; void changeDate(v) { setState(() { @@ -28,8 +28,8 @@ class _CompleteNewProfileState extends State { completeNewProfile() async { if (selectedDate.year != DateTime.now().year && selectedGender != null) { olduser = new TesoUserDetail(); - olduser.dateOfBirth = selectedDate; - olduser.gender = selectedGender; + olduser!.dateOfBirth = selectedDate; + olduser!.gender = selectedGender; Navigator.pop(context, olduser); } else { setState(() { diff --git a/lib/Pages/Sub_Pages/LandingPage/ReferPage.dart b/lib/Pages/Sub_Pages/LandingPage/ReferPage.dart index 807be00..a8bdea3 100644 --- a/lib/Pages/Sub_Pages/LandingPage/ReferPage.dart +++ b/lib/Pages/Sub_Pages/LandingPage/ReferPage.dart @@ -3,15 +3,15 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; class ReferPage extends StatefulWidget { - final String accountType; - const ReferPage({Key key, this.accountType}) : super(key: key); + final String? accountType; + const ReferPage({Key? key, this.accountType}) : super(key: key); @override _ReferPageState createState() => _ReferPageState(accountType: this.accountType); } class _ReferPageState extends State { - String accountType; + String? accountType; _ReferPageState({this.accountType}); var usern = new TextEditingController(); bool visibleT = true; @@ -20,7 +20,7 @@ class _ReferPageState extends State { bool error = false; bool rememberMe = false; bool success = false; - String usernameFor; + String? usernameFor; @override void dispose() { @@ -77,9 +77,9 @@ class _ReferPageState extends State { SizedBox(height: 16.0), Text( "Sorry your account is connected to " + - accountType + + accountType! + ", login using the " + - accountType + + accountType! + " button ", textAlign: TextAlign.center, style: TextStyle( diff --git a/lib/Pages/Sub_Pages/LandingPage/ResetPassword.dart b/lib/Pages/Sub_Pages/LandingPage/ResetPassword.dart index 9c7a23b..c4dfd1d 100644 --- a/lib/Pages/Sub_Pages/LandingPage/ResetPassword.dart +++ b/lib/Pages/Sub_Pages/LandingPage/ResetPassword.dart @@ -20,7 +20,7 @@ class _ResetPasswordState extends State { bool error = false; bool rememberMe = false; bool success = false; - String usernameFor; + String? usernameFor; @override void dispose() { diff --git a/lib/Pages/Sub_Pages/LandingPage/SignUp.dart b/lib/Pages/Sub_Pages/LandingPage/SignUp.dart index 9c82445..265e08e 100644 --- a/lib/Pages/Sub_Pages/LandingPage/SignUp.dart +++ b/lib/Pages/Sub_Pages/LandingPage/SignUp.dart @@ -174,7 +174,7 @@ class _SignUpPageState extends State { ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/LandingPage/Success.dart b/lib/Pages/Sub_Pages/LandingPage/Success.dart index 7e3d205..04c491f 100644 --- a/lib/Pages/Sub_Pages/LandingPage/Success.dart +++ b/lib/Pages/Sub_Pages/LandingPage/Success.dart @@ -16,7 +16,7 @@ class _SuccessPageState extends State { bool error = false; bool rememberMe = false; bool success = false; - String usernameFor; + String? usernameFor; @override void dispose() { diff --git a/lib/Pages/Sub_Pages/LandingPage/createPassword.dart b/lib/Pages/Sub_Pages/LandingPage/createPassword.dart index e1086b4..16d1378 100644 --- a/lib/Pages/Sub_Pages/LandingPage/createPassword.dart +++ b/lib/Pages/Sub_Pages/LandingPage/createPassword.dart @@ -14,8 +14,8 @@ import 'dart:io'; class CreatePassword extends StatefulWidget { - final TesoUser newuser; - const CreatePassword({Key key, this.newuser}) : super(key: key); + final TesoUser? newuser; + const CreatePassword({Key? key, this.newuser}) : super(key: key); @override _CreatePasswordState createState() => _CreatePasswordState(newuser: this.newuser); @@ -23,18 +23,18 @@ class CreatePassword extends StatefulWidget { class _CreatePasswordState extends State with TickerProviderStateMixin { - TesoUser newuser; + TesoUser? newuser; _CreatePasswordState({this.newuser}); TextEditingController password = new TextEditingController(); - AnimationController _controller; - Animation _fabScale; + late AnimationController _controller; + late Animation _fabScale; bool eightChars = false; bool specialChar = false; bool upperCaseChar = false; bool lowerCaseChar = false; bool number = false; FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; - String deviceToken = ""; + String? deviceToken = ""; @override void dispose() { @@ -162,7 +162,7 @@ class _CreatePasswordState extends State ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), @@ -178,7 +178,7 @@ class _CreatePasswordState extends State onTap: () { if (_allValid()) { UserAuth auth = new UserAuth(); - auth.username = newuser.username; + auth.username = newuser!.username; auth.password = password.text; auth.status = "awaiting"; auth.accountType = "TSUAC001"; @@ -186,7 +186,7 @@ class _CreatePasswordState extends State Registrar registration = new Registrar(); registration.authentication = auth; - registration.user = TesoUserDetail.fromUSER(newuser); + registration.user = TesoUserDetail.fromUSER(newuser!); Navigator.push( context, diff --git a/lib/Pages/Sub_Pages/LandingPage/facebookRedirect.dart b/lib/Pages/Sub_Pages/LandingPage/facebookRedirect.dart index 05d3c9d..fcc97fc 100644 --- a/lib/Pages/Sub_Pages/LandingPage/facebookRedirect.dart +++ b/lib/Pages/Sub_Pages/LandingPage/facebookRedirect.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; class CustomWebView extends StatefulWidget { - final String selectedUrl; + final String? selectedUrl; CustomWebView({this.selectedUrl}); @@ -46,7 +46,7 @@ class _CustomWebViewState extends State { @override Widget build(BuildContext context) { return WebviewScaffold( - url: widget.selectedUrl, + url: widget.selectedUrl!, appBar: new AppBar( automaticallyImplyLeading: false, backgroundColor: Color.fromRGBO(66, 103, 178, 1), diff --git a/lib/Pages/Sub_Pages/LandingPage/registeringProcess.dart b/lib/Pages/Sub_Pages/LandingPage/registeringProcess.dart index 753dc12..049d677 100644 --- a/lib/Pages/Sub_Pages/LandingPage/registeringProcess.dart +++ b/lib/Pages/Sub_Pages/LandingPage/registeringProcess.dart @@ -9,15 +9,15 @@ import 'package:flutter/cupertino.dart'; import 'package:teso/Pages/Sub_Pages/LandingPage/verification.dart'; class RegisteringProcess extends StatefulWidget { - final Registrar newuser; - const RegisteringProcess({Key key, this.newuser}) : super(key: key); + final Registrar? newuser; + const RegisteringProcess({Key? key, this.newuser}) : super(key: key); @override _RegisteringProcessState createState() => _RegisteringProcessState(newuser: this.newuser); } class _RegisteringProcessState extends State { - Registrar newuser; + Registrar? newuser; _RegisteringProcessState({this.newuser}); void registerUser() async { try { @@ -25,11 +25,11 @@ class _RegisteringProcessState extends State { 'Content-type': 'application/json', }; - String referral = + String? referral = Provider.of(context, listen: false).getReferral(); - Registrar registrar = newuser; - registrar.user.dateOfBirth = DateTime.now(); + Registrar registrar = newuser!; + registrar.user!.dateOfBirth = DateTime.now(); if (referral != null) registrar.referral = referral; var register = serverLocation + 'api/userauths'; var client = await http.post(Uri.parse(register), diff --git a/lib/Pages/Sub_Pages/LandingPage/resetVerification.dart b/lib/Pages/Sub_Pages/LandingPage/resetVerification.dart index 2ab037a..524075d 100644 --- a/lib/Pages/Sub_Pages/LandingPage/resetVerification.dart +++ b/lib/Pages/Sub_Pages/LandingPage/resetVerification.dart @@ -72,7 +72,7 @@ class _ResetVerificationStateCode extends State { ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/LandingPage/resetpasswordCode.dart b/lib/Pages/Sub_Pages/LandingPage/resetpasswordCode.dart index 2122d73..6f99d19 100644 --- a/lib/Pages/Sub_Pages/LandingPage/resetpasswordCode.dart +++ b/lib/Pages/Sub_Pages/LandingPage/resetpasswordCode.dart @@ -10,7 +10,7 @@ import 'package:http/http.dart' as http; class ResetPasswordCode extends StatefulWidget { final code; - const ResetPasswordCode({Key key, @required this.code}) : super(key: key); + const ResetPasswordCode({Key? key, required this.code}) : super(key: key); @override _ResetPasswordCodeState createState() => _ResetPasswordCodeState(); } @@ -18,8 +18,8 @@ class ResetPasswordCode extends StatefulWidget { class _ResetPasswordCodeState extends State with TickerProviderStateMixin { TextEditingController password = new TextEditingController(); - AnimationController _controller; - Animation _fabScale; + late AnimationController _controller; + late Animation _fabScale; bool eightChars = false; bool specialChar = false; bool upperCaseChar = false; @@ -257,7 +257,7 @@ class _ResetPasswordCodeState extends State ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/LandingPage/verification.dart b/lib/Pages/Sub_Pages/LandingPage/verification.dart index dcd886f..749ab4e 100644 --- a/lib/Pages/Sub_Pages/LandingPage/verification.dart +++ b/lib/Pages/Sub_Pages/LandingPage/verification.dart @@ -16,20 +16,20 @@ import 'package:teso/providers/user_provider.dart'; import 'package:firebase_auth/firebase_auth.dart'; class Verification extends StatefulWidget { - final Registrar user; - const Verification({Key key, this.user}) : super(key: key); + final Registrar? user; + const Verification({Key? key, this.user}) : super(key: key); @override _VerificationState createState() => _VerificationState(user: this.user); } class _VerificationState extends State { - List connectedCameras; - Registrar user; + List? connectedCameras; + Registrar? user; _VerificationState({this.user}); TextEditingController code = new TextEditingController(); bool loading = false; bool error = false; - FirebaseAuth _auth; + late FirebaseAuth _auth; @override void initState() { @@ -54,42 +54,42 @@ class _VerificationState extends State { body: json.encode(codeEntered), headers: requestHeaders); if (client.statusCode == 200) { - UserAuth auth = user.authentication; + UserAuth? auth = user!.authentication; var register2 = serverLocation + 'api/tokens'; var client1 = await http.post(Uri.parse(register2), body: json.encode(auth), headers: requestHeaders); if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TokenHandler tokenHandler = TokenHandler.fromJSON(handler); + TokenHandler tokenHandler = TokenHandler.fromJSON(handler as Map); _auth = FirebaseAuth.instance; - await _auth.signInWithCustomToken(tokenHandler.tokenFirebase); + await _auth.signInWithCustomToken(tokenHandler.tokenFirebase!); final QuerySnapshot result = await FirebaseFirestore.instance .collection('users') - .where('id', isEqualTo: tokenHandler.user.userGUID) + .where('id', isEqualTo: tokenHandler.user!.userGUID) .get(); final List documents = result.docs; if (documents.length == 0) { // Update data to server if new user FirebaseFirestore.instance .collection('users') - .doc(tokenHandler.user.userGUID) + .doc(tokenHandler.user!.userGUID) .set({ - 'nickname': tokenHandler.user.username, - 'id': tokenHandler.user.userGUID + 'nickname': tokenHandler.user!.username, + 'id': tokenHandler.user!.userGUID }); } FirebaseFirestore.instance .collection('users') - .doc(_auth.currentUser.uid) - .update({'deviceToken': auth.deviceToken}); + .doc(_auth.currentUser!.uid) + .update({'deviceToken': auth!.deviceToken}); - prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso); - prefs.setString("tokensFirebase", tokenHandler.tokenFirebase); + prefs.setString("tokensTeso", "Bearer " + tokenHandler.tokenTeso!); + prefs.setString("tokensFirebase", tokenHandler.tokenFirebase!); prefs.setString("accountType", "email"); - prefs.setString("id", tokenHandler.user.userGUID); + prefs.setString("id", tokenHandler.user!.userGUID!); prefs.setString("currentUser", tokenHandler.user.toString()); prefs.setBool("password", true); @@ -99,7 +99,7 @@ class _VerificationState extends State { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => MainScreens( - connectedCameras: connectedCameras, + connectedCameras: connectedCameras!, )), (Route route) => false); } else { @@ -133,7 +133,7 @@ class _VerificationState extends State { var register = serverLocation + 'api/activationgenerator'; await http.post(Uri.parse(register), - body: json.encode(user.user), headers: requestHeaders); + body: json.encode(user!.user), headers: requestHeaders); setState(() { loading = false; }); @@ -174,7 +174,7 @@ class _VerificationState extends State { child: Center( child: Text( "Enter the verification code we sent to your email " + - user.user.email + + user!.user!.email! + " to activate your account.", textAlign: TextAlign.center, style: TextStyle( @@ -229,7 +229,7 @@ class _VerificationState extends State { ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/Pages/Sub_Pages/Notifications/Alerts.dart b/lib/Pages/Sub_Pages/Notifications/Alerts.dart index ba7f76f..8bfff4c 100644 --- a/lib/Pages/Sub_Pages/Notifications/Alerts.dart +++ b/lib/Pages/Sub_Pages/Notifications/Alerts.dart @@ -1,3 +1,5 @@ +// ignore_for_file: dead_code, unnecessary_null_comparison + import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; @@ -24,15 +26,15 @@ class Alerts extends StatefulWidget { } class _AlertsState extends State { - List listMessage = new List.from([]); - String id = ""; + List? listMessage = new List.from([]); + String? id = ""; int _limit = 20; final int _limitIncrement = 20; final ScrollController listScrollController = ScrollController(); - SharedPreferences prefs; + late SharedPreferences prefs; bool loading = false; - Icon iconIndicator(String type) { + Icon iconIndicator(String? type) { switch (type) { case "alerts": return Icon( @@ -127,12 +129,12 @@ class _AlertsState extends State { void approveRelationship(userGUID) async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = userGUID; + String? searchValue = userGUID; var register = serverLocation + 'relationships/friendapproval'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -146,12 +148,12 @@ class _AlertsState extends State { void declineRelationship(userGUID) async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = userGUID; + String? searchValue = userGUID; var register = serverLocation + 'relationships/frienddecline'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -169,7 +171,7 @@ class _AlertsState extends State { }); try { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -222,18 +224,18 @@ class _AlertsState extends State { body: !loading ? Consumer( builder: - (BuildContext context, UserProvider value, Widget child) { + (BuildContext context, UserProvider value, Widget? child) { if (value != null) { - id = value.currentUser.userGUID; + id = value.currentUser!.userGUID; return StreamBuilder( stream: FirebaseFirestore.instance .collection('notifications') .doc(id != null ? id : "") - .collection(id != null ? id : "") + .collection(id != null ? id! : "") .orderBy('timestamp', descending: true) .limit(_limit) .snapshots(), - builder: (context, snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { if (!snapshot.hasData) { return Center( child: CircularProgressIndicator( @@ -245,36 +247,36 @@ class _AlertsState extends State { valueColor: AlwaysStoppedAnimation( Theme.of(context).primaryColor))); } else { - listMessage = snapshot.data.docs; + listMessage = snapshot.data!.docs; return ListView.builder( // controller: listScrollController, - itemCount: listMessage.length, + itemCount: listMessage!.length, itemBuilder: (BuildContext context, int index) { int timeInMillis = int.parse(snapshot - .data.docs[index]['timestamp'] + .data!.docs[index]['timestamp'] .toString()); DateTime date = DateTime.fromMillisecondsSinceEpoch( timeInMillis); - switch (listMessage[index]["notificationType"]) { + switch (listMessage![index]["notificationType"]) { case "friendrequest": return buildRequest( context: context, approve: () => approveRelationship( - listMessage[index]["initiatorID"]), + listMessage![index]["initiatorID"]), decline: () => declineRelationship( - listMessage[index]["initiatorID"]), + listMessage![index]["initiatorID"]), timestamp: date, - description: listMessage[index] + description: listMessage![index] ["initiatorUsername"] + - setDescription(listMessage[index] + setDescription(listMessage![index] ["notificationType"]), - thumbnail: listMessage[index] + thumbnail: listMessage![index] ["initiatorThumbnail"], - username: listMessage[index] + username: listMessage![index] ["initiatorUsername"], icons: iconIndicator( - listMessage[index]["notificationType"], + listMessage![index]["notificationType"], ), ); break; @@ -282,7 +284,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["couponID"]), + key: Key(listMessage![index]["couponID"]), background: Container( height: 100, decoration: BoxDecoration( @@ -307,10 +309,10 @@ class _AlertsState extends State { child: buildRedeemableAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -318,7 +320,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -327,7 +329,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["couponID"]), + key: Key(listMessage![index]["couponID"]), background: Container( height: 100, decoration: BoxDecoration( @@ -352,10 +354,10 @@ class _AlertsState extends State { child: buildRedeemableAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -363,7 +365,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -372,7 +374,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["couponID"]), + key: Key(listMessage![index]["couponID"]), background: Container( height: 100, decoration: BoxDecoration( @@ -397,10 +399,10 @@ class _AlertsState extends State { child: buildRedeemableAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -408,7 +410,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -417,7 +419,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["timestamp"] + key: Key(listMessage![index]["timestamp"] .toString()), background: Container( //height: 100, @@ -443,14 +445,14 @@ class _AlertsState extends State { child: buildAlert( context: context, timestamp: date, - username: listMessage[index]["message"], - description: listMessage[index] + username: listMessage![index]["message"], + description: listMessage![index] ["message"] + - setDescription(listMessage[index] + setDescription(listMessage![index] ["notificationType"]), - thumbnail: listMessage[index] + thumbnail: listMessage![index] ["thumbnail"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -458,7 +460,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -467,7 +469,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["timestamp"] + key: Key(listMessage![index]["timestamp"] .toString()), background: Container( height: 100, @@ -493,14 +495,14 @@ class _AlertsState extends State { child: buildAlert( context: context, timestamp: date, - username: listMessage[index]["message"], - description: listMessage[index] + username: listMessage![index]["message"], + description: listMessage![index] ["message"] + - setDescription(listMessage[index] + setDescription(listMessage![index] ["notificationType"]), - thumbnail: listMessage[index] + thumbnail: listMessage![index] ["thumbnail"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -508,7 +510,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -519,29 +521,29 @@ class _AlertsState extends State { child: buildPersonalizedAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), decline: () => FirebaseFirestore.instance .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }), accept: () { var coup = jsonDecode( - listMessage[index]["coupon"]); + listMessage![index]["coupon"]); CouponsHead head = new CouponsHead(); head.businessId = coup["BusinessId"]; head.couponId = - listMessage[index].reference.id; + listMessage![index].reference.id; head.expiration = DateTime.parse( coup["Expiration"].toString()); head.lower = coup["LowerLimit"]; head.quantity = 1; - head.state = listMessage[index] + head.state = listMessage![index] ["couponCondition"]; head.targetProduct = coup["TargetProduct"]; @@ -557,7 +559,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index].reference.id), + key: Key(listMessage![index].reference.id), background: Container( height: 100, decoration: BoxDecoration( @@ -582,10 +584,10 @@ class _AlertsState extends State { child: buildRedeemableAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -593,7 +595,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -602,7 +604,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index].reference.id), + key: Key(listMessage![index].reference.id), background: Container( height: 100, decoration: BoxDecoration( @@ -627,8 +629,8 @@ class _AlertsState extends State { child: buildRefundAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - icons: iconIndicator(listMessage[index] + message: listMessage![index]["message"], + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -636,7 +638,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -645,7 +647,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index].reference.id), + key: Key(listMessage![index].reference.id), background: Container( height: 100, decoration: BoxDecoration( @@ -670,8 +672,8 @@ class _AlertsState extends State { child: buildRefundAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - icons: iconIndicator(listMessage[index] + message: listMessage![index]["message"], + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -679,7 +681,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -688,7 +690,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index].reference.id), + key: Key(listMessage![index].reference.id), background: Container( height: 100, decoration: BoxDecoration( @@ -713,10 +715,10 @@ class _AlertsState extends State { child: buildPostAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["assetID"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -724,7 +726,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -733,7 +735,7 @@ class _AlertsState extends State { return Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( - key: Key(listMessage[index]["couponID"]), + key: Key(listMessage![index]["couponID"]), background: Container( height: 100, decoration: BoxDecoration( @@ -758,10 +760,10 @@ class _AlertsState extends State { child: buildRedeemableAlert( context: context, timestamp: date, - message: listMessage[index]["message"], - thumbnail: listMessage[index] + message: listMessage![index]["message"], + thumbnail: listMessage![index] ["productImage"], - icons: iconIndicator(listMessage[index] + icons: iconIndicator(listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -769,7 +771,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); @@ -781,7 +783,7 @@ class _AlertsState extends State { EdgeInsets.symmetric(vertical: 8.0), child: Dismissible( key: Key( - listMessage[index]["relationID"]), + listMessage![index]["relationID"]), background: Container( height: 100, decoration: BoxDecoration( @@ -806,16 +808,16 @@ class _AlertsState extends State { child: buildAlert( context: context, timestamp: date, - username: listMessage[index] + username: listMessage![index] ["initiatorUsername"], - description: listMessage[index] + description: listMessage![index] ["initiatorUsername"] + - setDescription(listMessage[index] + setDescription(listMessage![index] ["notificationType"]), - thumbnail: listMessage[index] + thumbnail: listMessage![index] ["initiatorThumbnail"], icons: iconIndicator( - listMessage[index] + listMessage![index] ["notificationType"]), ), onDismissed: (direction) { @@ -823,7 +825,7 @@ class _AlertsState extends State { .runTransaction( (transaction) async { transaction.delete( - listMessage[index].reference); + listMessage![index].reference); }); }), ); diff --git a/lib/Pages/Sub_Pages/Notifications/ChatScreen.dart b/lib/Pages/Sub_Pages/Notifications/ChatScreen.dart index 08a4481..24b5cdd 100644 --- a/lib/Pages/Sub_Pages/Notifications/ChatScreen.dart +++ b/lib/Pages/Sub_Pages/Notifications/ChatScreen.dart @@ -19,34 +19,34 @@ import 'package:teso/util/consts.dart'; import 'package:http/http.dart' as http; class ChatScreen extends StatefulWidget { - final TesoUser user; + final TesoUser? user; - const ChatScreen({Key key, this.user}) : super(key: key); + const ChatScreen({Key? key, this.user}) : super(key: key); @override _ChatScreenState createState() => _ChatScreenState(user: this.user); } class _ChatScreenState extends State { final datakey = new GlobalKey(); - TesoUser user; + TesoUser? user; _ChatScreenState({this.user}); TextEditingController controller = new TextEditingController(); bool first = true; - String id; + String? id; - List listMessage = new List.from([]); + List? listMessage = new List.from([]); int _limit = 20; final int _limitIncrement = 20; - String groupChatId; - SharedPreferences prefs; + String? groupChatId; + late SharedPreferences prefs; final ScrollController listScrollController = ScrollController(); - File imageFile; - bool isLoading; - bool isShowSticker; - String imageUrl; - TesoUser currentUser; - Future _future; - Timer timer; + File? imageFile; + bool? isLoading; + bool? isShowSticker; + String? imageUrl; + TesoUser? currentUser; + Future? _future; + Timer? timer; int counter = 0; _scrollListener() { @@ -76,7 +76,7 @@ class _ChatScreenState extends State { var documentReference = FirebaseFirestore.instance .collection('messages') .doc(groupChatId) - .collection(groupChatId) + .collection(groupChatId!) .doc(DateTime.now().millisecondsSinceEpoch.toString()); FirebaseFirestore.instance.runTransaction((transaction) async { @@ -84,7 +84,7 @@ class _ChatScreenState extends State { documentReference, { 'idFrom': id, - 'idTo': user.userGUID, + 'idTo': user!.userGUID, 'timestamp': DateTime.now().millisecondsSinceEpoch.toString(), 'content': content.trim(), 'type': type, @@ -104,20 +104,20 @@ class _ChatScreenState extends State { inboxReference1, { 'senderID': id, - 'peerID': user.userGUID, + 'peerID': user!.userGUID, 'timestamp': DateTime.now().millisecondsSinceEpoch.toString(), 'content': content.trim(), - 'firstname': user.firstname, - 'surname': user.lastname, - 'thumbnail': user.thumbnail_dp, - 'username': user.username, + 'firstname': user!.firstname, + 'surname': user!.lastname, + 'thumbnail': user!.thumbnail_dp, + 'username': user!.username, 'read': false }, ); }); var inboxReference2 = FirebaseFirestore.instance .collection('inbox') - .doc(user.userGUID) + .doc(user!.userGUID) .collection("lastMessage") .doc(groupChatId); @@ -129,10 +129,10 @@ class _ChatScreenState extends State { 'peerID': id, 'timestamp': DateTime.now().millisecondsSinceEpoch.toString(), 'content': content.trim(), - 'firstname': currentUser.firstname, - 'surname': currentUser.lastname, - 'thumbnail': currentUser.thumbnail_dp, - 'username': currentUser.username, + 'firstname': currentUser!.firstname, + 'surname': currentUser!.lastname, + 'thumbnail': currentUser!.thumbnail_dp, + 'username': currentUser!.username, 'read': false }, ); @@ -159,7 +159,7 @@ class _ChatScreenState extends State { FirebaseFirestore.instance .collection('inbox') - .doc(user.userGUID) + .doc(user!.userGUID) .collection("lastMessage") .doc(groupChatId) .update({"read": true}); @@ -191,15 +191,15 @@ class _ChatScreenState extends State { readLocal() async { prefs = await SharedPreferences.getInstance(); id = prefs.getString('id') ?? ''; - if (id.hashCode <= user.userGUID.hashCode) { - groupChatId = id + user.userGUID; + if (id.hashCode <= user!.userGUID.hashCode) { + groupChatId = id! + user!.userGUID!; } else { - groupChatId = user.userGUID + id; + groupChatId = user!.userGUID! + id!; } FirebaseFirestore.instance .collection('users') .doc(id) - .update({'chattingWith': user.userGUID, 'typing': false}); + .update({'chattingWith': user!.userGUID, 'typing': false}); setState(() {}); } @@ -208,26 +208,26 @@ class _ChatScreenState extends State { FirebaseFirestore.instance .collection('users') .doc(id) - .update({'chattingWith': user.userGUID, 'typing': value}); + .update({'chattingWith': user!.userGUID, 'typing': value}); } - Future findUser() async { - TesoUser loadedUser; + Future findUser() async { + TesoUser? loadedUser; SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; - String auth = user.userGUID; + String? auth = user!.userGUID; var register2 = serverLocation + 'users/finduser'; var client1 = await http.post(Uri.parse(register2), body: json.encode(auth), headers: requestHeaders); if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TesoUser tokenHandler = TesoUser.fromJSON(handler); + TesoUser tokenHandler = TesoUser.fromJSON(handler as Map); setState(() { user = tokenHandler; loadedUser = user; @@ -258,11 +258,10 @@ class _ChatScreenState extends State { child: FutureBuilder( future: _future, builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasData == null || - snapshot.connectionState == ConnectionState.waiting) { - return buildChatHead(context, user); + if (snapshot.connectionState == ConnectionState.waiting) { + return buildChatHead(context, user!); } else { - return buildChatHead(context, user); + return buildChatHead(context, user!); } }, ), @@ -279,11 +278,11 @@ class _ChatScreenState extends State { stream: FirebaseFirestore.instance .collection('messages') .doc(groupChatId) - .collection(groupChatId) + .collection(groupChatId!) .orderBy('timestamp', descending: true) .limit(_limit) .snapshots(), - builder: (context, snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { if (!snapshot.hasData) { return Center( child: CircularProgressIndicator( @@ -295,32 +294,33 @@ class _ChatScreenState extends State { valueColor: AlwaysStoppedAnimation( Theme.of(context).primaryColor))); } else { - listMessage = snapshot.data.docs; + listMessage = snapshot.data!.docs; return ListView.builder( padding: EdgeInsets.all(10.0), - itemCount: listMessage.length, + itemCount: listMessage!.length, itemBuilder: (context, index) { - if (snapshot.data.docs[index].data()['idTo'] == id && - snapshot.data.docs[index].data()['read'] == false) { - readMessage(listMessage[index].reference); + if (snapshot.data!.docs[index]['idTo'] == id && + snapshot.data!.docs[index]['read'] == false) { + readMessage(listMessage![index].reference); } int timeInMillis = int.parse( - snapshot.data.docs[index].data()['timestamp']); + snapshot.data!.docs[index]['timestamp']); var date = DateTime.fromMillisecondsSinceEpoch(timeInMillis); var formattedDate = DateFormat("yyyy-MM-dd HH:mm:ss").format(date); ChatMessage message = new ChatMessage(); message.idFrom = - snapshot.data.docs[index].data()['idFrom']; + snapshot.data!.docs[index]['idFrom']; message.content = - snapshot.data.docs[index].data()['content']; - message.idTo = snapshot.data.docs[index].data()['idTo']; + snapshot.data!.docs[index]['content']; + message.idTo = snapshot.data!.docs[index]['idTo']; message.timestamp = DateTime.parse(formattedDate); - message.type = int.parse(snapshot.data.docs[index] - .data()['type'] + message.type = int.parse(snapshot.data! + .docs[index] + ['type'] .toString()); - if (snapshot.data.docs[index].data()['idFrom'] == id) { + if (snapshot.data!.docs[index]['idFrom'] == id) { return buildSender(context, message); } else { return buildRecipient(context, message); diff --git a/lib/Pages/Sub_Pages/Notifications/Inbox.dart b/lib/Pages/Sub_Pages/Notifications/Inbox.dart index 89d5fe2..ec685be 100644 --- a/lib/Pages/Sub_Pages/Notifications/Inbox.dart +++ b/lib/Pages/Sub_Pages/Notifications/Inbox.dart @@ -14,22 +14,22 @@ import 'package:provider/provider.dart'; import 'package:flutter/cupertino.dart'; class Inbox extends StatefulWidget { - final TesoUser user; + final TesoUser? user; - const Inbox({Key key, this.user}) : super(key: key); + const Inbox({Key? key, this.user}) : super(key: key); @override _InboxState createState() => _InboxState(user: this.user); } class _InboxState extends State { - final TesoUser user; - TesoUser currentUser = new TesoUser(); + final TesoUser? user; + TesoUser? currentUser = new TesoUser(); TextEditingController controller = new TextEditingController(); - Uint8List bytes; - List listMessage = new List.from([]); - String id; - SharedPreferences prefs; - Timer timer; + Uint8List? bytes; + List? listMessage = new List.from([]); + String? id; + late SharedPreferences prefs; + Timer? timer; int counter = 0; _InboxState({this.user}); @@ -71,7 +71,7 @@ class _InboxState extends State { .collection("lastMessage") .orderBy("timestamp", descending: false) .snapshots(), - builder: (context, snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.data == null) { return Container( child: Center( @@ -82,45 +82,45 @@ class _InboxState extends State { ), ); } else { - listMessage = snapshot.data.docs; + listMessage = snapshot.data!.docs; return ListView.builder( padding: EdgeInsets.all(5.0), - itemCount: listMessage.length, + itemCount: listMessage!.length, itemBuilder: (context, index) { int timeInMillis = - int.parse(snapshot.data.docs[index].data()['timestamp']); + int.parse(snapshot.data!.docs[index]['timestamp']); var date = DateTime.fromMillisecondsSinceEpoch(timeInMillis); var formattedDate = DateFormat("yyyy-MM-dd HH:mm:ss").format(date); TesoUser username = new TesoUser(); username.userGUID = - snapshot.data.docs[index].data()['peerID']; + snapshot.data!.docs[index]['peerID']; username.firstname = - snapshot.data.docs[index].data()['firstname']; + snapshot.data!.docs[index]['firstname']; username.lastname = - snapshot.data.docs[index].data()['surname']; + snapshot.data!.docs[index]['surname']; username.thumbnail_dp = - snapshot.data.docs[index].data()['thumbnail']; + snapshot.data!.docs[index]['thumbnail']; username.username = - snapshot.data.docs[index].data()['username']; + snapshot.data!.docs[index]['username']; InboxMessage message = new InboxMessage(); message.bio = ""; - message.userID = snapshot.data.docs[index].data()['peerID']; + message.userID = snapshot.data!.docs[index]['peerID']; message.firstname = - snapshot.data.docs[index].data()['firstname']; - message.surname = snapshot.data.docs[index].data()['surname']; + snapshot.data!.docs[index]['firstname']; + message.surname = snapshot.data!.docs[index]['surname']; message.thumbnail = - snapshot.data.docs[index].data()['thumbnail']; - message.message = snapshot.data.docs[index].data()['content']; + snapshot.data!.docs[index]['thumbnail']; + message.message = snapshot.data!.docs[index]['content']; message.timestamp = DateTime.parse(formattedDate); - message.messageID = listMessage[index].reference.toString(); + message.messageID = listMessage![index].reference.toString(); bool status; - if (snapshot.data.docs[index].data()['senderID'] == id) { + if (snapshot.data!.docs[index]['senderID'] == id) { status = true; - } else if (snapshot.data.docs[index].data()['senderID'] != + } else if (snapshot.data!.docs[index]['senderID'] != id && - !listMessage[index]['read']) { + !listMessage![index]['read']) { status = false; } else { status = true; diff --git a/lib/Pages/Sub_Pages/Notifications/newMessage.dart b/lib/Pages/Sub_Pages/Notifications/newMessage.dart index c9fba86..9592058 100644 --- a/lib/Pages/Sub_Pages/Notifications/newMessage.dart +++ b/lib/Pages/Sub_Pages/Notifications/newMessage.dart @@ -18,10 +18,10 @@ class NewMessage extends StatefulWidget { } class _NewMessageState extends State { - TextEditingController searchkey; + TextEditingController? searchkey; List recipientMain = []; - List recipient; - SharedPreferences prefs; + late List recipient; + late SharedPreferences prefs; void clearText() { setState(() { @@ -42,7 +42,7 @@ class _NewMessageState extends State { Future loadFriends() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -57,7 +57,7 @@ class _NewMessageState extends State { recipient = recipientMain; recipient.sort((a, b) { - return b.firstname.compareTo(a.firstname); + return b.firstname!.compareTo(a.firstname!); }); } @@ -65,10 +65,10 @@ class _NewMessageState extends State { setState(() { recipient = recipientMain .where((element) => - element.username.toLowerCase().contains(name.toLowerCase())) + element.username!.toLowerCase().contains(name.toLowerCase())) .toList(); recipient.sort((a, b) { - return b.firstname.compareTo(a.firstname); + return b.firstname!.compareTo(a.firstname!); }); }); } @@ -88,7 +88,7 @@ class _NewMessageState extends State { ), body: Consumer( builder: (context, value, child) { - if (value.friends == null) { + if (value.friends.isEmpty) { return Center( child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation( @@ -101,7 +101,7 @@ class _NewMessageState extends State { recipient = value.friends; } recipient.sort((a, b) { - return b.firstname.compareTo(a.firstname); + return b.firstname!.compareTo(a.firstname!); }); return ListView.builder( itemCount: recipient.length, diff --git a/lib/Pages/Sub_Pages/Payments/PaymentView.dart b/lib/Pages/Sub_Pages/Payments/PaymentView.dart index 3868ca5..73442d3 100644 --- a/lib/Pages/Sub_Pages/Payments/PaymentView.dart +++ b/lib/Pages/Sub_Pages/Payments/PaymentView.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; class PaymentView extends StatefulWidget { - final String selectedUrl; + final String? selectedUrl; PaymentView({this.selectedUrl}); @@ -16,9 +16,10 @@ class _PaymentViewState extends State { @override void initState() { super.initState(); + // ignore: unnecessary_cast flutterWebviewPlugin.onBack.listen((event) { Navigator.pop(context); - }); + } as void Function(Null)?); flutterWebviewPlugin.onUrlChanged.listen((String url) { print(url); if (url.contains("#access_token")) { @@ -56,7 +57,7 @@ class _PaymentViewState extends State { height: MediaQuery.of(context).size.height, margin: EdgeInsets.only(top: 10), child: WebviewScaffold( - url: widget.selectedUrl, + url: widget.selectedUrl!, scrollBar: true, ), ), diff --git a/lib/Pages/Sub_Pages/Payments/Withdrawal.dart b/lib/Pages/Sub_Pages/Payments/Withdrawal.dart index 27cfc0d..e293d74 100644 --- a/lib/Pages/Sub_Pages/Payments/Withdrawal.dart +++ b/lib/Pages/Sub_Pages/Payments/Withdrawal.dart @@ -12,10 +12,10 @@ import 'package:teso/util/consts.dart'; import 'package:http/http.dart' as http; class WithdrawalPage extends StatefulWidget { - final String momonumber; - final String amount; - final String provider; - const WithdrawalPage({Key key, this.momonumber, this.amount, this.provider}) + final String? momonumber; + final String? amount; + final String? provider; + const WithdrawalPage({Key? key, this.momonumber, this.amount, this.provider}) : super(key: key); @override @@ -23,18 +23,18 @@ class WithdrawalPage extends StatefulWidget { } class _WithdrawalPageState extends State { - String processing = "Processing request, please wait"; + String? processing = "Processing request, please wait"; bool confirmBox = false; - String recipientName = ""; - String currency; - String image; + String? recipientName = ""; + String? currency; + late String image; submit() async { - String num = widget.momonumber; - String provider = widget.provider; + String? num = widget.momonumber; + String? provider = widget.provider; try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -72,18 +72,18 @@ class _WithdrawalPageState extends State { setState(() { confirmBox = false; }); - String num = widget.momonumber; - String withdraw = widget.amount; - String provider = widget.provider; + String? num = widget.momonumber; + String? withdraw = widget.amount; + String? provider = widget.provider; try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - Map body = { + Map body = { "provider": provider, "number": num, "amount": withdraw, @@ -172,7 +172,7 @@ class _WithdrawalPageState extends State { animating: true, radius: 15, ) - : processing.contains("successfully") + : processing!.contains("successfully") ? Icon( Icons.check_circle, color: Colors.green, @@ -189,7 +189,7 @@ class _WithdrawalPageState extends State { ), Container( child: Text( - processing, + processing!, textAlign: TextAlign.center, style: TextStyle( fontSize: SizeConfig.safeBlockHorizontal * 3.8, diff --git a/lib/Pages/Sub_Pages/PersonalSub/Categories.dart b/lib/Pages/Sub_Pages/PersonalSub/Categories.dart index 95868a0..b58d7ba 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/Categories.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/Categories.dart @@ -31,7 +31,7 @@ class _CategoriesState extends State { super.initState(); } - void setFavorites(String id) { + void setFavorites(String? id) { switch (id) { case "TECAT001": setState(() { @@ -299,6 +299,7 @@ class _CategoriesState extends State { scrollDirection: Axis.vertical, child: Consumer( builder: (context, value, child) { + // ignore: unnecessary_null_comparison if (value == null) { return Container( child: Center( @@ -311,7 +312,7 @@ class _CategoriesState extends State { } else { if (fresh) { if (value.interest != null) - value.interest.forEach((element) { + value.interest!.forEach((element) { Future.delayed(Duration.zero, () async { setFavorites(element); }); diff --git a/lib/Pages/Sub_Pages/PersonalSub/CompleteProfile.dart b/lib/Pages/Sub_Pages/PersonalSub/CompleteProfile.dart index 7af3259..61d764a 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/CompleteProfile.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/CompleteProfile.dart @@ -17,11 +17,11 @@ class CompleteProfile extends StatefulWidget { class _CompleteProfileState extends State { DateFormat dateFormat = DateFormat("EEEE dd-MM-yyyy"); DateTime selectedDate = DateTime.now(); - String selectedGender; + String? selectedGender; List gender = ["Male", "Female", "Other"]; bool error = false; String message = ""; - String olduser; + String? olduser; void changeDate(v) { setState(() { @@ -40,10 +40,10 @@ class _CompleteProfileState extends State { completeProfile() async { if (selectedDate.year != DateTime.now().year || selectedGender == null || - selectedGender.isEmpty) { + selectedGender!.isEmpty) { SharedPreferences.getInstance().then((prefs) async { Map user = - jsonDecode(prefs.getString("currentUser")) as Map; + jsonDecode(prefs.getString("currentUser")!) as Map; TesoUser currentuser = TesoUser.fromJSON(user); currentuser.dateOfBirth = selectedDate; currentuser.gender = selectedGender; @@ -52,7 +52,7 @@ class _CompleteProfileState extends State { }).whenComplete(() { SharedPreferences.getInstance().then((prefs) async { if (prefs.getString("currentUser") == null) { - prefs.setString("currentUser", olduser); + prefs.setString("currentUser", olduser!); setState(() { error = true; message = @@ -71,7 +71,7 @@ class _CompleteProfileState extends State { Navigator.pop(context); } else { Map user = - jsonDecode(olduser) as Map; + jsonDecode(olduser!) as Map; TesoUser currentuser = TesoUser.fromJSON(user); currentuser.dateOfBirth = selectedDate; currentuser.gender = selectedGender; diff --git a/lib/Pages/Sub_Pages/PersonalSub/Friends.dart b/lib/Pages/Sub_Pages/PersonalSub/Friends.dart index caead32..afbe036 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/Friends.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/Friends.dart @@ -14,14 +14,14 @@ class Friends extends StatefulWidget { } class _FriendsState extends State { - TextEditingController searchkey; + TextEditingController? searchkey; List friendsMain = []; - List friends; - SharedPreferences prefs; + late List friends; + SharedPreferences? prefs; void clearText() { setState(() { - searchkey.clear(); + searchkey!.clear(); }); } @@ -35,10 +35,10 @@ class _FriendsState extends State { setState(() { friends = friendsMain .where((element) => - element.username.toLowerCase().contains(name.toLowerCase())) + element.username!.toLowerCase().contains(name.toLowerCase())) .toList(); friends.sort((a, b) { - return b.firstname.compareTo(a.firstname); + return b.firstname!.compareTo(a.firstname!); }); }); } @@ -53,7 +53,7 @@ class _FriendsState extends State { ), body: Consumer( builder: (context, value, child) { - if (value.friends == null) { + if (value.friends.isEmpty) { return Center( child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation( @@ -64,7 +64,7 @@ class _FriendsState extends State { friends = value.friends; } friends.sort((a, b) { - return b.firstname.compareTo(a.firstname); + return b.firstname!.compareTo(a.firstname!); }); return ListView.builder( itemCount: friends.length, diff --git a/lib/Pages/Sub_Pages/PersonalSub/Recently.dart b/lib/Pages/Sub_Pages/PersonalSub/Recently.dart index dce4e47..6031f62 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/Recently.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/Recently.dart @@ -17,10 +17,10 @@ class Recently extends StatefulWidget { } class _RecentlyState extends State { - TesoUser currentUser; + TesoUser? currentUser; int _limit = 20; final int _limitIncrement = 20; - List coupons = new List.from([]); + List? coupons = new List.from([]); final ScrollController listScrollController = ScrollController(); @override @@ -63,7 +63,8 @@ class _RecentlyState extends State { @override Widget build(BuildContext context) { return Consumer( - builder: (BuildContext context, UserProvider user, Widget child) { + builder: (BuildContext context, UserProvider user, Widget? child) { + // ignore: unnecessary_null_comparison if (user == null) { return Center( child: CupertinoActivityIndicator( @@ -77,11 +78,11 @@ class _RecentlyState extends State { stream: FirebaseFirestore.instance .collection('recentlyViewed') .doc("users") - .collection(currentUser.userGUID) + .collection(currentUser!.userGUID!) .orderBy('dateViewed', descending: true) .limit(_limit) .snapshots(), - builder: (context, snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { if (!snapshot.hasData) { return Center( child: CircularProgressIndicator( @@ -93,73 +94,73 @@ class _RecentlyState extends State { valueColor: AlwaysStoppedAnimation( Theme.of(context).primaryColor))); } else { - coupons = snapshot.data.docs; + coupons = snapshot.data!.docs; return ListView.builder( - itemCount: coupons.length, + itemCount: coupons!.length, controller: listScrollController, itemBuilder: (context, int index) { - if (coupons.length <= 0) { + if (coupons!.length <= 0) { return Container(); } else { CouponDetails couponDetails = new CouponDetails(); couponDetails.issuer = new TesoBusinessDetail(); couponDetails.targetProduct = new Product(); couponDetails.businessId = - snapshot.data.docs[index].data()['businessId']; + snapshot.data!.docs[index]['businessId']; couponDetails.couponId = - snapshot.data.docs[index].data()['couponId']; + snapshot.data!.docs[index]['couponId']; couponDetails.expiration = DateTime.parse(snapshot - .data.docs[index] - .data()['expiration'] + .data!.docs[index] + ['expiration'] .toString()); couponDetails.type = - snapshot.data.docs[index].data()['type']; + snapshot.data!.docs[index]['type']; couponDetails.quantity = int.parse(snapshot - .data.docs[index] - .data()['quantity'] + .data!.docs[index] + ['quantity'] .toString()); couponDetails.worth = double.parse(snapshot - .data.docs[index] - .data()['worth'] + .data!.docs[index] + ['worth'] .toString()); couponDetails.state = - snapshot.data.docs[index].data()['state']; + snapshot.data!.docs[index]['state']; couponDetails.productCost = double.parse(snapshot - .data.docs[index] - .data()['unitPrice'] + .data!.docs[index] + ['unitPrice'] .toString()); - couponDetails.issuer.businessAddress = - snapshot.data.docs[index].data()['businessAddress']; - couponDetails.issuer.businessContact = - snapshot.data.docs[index].data()['businessContact']; - couponDetails.issuer.businessDescription = snapshot - .data.docs[index] - .data()['businessDescription']; - couponDetails.issuer.businessLat = - snapshot.data.docs[index].data()['businessLat']; - couponDetails.issuer.businessLng = - snapshot.data.docs[index].data()['businessLng']; - couponDetails.issuer.businessLogo = - snapshot.data.docs[index].data()['businessLogo']; - couponDetails.issuer.businessName = - snapshot.data.docs[index].data()['businessName']; - couponDetails.targetProduct.productID = - snapshot.data.docs[index].data()['productId']; - couponDetails.targetProduct.productName = - snapshot.data.docs[index].data()['name']; - couponDetails.targetProduct.productImage = - snapshot.data.docs[index].data()['productImage']; - couponDetails.targetProduct.unitPrice = double.parse( - snapshot.data.docs[index] - .data()['unitPrice'] + couponDetails.issuer!.businessAddress = + snapshot.data!.docs[index]['businessAddress']; + couponDetails.issuer!.businessContact = + snapshot.data!.docs[index]['businessContact']; + couponDetails.issuer!.businessDescription = snapshot + .data!.docs[index] + ['businessDescription']; + couponDetails.issuer!.businessLat = + snapshot.data!.docs[index]['businessLat']; + couponDetails.issuer!.businessLng = + snapshot.data!.docs[index]['businessLng']; + couponDetails.issuer!.businessLogo = + snapshot.data!.docs[index]['businessLogo']; + couponDetails.issuer!.businessName = + snapshot.data!.docs[index]['businessName']; + couponDetails.targetProduct!.productID = + snapshot.data!.docs[index]['productId']; + couponDetails.targetProduct!.productName = + snapshot.data!.docs[index]['name']; + couponDetails.targetProduct!.productImage = + snapshot.data!.docs[index]['productImage']; + couponDetails.targetProduct!.unitPrice = double.parse( + snapshot.data!.docs[index] + ['unitPrice'] .toString()); couponDetails.lowerLimit = double.parse(snapshot - .data.docs[index] - .data()['lowerLimit'] + .data!.docs[index] + ['lowerLimit'] .toString()); couponDetails.upperLimit = double.parse(snapshot - .data.docs[index] - .data()['upperLimit'] + .data!.docs[index] + ['upperLimit'] .toString()); return buildRecentItem( context, couponDetails, tesoCouponDialog); diff --git a/lib/Pages/Sub_Pages/PersonalSub/Referral.dart b/lib/Pages/Sub_Pages/PersonalSub/Referral.dart index 91cedc5..54e23cb 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/Referral.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/Referral.dart @@ -1,4 +1,3 @@ -import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -8,14 +7,14 @@ import 'package:teso/util/SizeConfig.dart'; import 'package:teso/util/consts.dart'; class Referrals extends StatefulWidget { - const Referrals({Key key}) : super(key: key); + const Referrals({Key? key}) : super(key: key); @override _ReferralsState createState() => _ReferralsState(); } class _ReferralsState extends State { - String refLink = ""; + String? refLink = ""; @override void initState() { SharedPreferences.getInstance().then((value) async { @@ -23,7 +22,7 @@ class _ReferralsState extends State { refLink = value.getString("referral"); }); if (refLink == null) { - String uid = value.getString("id"); + String? uid = value.getString("id"); // final ShortDynamicLink shortenedLink = // await DynamicLinkParameters.shortenUrl( // Uri.parse(dynamiclinkprefix + @@ -37,7 +36,7 @@ class _ReferralsState extends State { setState(() { // refLink = shortenedLink.shortUrl.toString(); }); - value.setString("referral", refLink); + value.setString("referral", refLink!); } }); super.initState(); @@ -47,7 +46,7 @@ class _ReferralsState extends State { Widget build(BuildContext context) { SizeConfig().init(context); return Scaffold( - body: refLink != null && refLink.isNotEmpty + body: refLink != null && refLink!.isNotEmpty ? Stack( children: [ Container( @@ -178,7 +177,7 @@ class _ReferralsState extends State { ), width: MediaQuery.of(context).size.width * 0.8, child: Text( - refLink, + refLink!, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.normal, @@ -205,7 +204,7 @@ class _ReferralsState extends State { child: TextButton.icon( onPressed: () => Share.share( 'Join Teso App using my referral link and earn 5 silver coins ' + - refLink, + refLink!, subject: 'Teso App!'), icon: Icon( Icons.share, diff --git a/lib/Pages/Sub_Pages/PersonalSub/Settings.dart b/lib/Pages/Sub_Pages/PersonalSub/Settings.dart index 76db822..13dc874 100644 --- a/lib/Pages/Sub_Pages/PersonalSub/Settings.dart +++ b/lib/Pages/Sub_Pages/PersonalSub/Settings.dart @@ -16,9 +16,9 @@ import 'package:teso/providers/device_provider.dart'; import 'package:teso/util/consts.dart'; class Setting extends StatefulWidget { - final Function logOut; - final List connectedCameras; - const Setting({Key key, this.logOut, this.connectedCameras}) + final Function? logOut; + final List? connectedCameras; + const Setting({Key? key, this.logOut, this.connectedCameras}) : super(key: key); @override @@ -26,17 +26,17 @@ class Setting extends StatefulWidget { } class _SettingState extends State { - Function logOut; + Function? logOut; _SettingState({this.logOut}); bool enabled = true; - TesoUser currentUser; + TesoUser? currentUser; @override void initState() { super.initState(); } - void editProfileDialog(context, TesoUser user) { + void editProfileDialog(context, TesoUser? user) { showModalBottomSheet( context: context, isScrollControlled: true, @@ -114,7 +114,7 @@ class _SettingState extends State { ), ), new Consumer( - builder: (BuildContext context, UserProvider user, Widget child) { + builder: (BuildContext context, UserProvider user, Widget? child) { if (user.currentUser == null) { return Container(); } else { @@ -194,7 +194,7 @@ class _SettingState extends State { child: Text("Actions"), ), new Consumer(builder: - (BuildContext context, DeviceProvider value, Widget child) { + (BuildContext context, DeviceProvider value, Widget? child) { return SwitchListTile( secondary: Icon(Icons.camera), title: Text( @@ -203,7 +203,7 @@ class _SettingState extends State { subtitle: Text( "Enabling coupon alerts would you allow receive proximity coupons"), value: - value.serviceEnabled == null ? false : value.serviceEnabled, + value.serviceEnabled == null ? false : value.serviceEnabled!, onChanged: (v) { Provider.of(context, listen: false) .toggleBackgroundMode(context); @@ -211,7 +211,7 @@ class _SettingState extends State { ); }), new Consumer(builder: - (BuildContext context, UserProvider value, Widget child) { + (BuildContext context, UserProvider value, Widget? child) { return SwitchListTile( secondary: Icon( Icons.dark_mode_outlined, @@ -236,7 +236,7 @@ class _SettingState extends State { }), new ListTile( title: new Text('Log out'), - onTap: () => logOut(), + onTap: () => logOut!(), ), ], ), diff --git a/lib/Pages/Sub_Pages/PopUp/Personalized.dart b/lib/Pages/Sub_Pages/PopUp/Personalized.dart index c2c2a15..c5b2eae 100644 --- a/lib/Pages/Sub_Pages/PopUp/Personalized.dart +++ b/lib/Pages/Sub_Pages/PopUp/Personalized.dart @@ -14,9 +14,9 @@ import 'package:teso/Pages/PageWidgets/Coupons/personalizedFreebie.dart'; import 'package:teso/util/consts.dart'; class PersonalCoupon extends StatefulWidget { - final CouponDetails details; - final CouponsHead head; - const PersonalCoupon({Key key, this.details, this.head}) : super(key: key); + final CouponDetails? details; + final CouponsHead? head; + const PersonalCoupon({Key? key, this.details, this.head}) : super(key: key); @override _PersonalCouponState createState() => _PersonalCouponState(); @@ -32,7 +32,7 @@ class _PersonalCouponState extends State { try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestheaders = { 'Content-type': 'application/json', 'Authorization': token @@ -126,11 +126,11 @@ class _PersonalCouponState extends State { width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height * 0.85, padding: EdgeInsets.only(top: 25), - child: widget.head.type == "TESCP006" + child: widget.head!.type == "TESCP006" ? buildPersonalizedFreebieCoupon( - context, widget.details, acceptCoupon) + context, widget.details!, acceptCoupon) : buildPersonalizedDiscountCoupon( - context, widget.details, acceptCoupon)), + context, widget.details!, acceptCoupon)), ), Visibility( visible: acquiring, diff --git a/lib/Pages/Sub_Pages/ProductDetails/CouponList.dart b/lib/Pages/Sub_Pages/ProductDetails/CouponList.dart index 8e066d6..f0f4b06 100644 --- a/lib/Pages/Sub_Pages/ProductDetails/CouponList.dart +++ b/lib/Pages/Sub_Pages/ProductDetails/CouponList.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:provider/provider.dart'; @@ -9,16 +10,16 @@ import 'package:teso/Pages/PageWidgets/CouponsList/activeFreebieCoupon.dart'; import 'package:teso/providers/device_provider.dart'; class CouponList extends StatefulWidget { - final List couponsList; + final List? couponsList; - const CouponList({Key key, this.couponsList}) : super(key: key); + const CouponList({Key? key, this.couponsList}) : super(key: key); @override _CouponListState createState() => _CouponListState(coupons: this.couponsList); } class _CouponListState extends State { bool acquiring = false; - List coupons; + List? coupons; _CouponListState({this.coupons}); Future acquringCoupon(CouponsHead head, int cost) async { setState(() { @@ -33,9 +34,8 @@ class _CouponListState extends State { void calculateWorth(worth, CouponDetails coupon) { setState(() { - final tile = coupons.firstWhere( - (item) => item.couponId == coupon.couponId, - orElse: () => null); + final tile = coupons!.firstWhereOrNull( + (item) => item.couponId == coupon.couponId); if (tile != null) setState(() => tile.worth = worth); }); } @@ -72,15 +72,15 @@ class _CouponListState extends State { padding: EdgeInsets.only(top: 25), child: ListView.builder( scrollDirection: Axis.horizontal, - itemCount: coupons.length, + itemCount: coupons!.length, itemBuilder: (context, index) { - if (coupons.elementAt(index).type.contains("FREEBIE")) { + if (coupons!.elementAt(index).type!.contains("FREEBIE")) { return buildFreebieCoupon( - context, coupons.elementAt(index), acquringCoupon); + context, coupons!.elementAt(index), acquringCoupon); } else { return buildActiveDiscountCoupon( context, - coupons.elementAt(index), + coupons!.elementAt(index), acquringCoupon, calculateWorth, ); diff --git a/lib/Pages/Sub_Pages/homeSub/MyCoupons.dart b/lib/Pages/Sub_Pages/homeSub/MyCoupons.dart index 16f2489..86805bf 100644 --- a/lib/Pages/Sub_Pages/homeSub/MyCoupons.dart +++ b/lib/Pages/Sub_Pages/homeSub/MyCoupons.dart @@ -16,7 +16,7 @@ class MyCoupons extends StatefulWidget { } class _MyCouponsState extends State { - SharedPreferences prefs; + SharedPreferences? prefs; @override void initState() { @@ -24,7 +24,7 @@ class _MyCouponsState extends State { } void _scanQRCode(context, CouponDetails img) async { - String result = await Navigator.push( + String? result = await Navigator.push( context, PageTransition( type: PageTransitionType.downToUp, @@ -64,7 +64,8 @@ class _MyCouponsState extends State { return Scaffold( body: Consumer( builder: (context, value, child) { - if (value == null || value.mycoupons == null) { + // ignore: unnecessary_null_comparison + if (value == null) { Provider.of(context, listen: false).getCoupons(); return Container( child: Center( diff --git a/lib/Pages/Sub_Pages/homeSub/ProximityCoupons.dart b/lib/Pages/Sub_Pages/homeSub/ProximityCoupons.dart index 93f5b6a..3bdc20b 100644 --- a/lib/Pages/Sub_Pages/homeSub/ProximityCoupons.dart +++ b/lib/Pages/Sub_Pages/homeSub/ProximityCoupons.dart @@ -18,15 +18,15 @@ class ProximityCoupons extends StatefulWidget { class _ProximityCouponsState extends State with TickerProviderStateMixin { - AnimationController _buttonController; - Animation rotate; - Animation right; - Animation bottom; - Animation width; + late AnimationController _buttonController; + late Animation rotate; + late Animation right; + late Animation bottom; + Animation? width; int flag = 0; List data = []; List selectedData = []; - double selectedDiscount; + double? selectedDiscount; double worth = 0; @override @@ -98,7 +98,7 @@ class _ProximityCouponsState extends State dismissImg(ProximityCoupon img) async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = img.business.businessId; + couponsHead.businessId = img.business!.businessId; couponsHead.expiration = img.expiration; couponsHead.couponId = img.couponId; couponsHead.quantity = img.quantity; @@ -116,7 +116,7 @@ class _ProximityCouponsState extends State addImg(ProximityCoupon img) async { CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = img.business.businessId; + couponsHead.businessId = img.business!.businessId; couponsHead.expiration = img.expiration; couponsHead.couponId = img.couponId; couponsHead.quantity = 1; @@ -124,7 +124,7 @@ class _ProximityCouponsState extends State couponsHead.lower = worth; couponsHead.upper = double.parse(img.upperLimit.toString()); couponsHead.targetProduct = img.targetID; - double price = (img.targetCost * (worth / 100)); + double price = (img.targetCost! * (worth / 100)); //Calculations int cost = CouponRateCalculator.getRate(price); @@ -167,7 +167,7 @@ class _ProximityCouponsState extends State extendBody: false, body: Consumer( builder: (context, value, child) { - if (!value.serviceEnabled) { + if (!value.serviceEnabled!) { return Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, @@ -224,7 +224,7 @@ class _ProximityCouponsState extends State ), ), ); - } else if (value.proximityCoupons == null || + } else if (value.proximityCoupons.isEmpty || value.proximityCoupons.length == 0) { return Center( child: Text("No coupons available in your location"), @@ -245,7 +245,7 @@ class _ProximityCouponsState extends State alignment: AlignmentDirectional.center, children: data.map((item) { if (data.indexOf(item) == dataLength - 1 && - item.type.toLowerCase().contains("discount")) { + item.type!.toLowerCase().contains("discount")) { selectedDiscount = item.lowerLimit; return buildActiveDiscountCoupon( item, @@ -262,7 +262,7 @@ class _ProximityCouponsState extends State worth, calculateWorth); } else if (data.indexOf(item) == dataLength - 1 && - item.type.toLowerCase().contains("freebie")) { + item.type!.toLowerCase().contains("freebie")) { return buildActiveFreebieCoupon( item, bottom.value, @@ -277,11 +277,11 @@ class _ProximityCouponsState extends State dismissImg, ); } else if (data.indexOf(item) < dataLength - 1 && - item.type.toLowerCase().contains("discount")) { + item.type!.toLowerCase().contains("discount")) { backCardPosition = backCardPosition - 10; backCardWidth = backCardWidth + 10; - double price = item.targetCost - - (item.targetCost * item.lowerLimit / 100); + double price = item.targetCost! - + (item.targetCost! * item.lowerLimit! / 100); return buildDummyDiscountCoupon( item, backCardPosition, @@ -296,8 +296,8 @@ class _ProximityCouponsState extends State } else { backCardPosition = backCardPosition - 10; backCardWidth = backCardWidth + 10; - double price = item.targetCost - - (item.targetCost * item.lowerLimit / 100); + double price = item.targetCost! - + (item.targetCost! * item.lowerLimit! / 100); return buildDummyFreebieCoupon( item, backCardPosition, diff --git a/lib/Pages/Sub_Pages/userProfile3P.dart b/lib/Pages/Sub_Pages/userProfile3P.dart index 813dbad..f6fd15e 100644 --- a/lib/Pages/Sub_Pages/userProfile3P.dart +++ b/lib/Pages/Sub_Pages/userProfile3P.dart @@ -20,10 +20,10 @@ import 'Notifications/ChatScreen.dart'; // ignore: must_be_immutable class UserProfileThirdPerson extends StatefulWidget { - TesoUser user; - final ThirdPerson fullProfile; + TesoUser? user; + final ThirdPerson? fullProfile; - UserProfileThirdPerson({Key key, this.user, this.fullProfile}) + UserProfileThirdPerson({Key? key, this.user, this.fullProfile}) : super(key: key); @override _UserProfileThirdPersonState createState() => _UserProfileThirdPersonState(); @@ -35,16 +35,16 @@ class _UserProfileThirdPersonState extends State with TickerProviderStateMixin { final datakey = new GlobalKey(); ThirdPerson userProfile = new ThirdPerson(); - int count; - ScrollController _controller, control, scrollController; + int? count; + late ScrollController _controller, control, scrollController; // AppBarBehavior _appBarBehavior = AppBarBehavior.pinned; - Animation width; - Animation heigth; - AnimationController _containerController; - double scale; + late Animation width; + late Animation heigth; + late AnimationController _containerController; + late double scale; bool available = false; bool scrolled = false; - SharedPreferences prefs; + late SharedPreferences prefs; bool addFriends = false; bool friends = false; bool pending = false; @@ -55,14 +55,14 @@ class _UserProfileThirdPersonState extends State Future getProfile() async { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; var register = serverLocation + 'user_details/pullProfile'; var client = await http.post(Uri.parse(register), - body: json.encode(widget.user.userGUID), headers: requestHeaders); + body: json.encode(widget.user!.userGUID), headers: requestHeaders); if (client.statusCode == 200) { var profile = jsonDecode(client.body); userProfile = ThirdPerson.fromJSON(profile); @@ -93,7 +93,7 @@ class _UserProfileThirdPersonState extends State count = 0; if (widget.fullProfile != null) { - third(widget.fullProfile); + third(widget.fullProfile!); } else { _future = getProfile(); } @@ -152,7 +152,7 @@ class _UserProfileThirdPersonState extends State }); break; } - if (fullProfile.user != null) widget.user = widget.fullProfile.user; + if (fullProfile.user != null) widget.user = widget.fullProfile!.user; // trends = fullProfile.posts; // await fetchImages(); @@ -168,12 +168,12 @@ class _UserProfileThirdPersonState extends State loading = false; }); prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = widget.user.userGUID; + String? searchValue = widget.user!.userGUID; var register = serverLocation + 'relationships/unfriend'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -205,12 +205,12 @@ class _UserProfileThirdPersonState extends State loading = false; }); prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = widget.user.userGUID; + String? searchValue = widget.user!.userGUID; var register = serverLocation + 'relationships/friendrequest'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -243,12 +243,12 @@ class _UserProfileThirdPersonState extends State loading = false; }); prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = widget.user.userGUID; + String? searchValue = widget.user!.userGUID; var register = serverLocation + 'relationships/friendapproval'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -282,12 +282,12 @@ class _UserProfileThirdPersonState extends State loading = false; }); prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = widget.user.userGUID; + String? searchValue = widget.user!.userGUID; var register = serverLocation + 'relationships/frienddecline'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -322,12 +322,12 @@ class _UserProfileThirdPersonState extends State loading = false; }); prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; - String searchValue = widget.user.userGUID; + String? searchValue = widget.user!.userGUID; var register = serverLocation + 'relationships/cancelrequest'; var client = await http.post(Uri.parse(register), body: json.encode(searchValue), headers: requestHeaders); @@ -374,7 +374,7 @@ class _UserProfileThirdPersonState extends State onPressed: () => Navigator.pop(context), ), title: Text( - widget.user.username, + widget.user!.username!, style: TextStyle( fontSize: 15, ), @@ -412,9 +412,9 @@ class _UserProfileThirdPersonState extends State child: buildHead( context: context, loading: loading, - user: widget.user, + user: widget.user!, posts: userProfile.posts != null - ? Numeral(userProfile.posts.length).numeral.toString() + ? Numeral(userProfile.posts!.length).numeral.toString() : "0", friends: userProfile.friends, following: userProfile.posts, @@ -441,7 +441,7 @@ class _UserProfileThirdPersonState extends State radius: 15, ), ); - } else if (userProfile.posts.length == 0 && + } else if (userProfile.posts!.length == 0 && snapshot.connectionState == ConnectionState.done) { return buildEmpty3P(context); } else { @@ -666,7 +666,7 @@ class _UserProfileThirdPersonState extends State Container( padding: EdgeInsets.symmetric(horizontal: 15), child: Text( - "Block ${widget.user.username.toUpperCase()} ? ", + "Block ${widget.user!.username!.toUpperCase()} ? ", style: TextStyle( fontWeight: FontWeight.bold, ), @@ -676,7 +676,7 @@ class _UserProfileThirdPersonState extends State Container( padding: EdgeInsets.symmetric(horizontal: 15), child: Text( - "${widget.user.username} won't be able to message you or find your profile or post on Teso. Neither would you, " + "${widget.user!.username} won't be able to message you or find your profile or post on Teso. Neither would you, " "they won't be notified that you have blocked them. You would have to unblock them to be able to interact with them.", style: TextStyle( color: Colors.grey, @@ -699,13 +699,13 @@ class _UserProfileThirdPersonState extends State colors: [ // Colors.green[400], // Colors.green[600], - Colors.red[800], + Colors.red[800]!, Colors.redAccent, ], ), onPressed: () { Provider.of(context, listen: false) - .blockUser(widget.user); + .blockUser(widget.user!); Navigator.pop(context, true); Navigator.pop(context, true); }, diff --git a/lib/Pages/codeQR.dart b/lib/Pages/codeQR.dart index 9aca5f1..19338b4 100644 --- a/lib/Pages/codeQR.dart +++ b/lib/Pages/codeQR.dart @@ -5,7 +5,7 @@ import 'package:flutter_qrcode_scanner/flutter_qrcode_scanner.dart'; class QRCodeScanner extends StatefulWidget { const QRCodeScanner({ - Key key, + Key? key, }) : super(key: key); @override @@ -15,7 +15,7 @@ class QRCodeScanner extends StatefulWidget { class _QRCodeScannerState extends State { var result; String resultingCode = ""; - QRViewController controller; + QRViewController? controller; final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); // In order to get hot reload to work we need to pause the camera if the platform @@ -24,9 +24,9 @@ class _QRCodeScannerState extends State { void reassemble() { super.reassemble(); if (Platform.isAndroid) { - controller.pauseCamera(); + controller!.pauseCamera(); } - controller.resumeCamera(); + controller!.resumeCamera(); } @override @@ -110,7 +110,7 @@ class _QRCodeScannerState extends State { resultingCode = scanData; }); if (resultingCode.isNotEmpty) { - this.controller.dispose(); + this.controller!.dispose(); Navigator.pop(context, resultingCode); } }); diff --git a/lib/Pages/explore.dart b/lib/Pages/explore.dart index bfdae28..7c57684 100644 --- a/lib/Pages/explore.dart +++ b/lib/Pages/explore.dart @@ -24,9 +24,9 @@ import 'Sub_Pages/@Generic/Camera/Picture/TakePicture.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; class Explore extends StatefulWidget { - final List connectedCameras; + final List? connectedCameras; - const Explore({Key key, this.connectedCameras}) : super(key: key); + const Explore({Key? key, this.connectedCameras}) : super(key: key); @override _ExploreState createState() => _ExploreState(); } @@ -34,22 +34,22 @@ class Explore extends StatefulWidget { class _ExploreState extends State with TickerProviderStateMixin { var search = new TextEditingController(); // List trends; - List showTrends = []; + List? showTrends = []; List categories = Category.category; // List arrivals; - List showarrivals = []; - File _image; - String thumb; - SharedPreferences prefs; + List? showarrivals = []; + File? _image; + String? thumb; + late SharedPreferences prefs; var _future; - ExploreClass deadExplore; + ExploreClass? deadExplore; RefreshController _refreshController = RefreshController(initialRefresh: false); - Future loadPage() async { + Future? loadPage() async { try { prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -58,22 +58,21 @@ class _ExploreState extends State with TickerProviderStateMixin { var register = serverLocation + 'explore/main'; var client = await http.get(Uri.parse(register), headers: requestHeaders); if (client.statusCode == 200) { - ExploreClass exploreClass; - Map products = jsonDecode(client.body); + ExploreClass? exploreClass; + Map? products = jsonDecode(client.body); SharedPreferences.getInstance() .then((value) => value.setString("explore", client.body)); setState(() { - exploreClass = ExploreClass.fromJSON(products); - showTrends = exploreClass.trending; - showarrivals = exploreClass.latest; + exploreClass = ExploreClass.fromJSON(products as Map); + showTrends = exploreClass!.trending; + showarrivals = exploreClass!.latest; }); - return exploreClass; + return exploreClass!; } else { - return null; + return new ExploreClass(); } } catch (e) { - print(e); - return null; + return new ExploreClass(); } } @@ -87,11 +86,11 @@ class _ExploreState extends State with TickerProviderStateMixin { super.initState(); SharedPreferences.getInstance().then((value) { if (value.getString("explore") != null) { - var products = jsonDecode(value.getString("explore")); + var products = jsonDecode(value.getString("explore")!); setState(() { deadExplore = ExploreClass.fromJSON(products); - showTrends = deadExplore.trending; - showarrivals = deadExplore.latest; + showTrends = deadExplore!.trending; + showarrivals = deadExplore!.latest; }); } }); @@ -223,7 +222,7 @@ class _ExploreState extends State with TickerProviderStateMixin { height: MediaQuery.of(context).size.width * 0.65, child: ListView.builder( scrollDirection: Axis.horizontal, - itemCount: showTrends.length > 6 ? 6 : showTrends.length, + itemCount: showTrends!.length > 6 ? 6 : showTrends!.length, itemBuilder: (context, index) { return InkWell( onTap: () => Navigator.push( @@ -231,13 +230,13 @@ class _ExploreState extends State with TickerProviderStateMixin { PageTransition( type: PageTransitionType.fade, child: ProductDetails( - product: showTrends.elementAt(index), + product: showTrends!.elementAt(index), ), ), ), child: buildTrend( context, - showTrends.elementAt(index), + showTrends!.elementAt(index), ), ); }, @@ -348,11 +347,11 @@ class _ExploreState extends State with TickerProviderStateMixin { crossAxisSpacing: 5.0, mainAxisSpacing: 5.0, children: List.generate( - showarrivals.length > 6 ? 6 : showarrivals.length, + showarrivals!.length > 6 ? 6 : showarrivals!.length, (index) { return buildPopularItem( context, - showarrivals.elementAt(index), + showarrivals!.elementAt(index), ); }, ), diff --git a/lib/Pages/firsttimer.dart b/lib/Pages/firsttimer.dart index 9ae230c..84ae6f1 100644 --- a/lib/Pages/firsttimer.dart +++ b/lib/Pages/firsttimer.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:teso/util/SizeConfig.dart'; class FirstTimeIntro extends StatefulWidget { - const FirstTimeIntro({Key key}) : super(key: key); + const FirstTimeIntro({Key? key}) : super(key: key); @override _FirstTimeIntroState createState() => _FirstTimeIntroState(); diff --git a/lib/Pages/home.dart b/lib/Pages/home.dart index 8f77288..60ba876 100644 --- a/lib/Pages/home.dart +++ b/lib/Pages/home.dart @@ -11,36 +11,36 @@ import 'package:provider/provider.dart'; class Home extends StatefulWidget { - final Function showUploads; - final Function toggle; - const Home({Key key, this.showUploads, this.toggle}) : super(key: key); + final Function? showUploads; + final Function? toggle; + const Home({Key? key, this.showUploads, this.toggle}) : super(key: key); @override _HomeState createState() => _HomeState(showUploads: this.showUploads); } class _HomeState extends State with TickerProviderStateMixin { - Function showUploads; + Function? showUploads; _HomeState({this.showUploads}); String title = "Home"; double titleSize = 45.0; - String mapstyle; + String? mapstyle; var _future; - static LatLng _initialPosition; + static LatLng? _initialPosition; Set markers = {}; - List shops; - GoogleMapController mapController; + List? shops; + GoogleMapController? mapController; static const double CAMERA_ZOOM = 13.499910354614258; Location location = Location(); String routingMessage = "Finding shops...."; - LocationData _location; + late LocationData _location; // ignore: unused_field - String _error; + String? _error; @override void initState() { super.initState(); SharedPreferences.getInstance().then((prefs) async { - String currentTheme = prefs.getString("theme"); + String? currentTheme = prefs.getString("theme"); if (currentTheme == "dark") { rootBundle.loadString('assets/styles/dark.txt').then((string) { mapstyle = string; @@ -51,14 +51,14 @@ class _HomeState extends State with TickerProviderStateMixin { }); } bool first = - prefs.getBool("launched") != null ? prefs.getBool("launched") : false; + prefs.getBool("launched") != null ? prefs.getBool("launched")! : false; if (!first) { prefs.setBool("launched", true); } }); _future = _determinePosition(context); location.onLocationChanged.listen((LocationData cLoc) { - _initialPosition = LatLng(cLoc.latitude, cLoc.longitude); + _initialPosition = LatLng(cLoc.latitude!, cLoc.longitude!); }); } @@ -67,7 +67,7 @@ class _HomeState extends State with TickerProviderStateMixin { super.dispose(); } - Future _determinePosition(context) async { + Future _determinePosition(context) async { setState(() { _error = null; }); @@ -75,7 +75,7 @@ class _HomeState extends State with TickerProviderStateMixin { final LocationData _locationResult = await location.getLocation(); setState(() { _location = _locationResult; - _initialPosition = LatLng(_location.latitude, _location.longitude); + _initialPosition = LatLng(_location.latitude!, _location.longitude!); }); // await getLocations(); @@ -101,6 +101,13 @@ class _HomeState extends State with TickerProviderStateMixin { return buildMap(context); } }), + floatingActionButton: FloatingActionButton.extended( + onPressed: () => _currentLocation(), + label: Text(''), + icon: Icon(Icons.my_location_outlined), + backgroundColor: Colors.white, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.startFloat, ); } @@ -112,7 +119,7 @@ class _HomeState extends State with TickerProviderStateMixin { backgroundColor: Theme.of(context).primaryColor, automaticallyImplyLeading: false, title: Consumer(builder: - (BuildContext context, UserProvider value, Widget child) { + (BuildContext context, UserProvider value, Widget? child) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -156,7 +163,7 @@ class _HomeState extends State with TickerProviderStateMixin { child: Center( child: Text( value.currentUser != null - ? value.currentUser.gold + ? value.currentUser!.gold! : "0", style: TextStyle( fontSize: 13.5, @@ -191,7 +198,7 @@ class _HomeState extends State with TickerProviderStateMixin { child: Center( child: Text( value.currentUser != null - ? value.currentUser.silver + ? value.currentUser!.silver! : "0", style: TextStyle( fontSize: 13.5, @@ -220,11 +227,11 @@ class _HomeState extends State with TickerProviderStateMixin { zoomGesturesEnabled: true, zoomControlsEnabled: false, compassEnabled: true, - myLocationButtonEnabled: true, + myLocationButtonEnabled: false, myLocationEnabled: true, // markers: markers, initialCameraPosition: CameraPosition( - target: _initialPosition, + target: _initialPosition!, zoom: CAMERA_ZOOM, //bearing: CAMERA_BEARING, ), @@ -254,8 +261,9 @@ class _HomeState extends State with TickerProviderStateMixin { zoomGesturesEnabled: true, zoomControlsEnabled: false, compassEnabled: true, - myLocationButtonEnabled: true, + myLocationButtonEnabled: false, myLocationEnabled: true, + markers: markers, initialCameraPosition: CameraPosition( target: LatLng(6.700071, -1.630783), @@ -278,4 +286,22 @@ class _HomeState extends State with TickerProviderStateMixin { }, ); } + void _currentLocation() async { + // final GoogleMapController controller = await mapController.; + LocationData? currentLocation; + var location = new Location(); + try { + currentLocation = await location.getLocation(); + } on Exception { + currentLocation = null; + } + + mapController?.animateCamera(CameraUpdate.newCameraPosition( + CameraPosition( + bearing: 0, + target: LatLng(currentLocation!.latitude!, currentLocation.longitude!), + zoom: 17.0, + ), + )); + } } diff --git a/lib/Pages/notifications.dart b/lib/Pages/notifications.dart index cb332ec..894e0a3 100644 --- a/lib/Pages/notifications.dart +++ b/lib/Pages/notifications.dart @@ -13,12 +13,12 @@ class Notifications extends StatefulWidget { class _NotificationsState extends State { // ignore: avoid_init_to_null - Color fcurrentColor = null; + Color? fcurrentColor = null; Color fTextColor1 = Colors.white; - Color fcurrentColor1; - Color fTextColor2; + Color? fcurrentColor1; + Color? fTextColor2; int _page = 0; - PageController _pageController; + PageController? _pageController; bool chats = false; @override @@ -38,7 +38,7 @@ class _NotificationsState extends State { } void navigationTapped(int page) { - _pageController.animateToPage( + _pageController!.animateToPage( page, duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, @@ -99,7 +99,7 @@ class _NotificationsState extends State { @override Widget build(BuildContext context) { TesoUser user = - Provider.of(context, listen: false).currentUser; + Provider.of(context, listen: false).currentUser!; return Scaffold( appBar: PreferredSize( child: AppBar( diff --git a/lib/Pages/productView.dart b/lib/Pages/productView.dart index 88a66e5..490e9d3 100644 --- a/lib/Pages/productView.dart +++ b/lib/Pages/productView.dart @@ -11,9 +11,9 @@ import 'package:teso/util/consts.dart'; import 'package:teso/Classes/API Clasess/CouponDetails.dart'; class ProductView extends StatefulWidget { - final CouponDetails couponDetails; + final CouponDetails? couponDetails; - const ProductView({Key key, this.couponDetails}) : super(key: key); + const ProductView({Key? key, this.couponDetails}) : super(key: key); @override _ProductViewState createState() => _ProductViewState(); } @@ -22,9 +22,9 @@ enum AppBarBehavior { normal, pinned, floating, snapping } class _ProductViewState extends State with TickerProviderStateMixin { - AnimationController _containerController; - Animation width; - Animation heigth; + late AnimationController _containerController; + late Animation width; + late Animation heigth; double _appBarHeight = 256.0; AppBarBehavior _appBarBehavior = AppBarBehavior.pinned; int number = 0; @@ -35,18 +35,18 @@ class _ProductViewState extends State acquiring = true; }); CouponsHead couponsHead = new CouponsHead(); - couponsHead.businessId = widget.couponDetails.businessId; - couponsHead.expiration = widget.couponDetails.expiration; - couponsHead.couponId = widget.couponDetails.couponId; + couponsHead.businessId = widget.couponDetails!.businessId; + couponsHead.expiration = widget.couponDetails!.expiration; + couponsHead.couponId = widget.couponDetails!.couponId; couponsHead.quantity = 1; couponsHead.state = "active"; couponsHead.lower = - double.parse(widget.couponDetails.lowerLimit.toString()); + double.parse(widget.couponDetails!.lowerLimit.toString()); couponsHead.upper = - double.parse(widget.couponDetails.upperLimit.toString()); - couponsHead.targetProduct = widget.couponDetails.targetProduct.productID; - double price = (widget.couponDetails.targetProduct.unitPrice * - (widget.couponDetails.lowerLimit / 100)); + double.parse(widget.couponDetails!.upperLimit.toString()); + couponsHead.targetProduct = widget.couponDetails!.targetProduct!.productID; + double price = (widget.couponDetails!.targetProduct!.unitPrice! * + (widget.couponDetails!.lowerLimit! / 100)); //Calculations int cost = CouponRateCalculator.getRate(price); @@ -172,9 +172,9 @@ class _ProductViewState extends State MaterialPageRoute(builder: (context) { return ProductImage( productTag: widget - .couponDetails.targetProduct.businessID, - productImageSRC: widget.couponDetails - .targetProduct.productImage, + .couponDetails!.targetProduct!.businessID, + productImageSRC: widget.couponDetails! + .targetProduct!.productImage, ); })); }, @@ -183,11 +183,11 @@ class _ProductViewState extends State height: _appBarHeight, child: Hero( tag: widget - .couponDetails.targetProduct.businessID, + .couponDetails!.targetProduct!.businessID!, child: CachedNetworkImage( imageUrl: productURL + - widget.couponDetails.targetProduct - .productImage, + widget.couponDetails!.targetProduct! + .productImage!, imageBuilder: (context, imageProvider) => Image( fit: BoxFit.fill, @@ -222,8 +222,8 @@ class _ProductViewState extends State children: [ new Center( child: new Text( - widget.couponDetails.targetProduct - .productName, + widget.couponDetails!.targetProduct! + .productName!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 24, @@ -245,8 +245,8 @@ class _ProductViewState extends State new Padding( padding: const EdgeInsets.all(8.0), child: new Text("GH¢ " + - widget.couponDetails - .targetProduct.unitPrice + widget.couponDetails! + .targetProduct!.unitPrice .toString()), ) ], @@ -272,9 +272,9 @@ class _ProductViewState extends State padding: const EdgeInsets.all(8.0), child: new Text(widget - .couponDetails - .issuer - .businessName), + .couponDetails! + .issuer! + .businessName!), ) ], ), @@ -292,7 +292,7 @@ class _ProductViewState extends State ), ), new Text(widget - .couponDetails.targetProduct.productDesc), + .couponDetails!.targetProduct!.productDesc!), ], ), ), @@ -301,7 +301,7 @@ class _ProductViewState extends State ), ], ), - widget.couponDetails.countID == "null" + widget.couponDetails!.countID == "null" ? Container( height: 80.0, padding: EdgeInsets.all(20), diff --git a/lib/Pages/scannerqr.dart b/lib/Pages/scannerqr.dart index d784bcc..c1ae467 100644 --- a/lib/Pages/scannerqr.dart +++ b/lib/Pages/scannerqr.dart @@ -9,19 +9,19 @@ import 'package:teso/Pages/PageWidgets/WalkIn Coupons/ActiveDiscount.dart'; import 'package:teso/Pages/PageWidgets/WalkIn Coupons/ActiveFreebie.dart'; class ScanQR extends StatefulWidget { - final String shopID; - const ScanQR({Key key, this.shopID}) : super(key: key); + final String? shopID; + const ScanQR({Key? key, this.shopID}) : super(key: key); @override _ScanQRState createState() => _ScanQRState(shopID: this.shopID); } class _ScanQRState extends State with TickerProviderStateMixin { - String shopID; + String? shopID; _ScanQRState({this.shopID}); int flag = 0; var _future; - List data; + List? data; List selectedData = []; double selectedDiscount = 0; @@ -35,12 +35,12 @@ class _ScanQRState extends State with TickerProviderStateMixin { super.dispose(); } - Future> getShopsCoupons() async { + Future?> getShopsCoupons() async { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'coupons/qrCoupon'; var client1 = await http.post(Uri.parse(register2), @@ -78,7 +78,7 @@ class _ScanQRState extends State with TickerProviderStateMixin { radius: 15, ), ); - } else if ((data == null || data.length == 0) && + } else if ((data == null || data!.length == 0) && snapshot.connectionState == ConnectionState.done) { return Center( child: Text( @@ -87,14 +87,14 @@ class _ScanQRState extends State with TickerProviderStateMixin { } else { return ListView.builder( scrollDirection: Axis.horizontal, - itemCount: data.length, + itemCount: data!.length, itemBuilder: (context, index) { - if (data.elementAt(index).type.contains("FREEBIE")) { + if (data!.elementAt(index).type!.contains("FREEBIE")) { return buildActiveFreebieCoupon( - data.elementAt(index), 0, context); + data!.elementAt(index), 0, context); } else { return buildActiveDiscountCoupon( - data.elementAt(index), 0, context); + data!.elementAt(index), 0, context); } }, ); diff --git a/lib/Pages/splash.dart b/lib/Pages/splash.dart index 289a6b7..2a1d9c9 100644 --- a/lib/Pages/splash.dart +++ b/lib/Pages/splash.dart @@ -17,10 +17,10 @@ class Splash extends StatefulWidget { } class _SplashState extends State with TickerProviderStateMixin { - List connectedCameras; - Animation _animation; - AnimationController _controller; - final DynamicLinkService _dynamicLinkService = locator(); + List? connectedCameras; + late Animation _animation; + late AnimationController _controller; + final DynamicLinkService? _dynamicLinkService = locator(); gotoPersonnalServer() { _controller = AnimationController( @@ -59,16 +59,16 @@ class _SplashState extends State with TickerProviderStateMixin { } void loggedIn() async { - await _dynamicLinkService.handleDynamicLinks(); + await _dynamicLinkService!.handleDynamicLinks(); SharedPreferences prefs = await SharedPreferences.getInstance(); - String tokens = prefs.getString("tokensTeso"); + String? tokens = prefs.getString("tokensTeso"); if (tokens != null) { Navigator.pushReplacement( context, PageTransition( type: PageTransitionType.rightToLeft, child: MainScreens( - connectedCameras: connectedCameras, + connectedCameras: connectedCameras!, ), ), ); @@ -80,8 +80,8 @@ class _SplashState extends State with TickerProviderStateMixin { Future apiversionCheck() async { try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString('tokensTeso'); - Map requestHeaders = { + String? token = prefs.getString('tokensTeso'); + Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token }; @@ -94,13 +94,13 @@ class _SplashState extends State with TickerProviderStateMixin { }, ); if (client.statusCode == 200) { - String currentVersion = prefs.getString("api-version") != null + String? currentVersion = prefs.getString("api-version") != null ? prefs.getString("api-version") : ""; if (currentVersion != client.body) { try { var register = Uri.parse(serverLocation + 'api/logout'); - await http.get(register, headers: requestHeaders); + await http.get(register, headers: requestHeaders as Map?); } catch (_) {} await prefs.clear(); await prefs.setBool("launched", true); diff --git a/lib/Prodfirebase_options.dart b/lib/Prodfirebase_options.dart new file mode 100644 index 0000000..45a21e2 --- /dev/null +++ b/lib/Prodfirebase_options.dart @@ -0,0 +1,72 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyAHBguF6oqPEq7em1vLrh_NP2LoPuabe6o', + appId: '1:280510379185:android:b778de8dca1cf49219de90', + messagingSenderId: '280510379185', + projectId: 'teso-ghana', + databaseURL: 'https://teso-ghana-default-rtdb.firebaseio.com', + storageBucket: 'teso-ghana.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyCBDtZO2_Z5JjrNj1TocK6YAlk_wDbzZHs', + appId: '1:280510379185:ios:52af12a619d5443119de90', + messagingSenderId: '280510379185', + projectId: 'teso-ghana', + databaseURL: 'https://teso-ghana-default-rtdb.firebaseio.com', + storageBucket: 'teso-ghana.appspot.com', + androidClientId: '280510379185-0shp8sia3i5m589bov645t3kuddb1032.apps.googleusercontent.com', + iosClientId: '280510379185-67vianhh973klriv75ip2tb9cf8ibitl.apps.googleusercontent.com', + iosBundleId: 'com.tesoapp', + ); +} diff --git a/lib/Services/DynamicLinks.dart b/lib/Services/DynamicLinks.dart index ab5a7a5..6460a62 100644 --- a/lib/Services/DynamicLinks.dart +++ b/lib/Services/DynamicLinks.dart @@ -4,7 +4,7 @@ import 'package:no_context_navigation/no_context_navigation.dart'; class DynamicLinkService { Future handleDynamicLinks() async { // 1. Get the initial dynamic link if the app is opened with a dynamic link - final PendingDynamicLinkData data = + final PendingDynamicLinkData? data = await FirebaseDynamicLinks.instance.getInitialLink(); // 2. handle link that has been retrieved @@ -21,8 +21,8 @@ class DynamicLinkService { // }); } - void _handleDeepLink(PendingDynamicLinkData data) { - final Uri deepLink = data?.link; + void _handleDeepLink(PendingDynamicLinkData? data) { + final Uri? deepLink = data?.link; if (deepLink != null) { try { if (deepLink.pathSegments.contains('resetpassword')) { diff --git a/lib/Services/navigation_service.dart b/lib/Services/navigation_service.dart index 76be921..2c71da2 100644 --- a/lib/Services/navigation_service.dart +++ b/lib/Services/navigation_service.dart @@ -4,11 +4,11 @@ class NavigationService { GlobalKey _navigationKey = GlobalKey(); pop() { - return _navigationKey.currentState.pop(); + return _navigationKey.currentState!.pop(); } Future navigateTo(String routeName, {dynamic arguments}) { - return _navigationKey.currentState + return _navigationKey.currentState! .pushNamed(routeName, arguments: arguments); } } diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 45a21e2..a6056d2 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -50,23 +50,21 @@ class DefaultFirebaseOptions { } static const FirebaseOptions android = FirebaseOptions( - apiKey: 'AIzaSyAHBguF6oqPEq7em1vLrh_NP2LoPuabe6o', - appId: '1:280510379185:android:b778de8dca1cf49219de90', - messagingSenderId: '280510379185', - projectId: 'teso-ghana', - databaseURL: 'https://teso-ghana-default-rtdb.firebaseio.com', - storageBucket: 'teso-ghana.appspot.com', + apiKey: 'AIzaSyDt05opA09hr9Y1pysllCsEE_6dT4CrhRM', + appId: '1:675860686596:android:8522b46df172af41cd9251', + messagingSenderId: '675860686596', + projectId: 'teso-test-6fc81', + storageBucket: 'teso-test-6fc81.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( - apiKey: 'AIzaSyCBDtZO2_Z5JjrNj1TocK6YAlk_wDbzZHs', - appId: '1:280510379185:ios:52af12a619d5443119de90', - messagingSenderId: '280510379185', - projectId: 'teso-ghana', - databaseURL: 'https://teso-ghana-default-rtdb.firebaseio.com', - storageBucket: 'teso-ghana.appspot.com', - androidClientId: '280510379185-0shp8sia3i5m589bov645t3kuddb1032.apps.googleusercontent.com', - iosClientId: '280510379185-67vianhh973klriv75ip2tb9cf8ibitl.apps.googleusercontent.com', + apiKey: 'AIzaSyDBcm0Bpx8tucyVx3Cwe48ehqcWGPWThzI', + appId: '1:675860686596:ios:41d840f75d89875ccd9251', + messagingSenderId: '675860686596', + projectId: 'teso-test-6fc81', + storageBucket: 'teso-test-6fc81.appspot.com', + androidClientId: '675860686596-in4piqob6d8nj42nguh06abpdrrhai0f.apps.googleusercontent.com', + iosClientId: '675860686596-8dsd5qf42n1gej04f2m2rmt27neft8vg.apps.googleusercontent.com', iosBundleId: 'com.tesoapp', ); } diff --git a/lib/main.dart b/lib/main.dart index 0607619..e22ce92 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -66,18 +66,22 @@ class MyApp extends StatelessWidget { onGenerateRoute: (RouteSettings settings) { switch (settings.name) { case '/': - return MaterialPageRoute(builder: (_) => MainScreens()); + List? cameras; + availableCameras().then((value) { + cameras = value; + }); + return MaterialPageRoute(builder: (_) => MainScreens(connectedCameras: cameras!,)); case '/resetpassword': return MaterialPageRoute( - builder: (_) => ResetPassword(resetID: settings.arguments)); + builder: (_) => ResetPassword(resetID: settings.arguments as String?)); case "/login": - List cameras; + List? cameras; availableCameras().then((value) { cameras = value; }); return MaterialPageRoute( builder: (_) => LoginPage( - referrer: settings.arguments, + referrer: settings.arguments as String?, connectedCameras: cameras, ), ); diff --git a/lib/main_screen.dart b/lib/main_screen.dart index ae95b89..ef33156 100644 --- a/lib/main_screen.dart +++ b/lib/main_screen.dart @@ -1,5 +1,6 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:teso/Classes/API%20Clasess/CouponDetails.dart'; import 'package:teso/Classes/API%20Clasess/Product.dart'; import 'package:teso/Classes/API%20Clasess/TesoBusinessDetail.dart'; @@ -16,10 +17,12 @@ import 'package:teso/Pages/Sub_Pages/PopUp/Personalized.dart'; import 'package:teso/Pages/codeQR.dart'; import 'package:teso/Pages/notifications.dart'; import 'package:teso/providers/pageAnimations.dart'; +import 'package:teso/teso_fab.dart'; import 'package:teso/util/SizeConfig.dart'; import 'package:teso/util/consts.dart'; import 'Classes/API Clasess/CouponHead.dart'; import 'Pages/Sub_Pages/Coupons/ProximityCoupons.dart'; +import 'Pages/Sub_Pages/homeSub/MyCoupons.dart'; import 'Pages/explore.dart'; import 'package:teso/Pages/LandingPage.dart'; import 'package:http/http.dart' as http; @@ -43,7 +46,7 @@ import 'Pages/home.dart'; class MainScreens extends StatefulWidget { final List connectedCameras; - const MainScreens({Key key, this.connectedCameras}) : super(key: key); + const MainScreens({Key? key, required this.connectedCameras}) : super(key: key); @override _MainScreensState createState() => _MainScreensState(); } @@ -52,14 +55,14 @@ class _MainScreensState extends State with TickerProviderStateMixin { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; int _page = 0; - PageController _pageController; - String result = ""; + PageController? _pageController; + String? result = ""; ScrollController _scrollBottomBarController = new ScrollController(); bool isScrollingDown = false; double bottomBarHeight = 75; final picker = ImagePicker(); - FirebaseAuth _auth; - String dd; + late FirebaseAuth _auth; + String? dd; bool _initialized = false; bool navVisible = true; @@ -73,7 +76,7 @@ class _MainScreensState extends State ), ); try { - if (result.isNotEmpty) { + if (result!.isNotEmpty) { Navigator.push( context, PageTransition( @@ -94,7 +97,7 @@ class _MainScreensState extends State @override void dispose() { super.dispose(); - _pageController.dispose(); + _pageController!.dispose(); _scrollBottomBarController.removeListener(() {}); DefaultCacheManager().emptyCache(); } @@ -121,12 +124,12 @@ class _MainScreensState extends State _pageController = PageController(initialPage: 0, keepPage: false); SharedPreferences.getInstance().then((prefs) async { - String deviceToken; + String? deviceToken; await _firebaseMessaging.getToken().then((token) { deviceToken = token; }); Map user = - jsonDecode(prefs.getString("currentUser")) as Map; + jsonDecode(prefs.getString("currentUser")!) as Map; TesoUser currentuser = TesoUser.fromJSON(user); Map updates = { 'chattingWith': "", @@ -153,15 +156,15 @@ class _MainScreensState extends State void navigationTapped(int page) { if (page == 0) { - _pageController.jumpToPage(0); + _pageController!.jumpToPage(0); } else if (page == 1) { - _pageController.jumpToPage(1); + _pageController!.jumpToPage(1); } else if (page == 2) { _scanQRCode(); } else if (page == 3) { - _pageController.jumpToPage(2); + _pageController!.jumpToPage(2); } else { - _pageController.jumpToPage(3); + _pageController!.jumpToPage(3); } } @@ -194,8 +197,8 @@ class _MainScreensState extends State void logOut() async { try { SharedPreferences.getInstance().then((prefs) async { - String token = prefs.getString('tokensTeso'); - String id = prefs.getString('id'); + String token = prefs.getString('tokensTeso')!; + String? id = prefs.getString('id'); Map requestHeaders = { 'Content-type': 'application/json', 'Accept': 'application/json', @@ -227,7 +230,7 @@ class _MainScreensState extends State } bool onWillPop() { - _pageController.previousPage( + _pageController!.previousPage( duration: Duration(milliseconds: 200), curve: Curves.linear, ); @@ -250,16 +253,14 @@ class _MainScreensState extends State Explore( connectedCameras: widget.connectedCameras, ), - Notifications(), - Personnal( - showSettings: settingsDialog, - ), + MyCoupons(), + Personnal(showSettings: settingsDialog,), ], ), Align( alignment: Alignment.bottomCenter, child: Consumer(builder: - (BuildContext context, UserProvider user, Widget child) { + (BuildContext context, UserProvider user, Widget? child) { if (user.saving) return Container( width: double.infinity, @@ -286,8 +287,38 @@ class _MainScreensState extends State ], ), ), - floatingActionButton: buildFAB(context), - bottomNavigationBar: bottomOptions(context), + floatingActionButton: TesoFAB( + distance: SizeConfig.safeBlockVertical * 17, + children: [ + ActionButton( + onPressed: () => navigationTapped(0), + icon: const Icon(Icons.home), + ), + ActionButton( + onPressed: () => navigationTapped(1), + icon: SvgPicture.asset( + "assets/images/search.svg", + color: Colors.black, + fit: BoxFit.contain, + width: SizeConfig.safeBlockVertical * 3.2, + ), + ), + ActionButton( + onPressed: () => navigationTapped(3), + icon: SvgPicture.asset( + "assets/images/coupon.svg", + color: Colors.black, + fit: BoxFit.contain, + width: SizeConfig.safeBlockVertical * 3.2, + ), + ), + ActionButton( + onPressed: () => navigationTapped(4), + icon: const Icon(Icons.person), + ), + ], + ), + // bottomNavigationBar: bottomOptions(context), ); } @@ -346,10 +377,10 @@ class _MainScreensState extends State } } - void _fetchMessage(RemoteMessage message, BuildContext context) async { + void _fetchMessage(RemoteMessage? message, BuildContext context) async { if (message == null || message.notification == null) return; final Map _data = message.data; - final RemoteNotification notification = message.notification; + final RemoteNotification notification = message.notification!; Payload payload = await NotificationSplitter.getPayload(_data, context); await notificationPlugin.showNotification( @@ -359,10 +390,10 @@ class _MainScreensState extends State ); if (payload.load2 != null && payload.load2 == "personalized") { try { - var coup = jsonDecode(payload.load1); + var coup = jsonDecode(payload.load1!); Product product = new Product(); product.productName = payload.load7; - product.unitPrice = double.parse(payload.load6); + product.unitPrice = double.parse(payload.load6!); TesoBusinessDetail business = new TesoBusinessDetail(); business.businessName = payload.load5; CouponsHead head = new CouponsHead(); @@ -417,15 +448,15 @@ class _MainScreensState extends State } void _fromBackground(RemoteMessage message, BuildContext context) async { - if (message == null || message.notification == null) return; + if (message.notification == null) return; final Map _data = message.data; Payload payload = await NotificationSplitter.getPayload(_data, context); if (payload.load2 != null && payload.load2 == "personalized") { try { - var coup = jsonDecode(payload.load1); + var coup = jsonDecode(payload.load1!); Product product = new Product(); product.productName = payload.load7; - product.unitPrice = double.parse(payload.load6); + product.unitPrice = double.parse(payload.load6!); TesoBusinessDetail business = new TesoBusinessDetail(); business.businessName = payload.load5; CouponsHead head = new CouponsHead(); @@ -485,9 +516,9 @@ class _MainScreensState extends State void _fetchForegroundMessage( RemoteMessage message, BuildContext context) async { - if (message == null || message.notification == null) return; + if (message.notification == null) return; final Map _data = message.data; - final RemoteNotification notification = message.notification; + final RemoteNotification notification = message.notification!; Payload payload = await NotificationSplitter.getPayload(_data, context); await notificationPlugin.showNotification( @@ -497,10 +528,10 @@ class _MainScreensState extends State ); if (payload.load2 != null && payload.load2 == "personalized") { try { - var coup = jsonDecode(payload.load1); + var coup = jsonDecode(payload.load1!); Product product = new Product(); product.productName = payload.load7; - product.unitPrice = double.parse(payload.load6); + product.unitPrice = double.parse(payload.load6!); TesoBusinessDetail business = new TesoBusinessDetail(); business.businessName = payload.load5; CouponsHead head = new CouponsHead(); @@ -536,12 +567,12 @@ class _MainScreensState extends State } } else if (payload.loadID == "TESN0R0") { SharedPreferences.getInstance().then((prefs) async { - String currentSaveUser = prefs.getString("currentUser"); + String currentSaveUser = prefs.getString("currentUser")!; Map olduser = jsonDecode(currentSaveUser) as Map; TesoUser user = TesoUser.fromJSON(olduser); user.gold = - (int.parse(user.gold) + int.parse(_data["reward"])).toString(); + (int.parse(user.gold!) + int.parse(_data["reward"])).toString(); Provider.of(context, listen: false).setUser(user); }); } @@ -572,47 +603,9 @@ class _MainScreensState extends State ), label: ("Explore"), ), - // BottomNavigationBarItem( - // icon: GestureDetector( - // onLongPress: () => {_scanQRCode()}, - // child: ImageIcon( - // AssetImage("assets/images/rawLogo.png"), - // size: SizeConfig.safeBlockHorizontal * 6.7, - // ), - // ), - // label: ("TESO"), - // ), - // BottomNavigationBarItem( - // icon: Icon( - // Icons.notifications, - // size: SizeConfig.safeBlockHorizontal * 6.7, - // ), - // label: ("Alerts"), - // ), - // BottomNavigationBarItem( - // icon: Icon( - // Icons.person, - // size: SizeConfig.safeBlockHorizontal * 6.7, - // ), - // label: ("Personal"), - // ), ], onTap: navigationTapped, - currentIndex: _page, - ); - } - - Widget buildFAB(BuildContext context) { - return GestureDetector( - onLongPress: () => {_scanQRCode()}, - child: FloatingActionButton( - backgroundColor: tesoGold, - onPressed: () => print(""), - child: ImageIcon( - AssetImage("assets/images/rawLogo.png"), - size: SizeConfig.safeBlockHorizontal * 6.7, - ), - ), + // currentIndex: _page, ); } } diff --git a/lib/providers/app_provider.dart b/lib/providers/app_provider.dart index 0499733..4265a6b 100644 --- a/lib/providers/app_provider.dart +++ b/lib/providers/app_provider.dart @@ -46,7 +46,7 @@ class AppProvider extends ChangeNotifier { Future checkTheme() async { SharedPreferences prefs = await SharedPreferences.getInstance(); ThemeData t; - String r = + String? r = prefs.getString("theme") == null ? "light" : prefs.getString("theme"); if (r == "light") { diff --git a/lib/providers/device_provider.dart b/lib/providers/device_provider.dart index 99d1465..7e10e3d 100644 --- a/lib/providers/device_provider.dart +++ b/lib/providers/device_provider.dart @@ -21,12 +21,12 @@ import 'package:teso/Classes/Payload.dart'; import 'package:teso/Pages/Sub_Pages/@Generic/Error.dart'; class DeviceProvider extends ChangeNotifier { - bool serviceEnabled; + bool? serviceEnabled; Location location = new Location(); - bool _serviceEnabled; - LocationData _location; + bool? _serviceEnabled; + late LocationData _location; - StreamSubscription _locationSubscription; + late StreamSubscription _locationSubscription; List proximityCoupons = []; bool fetching = false; bool declining = false; @@ -51,19 +51,19 @@ class DeviceProvider extends ChangeNotifier { } else { serviceEnabled = prefs.getBool("backgroundService"); } - if (serviceEnabled) _listenLocation(); + if (serviceEnabled!) _listenLocation(); }); } void toggleBackgroundMode(context) async { try { - bool prominentResult = false; - if (!serviceEnabled) { - prominentResult = await Navigator.push( + bool? prominentResult = false; + if (!serviceEnabled!) { + prominentResult = await (Navigator.push( context, PageTransition( child: ProminentDisclosure(), - type: PageTransitionType.leftToRight)); + type: PageTransitionType.leftToRight)) as FutureOr); } final bool result = await location.enableBackgroundMode( @@ -71,10 +71,10 @@ class DeviceProvider extends ChangeNotifier { ); serviceEnabled = result; SharedPreferences.getInstance().then((prefs) { - prefs.setBool("backgroundService", serviceEnabled); + prefs.setBool("backgroundService", serviceEnabled!); }); - if (serviceEnabled) { - PermissionStatus status = await _requestPermission(); + if (serviceEnabled!) { + PermissionStatus? status = await _requestPermission(); if (status == PermissionStatus.granted) { await _requestService(); _listenLocation(); @@ -104,7 +104,7 @@ class DeviceProvider extends ChangeNotifier { } Future _requestService() async { - if (_serviceEnabled == null || !_serviceEnabled) { + if (_serviceEnabled == null || !_serviceEnabled!) { final bool serviceRequestedResult = await location.requestService(); _serviceEnabled = serviceRequestedResult; if (!serviceRequestedResult) { @@ -121,10 +121,10 @@ class DeviceProvider extends ChangeNotifier { }).listen((LocationData currentLocation) async { try { double distanceInMeters = Geolocator.distanceBetween( - currentLocation.latitude, - currentLocation.longitude, - _location.latitude, - _location.longitude); + currentLocation.latitude!, + currentLocation.longitude!, + _location.latitude!, + _location.longitude!); if (distanceInMeters >= 804.672 || runFirst) { if (!fetching && !declining) { @@ -166,21 +166,21 @@ class DeviceProvider extends ChangeNotifier { } catch (e) {} } - PermissionStatus _permissionGranted; + PermissionStatus? _permissionGranted; - Future _requestPermission() async { + Future _requestPermission() async { if (_permissionGranted != PermissionStatus.granted) { _permissionGranted = await location.requestPermission(); } return _permissionGranted; } - Future> proxiCoupons() async { + Future?> proxiCoupons() async { fetching = true; SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'coupons/proximity'; @@ -204,7 +204,7 @@ class DeviceProvider extends ChangeNotifier { Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'coupons/declineCoupon'; @@ -227,12 +227,12 @@ class DeviceProvider extends ChangeNotifier { Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; TesoUser currentUser = - Provider.of(context, listen: false).currentUser; + Provider.of(context, listen: false).currentUser!; - int remaining = int.parse(currentUser.silver) - cost.round(); + int remaining = int.parse(currentUser.silver!) - cost.round(); if (remaining < 0) { Payload payload = new Payload(); payload.loadID = "TESN003"; @@ -245,11 +245,12 @@ class DeviceProvider extends ChangeNotifier { ); return 0; } - // Calculations end + // Calculations end + var bodyContent = json.encode(couponsHead); var register2 = serverLocation + 'coupons/acceptCoupon'; var client1 = await http.post(Uri.parse(register2), - body: json.encode(couponsHead), headers: requestHeaders); + body: bodyContent, headers: requestHeaders); if (client1.statusCode == 200) { currentUser.silver = remaining.toString(); diff --git a/lib/providers/pageAnimations.dart b/lib/providers/pageAnimations.dart index 29e4c92..fad4f86 100644 --- a/lib/providers/pageAnimations.dart +++ b/lib/providers/pageAnimations.dart @@ -19,13 +19,13 @@ class PageTransition extends PageRouteBuilder { final Widget child; final PageTransitionType type; final Curve curve; - final Alignment alignment; + final Alignment? alignment; final Duration duration; PageTransition({ - Key key, - @required this.child, - @required this.type, + Key? key, + required this.child, + required this.type, this.curve = Curves.linear, this.alignment, this.duration = const Duration(milliseconds: 300), @@ -39,7 +39,6 @@ class PageTransition extends PageRouteBuilder { switch (type) { case PageTransitionType.fade: return FadeTransition(opacity: animation, child: child); - break; case PageTransitionType.rightToLeft: return SlideTransition( transformHitTests: false, @@ -55,7 +54,6 @@ class PageTransition extends PageRouteBuilder { child: child, ), ); - break; case PageTransitionType.leftToRight: return SlideTransition( transformHitTests: false, @@ -71,7 +69,6 @@ class PageTransition extends PageRouteBuilder { child: child, ), ); - break; case PageTransitionType.upToDown: return SlideTransition( transformHitTests: false, @@ -87,7 +84,6 @@ class PageTransition extends PageRouteBuilder { child: child, ), ); - break; case PageTransitionType.downToUp: return SlideTransition( transformHitTests: false, @@ -103,10 +99,9 @@ class PageTransition extends PageRouteBuilder { child: child, ), ); - break; case PageTransitionType.scale: return ScaleTransition( - alignment: alignment, + alignment: alignment!, scale: CurvedAnimation( parent: animation, curve: Interval( @@ -117,10 +112,9 @@ class PageTransition extends PageRouteBuilder { ), child: child, ); - break; case PageTransitionType.rotate: return new RotationTransition( - alignment: alignment, + alignment: alignment!, turns: animation, child: new ScaleTransition( alignment: alignment, @@ -131,10 +125,9 @@ class PageTransition extends PageRouteBuilder { ), ), ); - break; case PageTransitionType.size: return Align( - alignment: alignment, + alignment: alignment!, child: SizeTransition( sizeFactor: CurvedAnimation( parent: animation, @@ -143,7 +136,6 @@ class PageTransition extends PageRouteBuilder { child: child, ), ); - break; case PageTransitionType.rightToLeftWithFade: return SlideTransition( position: Tween( @@ -161,7 +153,6 @@ class PageTransition extends PageRouteBuilder { ), ), ); - break; case PageTransitionType.leftToRightWithFade: return SlideTransition( position: Tween( @@ -179,7 +170,6 @@ class PageTransition extends PageRouteBuilder { ), ), ); - break; default: return FadeTransition(opacity: animation, child: child); } diff --git a/lib/providers/referral_provider.dart b/lib/providers/referral_provider.dart index 3a20dab..2aaba11 100644 --- a/lib/providers/referral_provider.dart +++ b/lib/providers/referral_provider.dart @@ -6,14 +6,14 @@ class ReferralProvider extends ChangeNotifier { ReferralProvider() { getReferral(); } - String referral; + String? referral; void setReferral(user) { referral = user; notifyListeners(); } - String getReferral() { + String? getReferral() { return referral; } } diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index 0974f6a..6f57a09 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -21,8 +21,8 @@ class UserProvider extends ChangeNotifier { getCurrentUser(); } - TesoUser currentUser; - List interest = []; + TesoUser? currentUser; + List? interest = []; List posts = []; List friends = []; List mycoupons = []; @@ -30,7 +30,7 @@ class UserProvider extends ChangeNotifier { bool firstTime = true; bool saving = false; List blockedContent = []; - List blockedUsers = []; + List blockedUsers = []; List blockUserList = []; void updateUser(user) async { @@ -52,13 +52,13 @@ class UserProvider extends ChangeNotifier { getCurrentUser() async { - String currentSaveUser; + String? currentSaveUser; SharedPreferences.getInstance().then((prefs) async { currentSaveUser = prefs.getString("currentUser"); if (currentSaveUser == null) { } else { Map user = - jsonDecode(currentSaveUser) as Map; + jsonDecode(currentSaveUser!) as Map; TesoUser olduser = TesoUser.fromJSON(user); currentUser = olduser; prefs.setString("currentUser", currentUser.toString()); @@ -68,10 +68,10 @@ class UserProvider extends ChangeNotifier { return currentUser; } - setFavs(List categories) { + setFavs(List categories) { interest = categories; SharedPreferences.getInstance().then((prefs) { - prefs.setStringList("favoriteCats", categories); + prefs.setStringList("favoriteCats", categories as List); }); notifyListeners(); } @@ -82,18 +82,18 @@ class UserProvider extends ChangeNotifier { } catch (e) { SharedPreferences.getInstance().then((prefs) { interest = prefs.getStringList("favoriteCats"); - if (interest != null) if (interest.isEmpty) { + if (interest != null) if (interest!.isEmpty) { interest = []; } }); } } - Future update(TesoUser user) async { + Future update(TesoUser? user) async { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'users/updateUser'; @@ -102,19 +102,19 @@ class UserProvider extends ChangeNotifier { if (client1.statusCode == 200) { Map handler = jsonDecode(client1.body); - TesoUser tokenHandler = TesoUser.fromJSON(handler); + TesoUser tokenHandler = TesoUser.fromJSON(handler as Map); return tokenHandler; } else { return null; } } - Future> pullFavoriteCategories() async { + Future?> pullFavoriteCategories() async { SharedPreferences prefs = await SharedPreferences.getInstance(); List favs; Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'favoriteCategories/pullUser'; @@ -134,18 +134,18 @@ class UserProvider extends ChangeNotifier { updateFavoriteCategories(List catF) async { SharedPreferences prefs = await SharedPreferences.getInstance(); - String id = prefs.getString("id"); + String? id = prefs.getString("id"); List favs = []; catF.forEach((element) async { UserFavCategory category = new UserFavCategory(); category.userGuid = id; category.categoryCode = element; - category.countID = DateTime.now().toString() + id; + category.countID = DateTime.now().toString() + id!; favs.add(category); }); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; var register2 = serverLocation + 'favoriteCategories/updateFavorites'; @@ -163,7 +163,7 @@ class UserProvider extends ChangeNotifier { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; try { var register2 = serverLocation + 'monthly-desires/check-status'; @@ -193,7 +193,7 @@ class UserProvider extends ChangeNotifier { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; try { var register2 = serverLocation + 'coupons/viewCoupon'; @@ -211,7 +211,7 @@ class UserProvider extends ChangeNotifier { Future loadFriends() async { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -228,7 +228,7 @@ class UserProvider extends ChangeNotifier { Future getUserInformation() async { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -244,7 +244,7 @@ class UserProvider extends ChangeNotifier { Future getCoupons() async { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -263,7 +263,7 @@ class UserProvider extends ChangeNotifier { SharedPreferences prefs = await SharedPreferences.getInstance(); Map requestHeaders = { 'Content-type': 'application/json', - 'Authorization': prefs.getString('tokensTeso') + 'Authorization': prefs.getString('tokensTeso')! }; try { var register2 = serverLocation + 'coupons/redeemCoupon'; @@ -272,7 +272,7 @@ class UserProvider extends ChangeNotifier { print(client1.body); if (client1.statusCode == 200) { var data = client1.body; - int coins = int.tryParse(data); + int? coins = int.tryParse(data); Payload payload = new Payload(); payload.loadID = "TESN003"; payload.load1 = "CouponRedemption"; @@ -280,9 +280,9 @@ class UserProvider extends ChangeNotifier { await notificationPlugin.showNotification( "Coupon Redeem", "You have successfully redeem a " + - coupon.issuer.businessName + + coupon.issuer!.businessName! + " " + - coupon.type + + coupon.type! + " coupon", payload.toString(), ); @@ -406,7 +406,7 @@ class UserProvider extends ChangeNotifier { checkBlockedUsers() async { try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -431,7 +431,7 @@ class UserProvider extends ChangeNotifier { Future blockUser(TesoUser user) async { try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token @@ -451,7 +451,7 @@ class UserProvider extends ChangeNotifier { Future unblockUser(TesoUser user) async { try { SharedPreferences prefs = await SharedPreferences.getInstance(); - String token = prefs.getString("tokensTeso"); + String token = prefs.getString("tokensTeso")!; Map requestHeaders = { 'Content-type': 'application/json', 'Authorization': token diff --git a/lib/resetpassword.dart b/lib/resetpassword.dart index 87b60a8..03c7342 100644 --- a/lib/resetpassword.dart +++ b/lib/resetpassword.dart @@ -9,8 +9,8 @@ import 'Pages/PageWidgets/Login/passwordSignUP.dart'; import 'package:http/http.dart' as http; class ResetPassword extends StatefulWidget { - final String resetID; - const ResetPassword({Key key, this.resetID}) : super(key: key); + final String? resetID; + const ResetPassword({Key? key, this.resetID}) : super(key: key); @override _ResetPasswordState createState() => _ResetPasswordState(); @@ -19,8 +19,8 @@ class ResetPassword extends StatefulWidget { class _ResetPasswordState extends State with TickerProviderStateMixin { TextEditingController password = new TextEditingController(); - AnimationController _controller; - Animation _fabScale; + late AnimationController _controller; + late Animation _fabScale; bool eightChars = false; bool specialChar = false; bool upperCaseChar = false; @@ -250,7 +250,7 @@ class _ResetPasswordState extends State ), boxShadow: [ BoxShadow( - color: Colors.grey[500], + color: Colors.grey[500]!, offset: Offset(0.0, 1.5), blurRadius: 1.5, ), diff --git a/lib/simplewidgets/custom_alert.dart b/lib/simplewidgets/custom_alert.dart index 67a208b..353a677 100644 --- a/lib/simplewidgets/custom_alert.dart +++ b/lib/simplewidgets/custom_alert.dart @@ -10,13 +10,13 @@ class CustomAlert extends StatelessWidget { final Widget child; CustomAlert({ - Key key, - @required this.child + Key? key, + required this.child }): super(key: key); - double deviceWidth; - double deviceHeight; - double dialogHeight; + late double deviceWidth; + late double deviceHeight; + double? dialogHeight; @override diff --git a/lib/src/qr_code_scanner.dart b/lib/src/qr_code_scanner.dart index fad8126..67e69fc 100644 --- a/lib/src/qr_code_scanner.dart +++ b/lib/src/qr_code_scanner.dart @@ -8,16 +8,14 @@ typedef QRViewCreatedCallback = void Function(QRViewController); class QRView extends StatefulWidget { const QRView({ - @required Key key, - @required this.onQRViewCreated, + required Key key, + required this.onQRViewCreated, this.overlay, - }) : assert(key != null), - assert(onQRViewCreated != null), - super(key: key); + }) : super(key: key); final QRViewCreatedCallback onQRViewCreated; - final ShapeBorder overlay; + final ShapeBorder? overlay; @override State createState() => _QRViewState(); @@ -32,7 +30,7 @@ class _QRViewState extends State { if (widget.overlay != null) Container( decoration: ShapeDecoration( - shape: widget.overlay, + shape: widget.overlay!, ), ) else @@ -66,10 +64,10 @@ class _QRViewState extends State { } void _onPlatformViewCreated(int id) { - if (widget.onQRViewCreated == null) { - return; - } - widget.onQRViewCreated(QRViewController._(id, widget.key)); + // if (widget.onQRViewCreated ) { + // return; + // } + widget.onQRViewCreated(QRViewController._(id, widget.key as GlobalKey>?)); } } @@ -83,8 +81,8 @@ class _CreationParams { ); } - final double width; - final double height; + final double? width; + final double? height; Map toMap() { return { @@ -95,10 +93,10 @@ class _CreationParams { } class QRViewController { - QRViewController._(int id, GlobalKey qrKey) + QRViewController._(int id, GlobalKey? qrKey) : _channel = MethodChannel('net.touchcapture.qr.flutterqr/qrview_$id') { if (defaultTargetPlatform == TargetPlatform.iOS) { - final RenderBox renderBox = qrKey.currentContext.findRenderObject(); + final RenderBox renderBox = qrKey!.currentContext!.findRenderObject() as RenderBox; _channel.invokeMethod('setDimensions', {'width': renderBox.size.width, 'height': renderBox.size.height}); } diff --git a/lib/src/qr_scanner_overlay_shape.dart b/lib/src/qr_scanner_overlay_shape.dart index 3c47995..5b7fde3 100644 --- a/lib/src/qr_scanner_overlay_shape.dart +++ b/lib/src/qr_scanner_overlay_shape.dart @@ -9,11 +9,7 @@ class QrScannerOverlayShape extends ShapeBorder { this.borderRadius = 0, this.borderLength = 40, this.cutOutSize = 250, - }) : assert( - cutOutSize != null ?? - cutOutSize != null ?? - borderLength <= cutOutSize / 2 + borderWidth * 2, - "Border can't be larger than ${cutOutSize / 2 + borderWidth * 2}"); + }); final Color borderColor; final double borderWidth; @@ -26,14 +22,14 @@ class QrScannerOverlayShape extends ShapeBorder { EdgeInsetsGeometry get dimensions => const EdgeInsets.all(10); @override - Path getInnerPath(Rect rect, {TextDirection textDirection}) { + Path getInnerPath(Rect rect, {TextDirection? textDirection}) { return Path() ..fillType = PathFillType.evenOdd ..addPath(getOuterPath(rect), Offset.zero); } @override - Path getOuterPath(Rect rect, {TextDirection textDirection}) { + Path getOuterPath(Rect rect, {TextDirection? textDirection}) { Path _getLeftTopPath(Rect rect) { return Path() ..moveTo(rect.left, rect.bottom) @@ -57,7 +53,7 @@ class QrScannerOverlayShape extends ShapeBorder { } @override - void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) { + void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) { final width = rect.width; final borderWidthSize = width / 2; final height = rect.height; @@ -65,7 +61,7 @@ class QrScannerOverlayShape extends ShapeBorder { final _borderLength = borderLength > cutOutSize / 2 + borderWidth * 2 ? borderWidthSize / 2 : borderLength; - final _cutOutSize = cutOutSize != null && cutOutSize < width + final _cutOutSize = cutOutSize < width ? cutOutSize : width - borderOffset; diff --git a/lib/teso_fab.dart b/lib/teso_fab.dart index ddf9dc4..395149a 100644 --- a/lib/teso_fab.dart +++ b/lib/teso_fab.dart @@ -1,232 +1,215 @@ -// import 'dart:math' as math; -// import 'package:flutter/material.dart'; - -// @immutable -// class ExpandableFab extends StatefulWidget { -// const ExpandableFab({ -// super.key, -// this.initialOpen, -// required this.distance, -// required this.children, -// }); - -// final bool? initialOpen; -// final double distance; -// final List children; - -// @override -// _ExpandableFabState createState() => _ExpandableFabState(); -// } - -// class _ExpandableFabState extends State -// with SingleTickerProviderStateMixin { -// late final AnimationController _controller; -// late final Animation _expandAnimation; -// bool _open = false; - -// @override -// void initState() { -// super.initState(); -// _open = widget.initialOpen ?? false; -// _controller = AnimationController( -// value: _open ? 1.0 : 0.0, -// duration: const Duration(milliseconds: 250), -// vsync: this, -// ); -// _expandAnimation = CurvedAnimation( -// curve: Curves.fastOutSlowIn, -// reverseCurve: Curves.easeOutQuad, -// parent: _controller, -// ); -// } - -// @override -// void dispose() { -// _controller.dispose(); -// super.dispose(); -// } - -// void _toggle() { -// setState(() { -// _open = !_open; -// if (_open) { -// _controller.forward(); -// } else { -// _controller.reverse(); -// } -// }); -// } - -// @override -// Widget build(BuildContext context) { -// return SizedBox.expand( -// child: Stack( -// alignment: Alignment.bottomRight, -// clipBehavior: Clip.none, -// children: [ -// _buildTapToCloseFab(), -// ..._buildExpandingActionButtons(), -// _buildTapToOpenFab(), -// ], -// ), -// ); -// } - -// Widget _buildTapToCloseFab() { -// return SizedBox( -// width: 56.0, -// height: 56.0, -// child: Center( -// child: Material( -// shape: const CircleBorder(), -// clipBehavior: Clip.antiAlias, -// elevation: 4.0, -// child: InkWell( -// onTap: _toggle, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Icon( -// Icons.close, -// color: Theme.of(context).primaryColor, -// ), -// ), -// ), -// ), -// ), -// ); -// } - -// List _buildExpandingActionButtons() { -// final children = []; -// final count = widget.children.length; -// final step = 90.0 / (count - 1); -// for (var i = 0, angleInDegrees = 0.0; -// i < count; -// i++, angleInDegrees += step) { -// children.add( -// _ExpandingActionButton( -// directionInDegrees: angleInDegrees, -// maxDistance: widget.distance, -// progress: _expandAnimation, -// child: widget.children[i], -// ), -// ); -// } -// return children; -// } - -// Widget _buildTapToOpenFab() { -// return IgnorePointer( -// ignoring: _open, -// child: AnimatedContainer( -// transformAlignment: Alignment.center, -// transform: Matrix4.diagonal3Values( -// _open ? 0.7 : 1.0, -// _open ? 0.7 : 1.0, -// 1.0, -// ), -// duration: const Duration(milliseconds: 250), -// curve: const Interval(0.0, 0.5, curve: Curves.easeOut), -// child: AnimatedOpacity( -// opacity: _open ? 0.0 : 1.0, -// curve: const Interval(0.25, 1.0, curve: Curves.easeInOut), -// duration: const Duration(milliseconds: 250), -// child: FloatingActionButton( -// onPressed: _toggle, -// child: const Icon(Icons.create), -// ), -// ), -// ), -// ); -// } -// } - -// @immutable -// class _ExpandingActionButton extends StatelessWidget { -// const _ExpandingActionButton({ -// required this.directionInDegrees, -// required this.maxDistance, -// required this.progress, -// required this.child, -// }); - -// final double directionInDegrees; -// final double maxDistance; -// final Animation progress; -// final Widget child; - -// @override -// Widget build(BuildContext context) { -// return AnimatedBuilder( -// animation: progress, -// builder: (context, child) { -// final offset = Offset.fromDirection( -// directionInDegrees * (math.pi / 180.0), -// progress.value * maxDistance, -// ); -// return Positioned( -// right: 4.0 + offset.dx, -// bottom: 4.0 + offset.dy, -// child: Transform.rotate( -// angle: (1.0 - progress.value) * math.pi / 2, -// child: child!, -// ), -// ); -// }, -// child: FadeTransition( -// opacity: progress, -// child: child, -// ), -// ); -// } -// } - -// @immutable -// class ActionButton extends StatelessWidget { -// const ActionButton({ -// super.key, -// this.onPressed, -// required this.icon, -// }); - -// final VoidCallback? onPressed; -// final Widget icon; - -// @override -// Widget build(BuildContext context) { -// final theme = Theme.of(context); -// return Material( -// shape: const CircleBorder(), -// clipBehavior: Clip.antiAlias, -// color: theme.colorScheme.secondary, -// elevation: 4.0, -// child: IconButton( -// onPressed: onPressed, -// icon: icon, -// color: theme.colorScheme.secondary, -// ), -// ); -// } -// } - -// @immutable -// class FakeItem extends StatelessWidget { -// const FakeItem({ -// super.key, -// required this.isBig, -// }); - -// final bool isBig; - -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 24.0), -// height: isBig ? 128.0 : 36.0, -// decoration: BoxDecoration( -// borderRadius: const BorderRadius.all(Radius.circular(8.0)), -// color: Colors.grey.shade300, -// ), -// ); -// } -// } \ No newline at end of file +import 'dart:math' as math; +import 'package:flutter/material.dart'; +import 'package:teso/util/SizeConfig.dart'; +import 'package:teso/util/consts.dart'; + +@immutable +class TesoFAB extends StatefulWidget { + const TesoFAB({ + super.key, + this.initialOpen, + required this.distance, + required this.children, + }); + + final bool? initialOpen; + final double distance; + final List children; + + @override + _TesoFABState createState() => _TesoFABState(); +} + +class _TesoFABState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller; + late final Animation _expandAnimation; + bool _open = false; + + @override + void initState() { + super.initState(); + _open = widget.initialOpen ?? false; + _controller = AnimationController( + value: _open ? 1.0 : 0.0, + duration: const Duration(milliseconds: 250), + vsync: this, + ); + _expandAnimation = CurvedAnimation( + curve: Curves.fastOutSlowIn, + reverseCurve: Curves.easeOutQuad, + parent: _controller, + ); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + void _toggle() { + setState(() { + _open = !_open; + if (_open) { + _controller.forward(); + } else { + _controller.reverse(); + } + }); + } + + @override + Widget build(BuildContext context) { + return SizedBox.expand( + child: Stack( + alignment: Alignment.bottomRight, + clipBehavior: Clip.none, + children: [ + _buildTapToCloseFab(), + ..._buildExpandingActionButtons(), + _buildTapToOpenFab(), + ], + ), + ); + } + + Widget _buildTapToCloseFab() { + return SizedBox( + width: 56.0, + height: 56.0, + child: Center( + child: Material(color: Theme.of(context).primaryColor, + shape: const CircleBorder(), + clipBehavior: Clip.antiAlias, + elevation: 4.0, + child: InkWell( + onTap: _toggle, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.close, + color: Colors.grey, + ), + ), + ), + ), + ), + ); + } + + List _buildExpandingActionButtons() { + final children = []; + final count = widget.children.length; + final step = 90.0 / (count - 1); + for (var i = 0, angleInDegrees = 0.0; + i < count; + i++, angleInDegrees += step) { + children.add( + _ExpandingActionButton( + directionInDegrees: angleInDegrees, + maxDistance: widget.distance, + progress: _expandAnimation, + child: widget.children[i], + ), + ); + } + return children; + } + + Widget _buildTapToOpenFab() { + return IgnorePointer( + ignoring: _open, + child: AnimatedContainer( + transformAlignment: Alignment.center, + transform: Matrix4.diagonal3Values( + _open ? 0.7 : 1.0, + _open ? 0.7 : 1.0, + 1.0, + ), + duration: const Duration(milliseconds: 250), + curve: const Interval(0.0, 0.5, curve: Curves.easeOut), + child: AnimatedOpacity( + opacity: _open ? 0.0 : 1.0, + curve: const Interval(0.25, 1.0, curve: Curves.easeInOut), + duration: const Duration(milliseconds: 250), + child: FloatingActionButton( + backgroundColor: tesoGold, + onPressed: _toggle, + child: ImageIcon( + AssetImage("assets/images/rawLogo.png"), + size: SizeConfig.safeBlockHorizontal * 6.7, + ), + ), + ), + ), + ); + } +} + +@immutable +class _ExpandingActionButton extends StatelessWidget { + const _ExpandingActionButton({ + required this.directionInDegrees, + required this.maxDistance, + required this.progress, + required this.child, + }); + + final double directionInDegrees; + final double maxDistance; + final Animation progress; + final Widget child; + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: progress, + builder: (context, child) { + final offset = Offset.fromDirection( + directionInDegrees * (math.pi / 180.0), + progress.value * maxDistance, + ); + return Positioned( + right: 4.0 + offset.dx, + bottom: 4.0 + offset.dy, + child: Transform.rotate( + angle: (1.0 - progress.value) * math.pi / 2, + child: child!, + ), + ); + }, + child: FadeTransition( + opacity: progress, + child: child, + ), + ); + } +} + +@immutable +class ActionButton extends StatelessWidget { + const ActionButton({ + super.key, + this.onPressed, + required this.icon, + }); + + final VoidCallback? onPressed; + final Widget icon; + + @override + Widget build(BuildContext context) { + return Material( + shape: const CircleBorder(), + clipBehavior: Clip.antiAlias, + color: tesoGold, + elevation: 4.0, + child: IconButton( + onPressed: onPressed, + icon: icon, + color: Colors.black, + ), + ); + } +} \ No newline at end of file diff --git a/lib/util/SizeConfig.dart b/lib/util/SizeConfig.dart index 1345b53..054fc2a 100644 --- a/lib/util/SizeConfig.dart +++ b/lib/util/SizeConfig.dart @@ -1,16 +1,16 @@ import 'package:flutter/widgets.dart'; class SizeConfig { - static MediaQueryData _mediaQueryData; - static double screenWidth; - static double screenHeight; - static double blockSizeHorizontal; - static double blockSizeVertical; + static late MediaQueryData _mediaQueryData; + static late double screenWidth; + static late double screenHeight; + static late double blockSizeHorizontal; + static late double blockSizeVertical; - static double _safeAreaHorizontal; - static double _safeAreaVertical; - static double safeBlockHorizontal; - static double safeBlockVertical; + static late double _safeAreaHorizontal; + static late double _safeAreaVertical; + static late double safeBlockHorizontal; + static late double safeBlockVertical; void init(BuildContext context) { _mediaQueryData = MediaQuery.of(context); diff --git a/lib/util/consts.dart b/lib/util/consts.dart index 07af686..ff38f21 100644 --- a/lib/util/consts.dart +++ b/lib/util/consts.dart @@ -21,7 +21,8 @@ final tesoBlue = Color(0xFF2d4dbc); // final serverLocation = "http://172.20.10.3:55555/"; //testOnline -final serverLocation = "https://mobile.tesoapp.com/"; +// final serverLocation = "https://mobile.tesoapp.com/"; + final serverLocation = "https://testmobile.tesoapp.com/"; final serverwebPrivacy = "https://tesoapp.com/privacy"; final serverwebHelp = "https://stream.tesoapp.com/frequentlyasked"; final serverwebTerms = "https://tesoapp.com/eula"; @@ -34,15 +35,15 @@ String tesoPostThumb(post) { return "https://image.mux.com/$post/thumbnail.png?time=3"; } -String tesoProductThumbnail({String productLogo, int width, int height}) { +String tesoProductThumbnail({String? productLogo, int? width, int? height}) { if (width == null && height != null) { - return "https://mobile.tesoapp.com/products/$productLogo?height=$height"; + return "$serverLocation}products/$productLogo?height=$height"; } else if (width != null && height != null) { - return "https://mobile.tesoapp.com/products/$productLogo?width=$width&height=$height"; + return "${serverLocation}products/$productLogo?width=$width&height=$height"; } else if (width != null && height == null) { - return "https://mobile.tesoapp.com/products/$productLogo?width=$width"; + return "${serverLocation}products/$productLogo?width=$width"; } else { - return "https://mobile.tesoapp.com/products/$productLogo"; + return "${serverLocation}products/$productLogo"; } } @@ -74,7 +75,7 @@ class Constants { //Colors for theme static Color lightPrimary = Colors.white; static Color darkPrimary = Color(0xFF303030); - static Color lightAccent = Color(0xFFfea404); + static Color lightAccent = tesoGold; static Color darkAccent = Color(0xFFb90222); static Color lightBG = Color(0xFFF5F5F5); static Color darkBG = Color(0xFF212121); @@ -160,8 +161,8 @@ class Constants { ), ); - static List map(List list, Function handler) { - List result = []; + static List map(List list, Function handler) { + List result = []; for (var i = 0; i < list.length; i++) { result.add(handler(i, list[i])); } diff --git a/pubspec.yaml b/pubspec.yaml index 7856b7c..5e87532 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,21 +7,24 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.3+43 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.17.0 <3.0.0' dependencies: cached_network_image: ^3.1.0+1 camera: ^0.9.4+3 circular_countdown_timer: ^0.2.0 cloud_firestore: ^3.1.15 + collection: ^1.15.0-nullsafety.4 connectivity: ^3.0.6 country_list_pick: ^1.0.1+5 + crypto: ^3.0.1 cupertino_icons: ^1.0.4 dio: ^4.0.1 equatable: ^2.0.3 firebase_analytics: ^9.1.8 firebase_auth: ^3.2.0 - firebase_core: ^1.17.0 + firebase_auth_platform_interface: ^6.5.4 + firebase_core: ^1.19.1 firebase_crashlytics: ^2.3.0 firebase_dynamic_links: ^4.2.3 firebase_messaging: ^11.1.0 @@ -31,7 +34,7 @@ dependencies: flutter_cache_manager: ^3.1.3 flutter_countdown_timer: ^4.1.0 flutter_datetime_picker: ^1.5.1 - flutter_inappwebview: ^5.3.2 + flutter_inappwebview: ^5.4.3+7 flutter_launcher_icons: ^0.9.2 flutter_libphonenumber: ^1.2.1 flutter_local_notifications: ^9.0.2 @@ -39,6 +42,7 @@ dependencies: flutter_qrcode_scanner: ^0.0.7 flutter_shapes: ^0.3.0 flutter_staggered_grid_view: ^0.6.1 + flutter_svg: ^1.1.5 flutter_webview_plugin: ^0.4.0 geolocator: ^8.2.1 get_it: ^7.2.0 @@ -48,8 +52,8 @@ dependencies: http: ^0.13.4 image_cropper: ^2.0.3 image_picker: ^0.8.4+4 - inview_notifier_list: ^3.0.0 intl_phone_number_input: ^0.7.0+2 + inview_notifier_list: ^3.0.0 jiffy: ^5.0.0 loading_indicator: ^3.0.2 location: ^4.3.0 @@ -68,7 +72,6 @@ dependencies: share_plus: ^4.0.4 shared_preferences: ^2.0.8 sign_in_with_apple: ^4.0.0 - crypto: ^3.0.1 time_elapsed: ^0.2.6 url_launcher: ^6.0.12 webview_flutter: ^3.0.4 @@ -134,6 +137,8 @@ flutter: - assets/images/categories/home.png - assets/images/categories/machinery.png - assets/images/categories/pets.png + - assets/images/coupon.svg + - assets/images/search.svg fonts: - family: WickedGrit