From 842bf9ac9d5158f6761d68867107338c73958ea6 Mon Sep 17 00:00:00 2001 From: Satyam Jha Date: Tue, 22 Oct 2024 01:02:03 +0530 Subject: [PATCH] donation_info_screen_completed --- ios/Podfile.lock | 75 ++++++- ios/Runner.xcodeproj/project.pbxproj | 27 ++- lib/firebase_options.dart | 3 +- .../learn_about_donation.dart | 203 ++++++++++++++++++ .../main_home/home_pages/home_screen.dart | 47 ++-- 5 files changed, 329 insertions(+), 26 deletions(-) create mode 100644 lib/views/pages/learn_about_donation/learn_about_donation.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 82bfbb7..d0aa4c7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1145,6 +1145,12 @@ PODS: - abseil/meta/type_traits - abseil/xcprivacy - abseil/xcprivacy (1.20240116.2) + - AppAuth (1.7.5): + - AppAuth/Core (= 1.7.5) + - AppAuth/ExternalUserAgent (= 1.7.5) + - AppAuth/Core (1.7.5) + - AppAuth/ExternalUserAgent (1.7.5): + - AppAuth/Core - BoringSSL-GRPC (0.0.36): - BoringSSL-GRPC/Implementation (= 0.0.36) - BoringSSL-GRPC/Interface (= 0.0.36) @@ -1163,6 +1169,9 @@ PODS: - Firebase/Firestore (11.2.0): - Firebase/CoreOnly - FirebaseFirestore (~> 11.2.0) + - Firebase/Storage (11.2.0): + - Firebase/CoreOnly + - FirebaseStorage (~> 11.2.0) - firebase_auth (5.3.1): - Firebase/Auth (= 11.2.0) - firebase_core @@ -1170,6 +1179,10 @@ PODS: - firebase_core (3.6.0): - Firebase/CoreOnly (= 11.2.0) - Flutter + - firebase_storage (12.3.3): + - Firebase/Storage (= 11.2.0) + - firebase_core + - Flutter - FirebaseAppCheckInterop (11.3.0) - FirebaseAuth (11.2.0): - FirebaseAppCheckInterop (~> 11.0) @@ -1210,9 +1223,28 @@ PODS: - leveldb-library (~> 1.22) - nanopb (~> 3.30910.0) - FirebaseSharedSwift (11.3.0) + - FirebaseStorage (11.2.0): + - FirebaseAppCheckInterop (~> 11.0) + - FirebaseAuthInterop (~> 11.0) + - FirebaseCore (~> 11.0) + - FirebaseCoreExtension (~> 11.0) + - GoogleUtilities/Environment (~> 8.0) + - GTMSessionFetcher/Core (~> 3.4) - Flutter (1.0.0) - flutter_native_splash (0.0.1): - Flutter + - geolocator_apple (1.2.0): + - Flutter + - google_sign_in_ios (0.0.1): + - AppAuth (>= 1.7.4) + - Flutter + - FlutterMacOS + - GoogleSignIn (~> 7.1) + - GTMSessionFetcher (>= 3.4.0) + - GoogleSignIn (7.1.0): + - AppAuth (< 2.0, >= 1.7.3) + - GTMAppAuth (< 5.0, >= 4.1.1) + - GTMSessionFetcher/Core (~> 3.3) - GoogleUtilities/AppDelegateSwizzler (8.0.2): - GoogleUtilities/Environment - GoogleUtilities/Logger @@ -1324,7 +1356,16 @@ PODS: - gRPC-Core/Privacy (= 1.65.5) - gRPC-Core/Interface (1.65.5) - gRPC-Core/Privacy (1.65.5) + - GTMAppAuth (4.1.1): + - AppAuth/Core (~> 1.7) + - GTMSessionFetcher/Core (< 4.0, >= 3.3) + - GTMSessionFetcher (3.5.0): + - GTMSessionFetcher/Full (= 3.5.0) - GTMSessionFetcher/Core (3.5.0) + - GTMSessionFetcher/Full (3.5.0): + - GTMSessionFetcher/Core + - image_picker_ios (0.0.1): + - Flutter - leveldb-library (1.22.5) - nanopb (3.30910.0): - nanopb/decode (= 3.30910.0) @@ -1338,19 +1379,27 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - url_launcher_ios (0.0.1): + - Flutter DEPENDENCIES: - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_storage (from `.symlinks/plugins/firebase_storage/ios`) - Flutter (from `Flutter`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) + - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) + - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: trunk: - abseil + - AppAuth - BoringSSL-GRPC - Firebase - FirebaseAppCheckInterop @@ -1362,9 +1411,12 @@ SPEC REPOS: - FirebaseFirestore - FirebaseFirestoreInternal - FirebaseSharedSwift + - FirebaseStorage + - GoogleSignIn - GoogleUtilities - "gRPC-C++" - gRPC-Core + - GTMAppAuth - GTMSessionFetcher - leveldb-library - nanopb @@ -1377,22 +1429,34 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_auth/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" + firebase_storage: + :path: ".symlinks/plugins/firebase_storage/ios" Flutter: :path: Flutter flutter_native_splash: :path: ".symlinks/plugins/flutter_native_splash/ios" + geolocator_apple: + :path: ".symlinks/plugins/geolocator_apple/ios" + google_sign_in_ios: + :path: ".symlinks/plugins/google_sign_in_ios/darwin" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: abseil: d121da9ef7e2ff4cab7666e76c5a3e0915ae08c3 + AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa BoringSSL-GRPC: ca6a8e5d04812fce8ffd6437810c2d46f925eaeb cloud_firestore: 5cb927f1a8c9d748d6fdbf16c6b267956cb82c53 Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c firebase_auth: 0c77e299a8f2d1c74d1b1f6b78b3d4d802c19f47 firebase_core: 2bedc3136ec7c7b8561c6123ed0239387b53f2af + firebase_storage: 65d4aea1e6a42b153b738412f7ac8b1c9bfa6206 FirebaseAppCheckInterop: 7789a8adfb09e905ce02a76540b94b059029ea81 FirebaseAuth: 2a198b8cdbbbd457f08d74df7040feb0a0e7777a FirebaseAuthInterop: c453b7ba7c49b88b2f519bb8d2e29edf7ada4a2a @@ -1402,20 +1466,25 @@ SPEC CHECKSUMS: FirebaseFirestore: 62708adbc1dfcd6d165a7c0a202067b441912dc9 FirebaseFirestoreInternal: ad9b9ee2d3d430c8f31333a69b3b6737a7206232 FirebaseSharedSwift: d39c2ad64a11a8d936ce25a42b00df47078bb59c + FirebaseStorage: 9353f926690b2329957860abfcbc8b4074fe45e8 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 + geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450 + google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38 + GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d "gRPC-C++": 2fa52b3141e7789a28a737f251e0c45b4cb20a87 gRPC-Core: a27c294d6149e1c39a7d173527119cfbc3375ce4 + GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 + image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28 nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe - -PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5 - +PODFILE CHECKSUM: 8012376785340ccabb170e4f14d0f15eb57b90e2 COCOAPODS: 1.15.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 08a4618..6acb12e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -16,10 +16,7 @@ 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 */; }; - DB7D1C3064DBB55B34F287DF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9474E3A41549165E87B32720 /* GoogleService-Info.plist */; }; - - /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -69,7 +66,6 @@ 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 = ""; }; B41A181F17AD4C9191EEB37A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - C0D49440D0CD1E964E6B34A8 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; C44BFF0291F6D1BE5075266D /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -144,9 +140,7 @@ 331C8082294A63A400263BE5 /* RunnerTests */, 2B19EE781D45E8B26024024E /* Pods */, 3A80F58C55AA81E2C8F3F1F1 /* Frameworks */, - 9474E3A41549165E87B32720 /* GoogleService-Info.plist */, - ); sourceTree = ""; }; @@ -208,6 +202,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 21291158BF4324DCBC539C28 /* [CP] Embed Pods Frameworks */, + 27BE65335B8C962174D3D705 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -273,10 +268,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - DB7D1C3064DBB55B34F287DF /* GoogleService-Info.plist in Resources */, - - ); runOnlyForDeploymentPostprocessing = 0; }; @@ -300,6 +292,23 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 27BE65335B8C962174D3D705 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 0bca5cd..c6075cd 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -83,4 +83,5 @@ class DefaultFirebaseOptions { authDomain: 'donor-connect-project.firebaseapp.com', storageBucket: 'donor-connect-project.appspot.com', ); -} + +} \ No newline at end of file diff --git a/lib/views/pages/learn_about_donation/learn_about_donation.dart b/lib/views/pages/learn_about_donation/learn_about_donation.dart new file mode 100644 index 0000000..d37de99 --- /dev/null +++ b/lib/views/pages/learn_about_donation/learn_about_donation.dart @@ -0,0 +1,203 @@ +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class LearnAboutDonation extends StatelessWidget { + const LearnAboutDonation({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text( + "Learn More About Donation", + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + backgroundColor: Colors.redAccent, + ), + body: const DonationInfoBody(), + ); + } +} + +class DonationInfoBody extends StatelessWidget { + const DonationInfoBody({super.key}); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + _buildHeaderSection(), + _buildInfoCardSection(context), + _buildLinksSection(), + ], + ), + ); + } + + Widget _buildHeaderSection() { + return Container( + width: double.infinity, + padding: const EdgeInsets.all(16.0), + decoration: const BoxDecoration( + gradient: LinearGradient( + colors: [Colors.redAccent, Colors.pinkAccent], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: const Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Why Donate Blood or Platelets?", + style: TextStyle( + fontSize: 24.0, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + SizedBox(height: 8.0), + Text( + "Your donation can save lives, provide critical help during emergencies, and support medical treatments.", + style: TextStyle(fontSize: 16.0, color: Colors.white), + ), + ], + ), + ); + } + + Widget _buildInfoCardSection(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + _buildInfoCard( + title: "Humanitarian Benefits", + content: + "Donating blood helps save lives during emergencies, surgeries, and treatments. Platelets are vital for cancer patients, trauma victims, and those with chronic illnesses.", + icon: Icons.favorite, + ), + const SizedBox(height: 12), + _buildInfoCard( + title: "Best Practices for Donation", + content: + "Stay hydrated, eat a healthy meal before donating, and avoid alcohol. After donating, rest, drink fluids, and avoid strenuous activity.", + icon: Icons.local_hospital, + ), + const SizedBox(height: 12), + _buildInfoCard( + title: "Precautions & Cautions", + content: + "Ensure you meet donation eligibility criteria. After donating, rest and avoid lifting heavy objects. Seek medical advice if you feel unwell post-donation.", + icon: Icons.warning, + ), + ], + ), + ); + } + + Widget _buildLinksSection() { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Learn More", + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + ), + const SizedBox(height: 8.0), + _buildLinkItem( + title: "E-RaktKosh: India's Online Blood Bank", + url: "https://eraktkosh.mohfw.gov.in/BLDAHIMS/bloodbank/about.cnt", + ), + _buildLinkItem( + title: "Post-donation advice to blood donors", + url: "https://www.ncbi.nlm.nih.gov/books/NBK310568/", + ), + _buildLinkItem( + title: "American Red Cross: Blood Donation", + url: "https://www.redcross.org/give-blood.html", + ), + _buildLinkItem( + title: "WHO Guidelines on Blood Donation", + url: + "https://www.who.int/news-room/fact-sheets/detail/blood-safety-and-availability", + ), + _buildLinkItem( + title: "National Blood Transfusion Council (NBTC) India", + url: "http://nbtc.naco.gov.in/page/aboutus/", + ), + _buildLinkItem( + title: "NHS Blood and Transplant", + url: "https://www.blood.co.uk", + ), + ], + ), + ); + } + + Widget _buildInfoCard( + {required String title, + required String content, + required IconData icon}) { + return Card( + elevation: 5, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Icon(icon, size: 40, color: Colors.redAccent), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontSize: 18.0, fontWeight: FontWeight.bold), + ), + const SizedBox(height: 8.0), + Text( + content, + style: const TextStyle(fontSize: 16.0), + ), + ], + ), + ), + ], + ), + ), + ); + } + + Widget _buildLinkItem({required String title, required String url}) { + Uri uri = Uri.parse(url); + return GestureDetector( + onTap: () async { + if (await canLaunchUrl(uri)) { + await launchUrl(uri); + } + }, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 4.0), + child: Row( + children: [ + const Icon(Icons.link, color: Colors.blueAccent), + const SizedBox(width: 8.0), + Expanded( + child: Text( + title, + style: + const TextStyle(fontSize: 15.0, color: Colors.blueAccent), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/views/pages/main_home/home_pages/home_screen.dart b/lib/views/pages/main_home/home_pages/home_screen.dart index 64e3d7b..78c1cd4 100644 --- a/lib/views/pages/main_home/home_pages/home_screen.dart +++ b/lib/views/pages/main_home/home_pages/home_screen.dart @@ -4,6 +4,7 @@ import 'package:donorconnect/language/helper/langauge_popup.dart'; import 'package:donorconnect/language/helper/language_extention.dart'; import 'package:donorconnect/views/common_widgets/home_card.dart'; import 'package:donorconnect/views/common_widgets/home_card_form.dart'; +import 'package:donorconnect/views/pages/learn_about_donation/learn_about_donation.dart'; import 'package:donorconnect/views/pages/locate_blood_banks/locate_blood_banks.dart'; import 'package:flutter/material.dart'; // import 'package:flutter_bloc/flutter_bloc.dart'; @@ -47,7 +48,7 @@ class _HomeScreenState extends State { // icon: const Icon(Icons.language_rounded)) Padding( - padding: const EdgeInsets.only(left: 16.0, right: 16.0), + padding: EdgeInsets.only(left: 16.0, right: 16.0), child: LanguagePopup(), ) ], @@ -87,19 +88,22 @@ class _HomeScreenState extends State { ), onPressed: () { Navigator.push( - context, - PageRouteBuilder( - pageBuilder: (context, animation, secondaryAnimation) => const LocateBloodBanks(), - transitionsBuilder: (context, animation, secondaryAnimation, child) { - return FadeTransition( - opacity: animation, - child: child, + context, + PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) => + const LocateBloodBanks(), + transitionsBuilder: + (context, animation, secondaryAnimation, child) { + return FadeTransition( + opacity: animation, + child: child, + ); + }, + transitionDuration: const Duration( + milliseconds: 900), // Adjust duration as needed + ), ); }, - transitionDuration: const Duration(milliseconds: 900), // Adjust duration as needed - ),); - - }, ), HomeCard( title: _text.learn_about_donating, @@ -107,7 +111,24 @@ class _HomeScreenState extends State { button: "Learn", image: 'assets/images/home_image2.png', icon: const Icon(Icons.menu_book_outlined), - onPressed: () {}, + onPressed: () { + Navigator.push( + context, + PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) => + const LearnAboutDonation(), + transitionsBuilder: + (context, animation, secondaryAnimation, child) { + return FadeTransition( + opacity: animation, + child: child, + ); + }, + transitionDuration: const Duration( + milliseconds: 900), // Adjust duration as needed + ), + ); + }, ), SizedBox(height: height * 0.1) ],