diff --git a/lib/services/blood_bank_service.dart b/lib/services/blood_bank_service.dart index c061260..a3649c1 100644 --- a/lib/services/blood_bank_service.dart +++ b/lib/services/blood_bank_service.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'package:donorconnect/views/controllers/onboarding/onboarding_controller.dart'; import 'package:http/http.dart' as http; const String apiKey = @@ -13,6 +14,9 @@ class BloodBankService { if (response.statusCode == 200) { final data = jsonDecode(response.body); + if (data['records'] == null || data['records'].isBlank) { + return []; // as no records are found. + } return data['records']; // Modify as per the API response structure } else { return []; diff --git a/lib/views/pages/camps/campsPage.dart b/lib/views/pages/camps/campsPage.dart index d0db398..022ce80 100644 --- a/lib/views/pages/camps/campsPage.dart +++ b/lib/views/pages/camps/campsPage.dart @@ -503,7 +503,7 @@ class _AddCampFormState extends State { lastDate: DateTime(2100), ); - if (pickedDate != null && pickedDate != _selectedDate) { + if (pickedDate != _selectedDate) { setState(() { _selectedDate = pickedDate; // Store the selected date }); diff --git a/lib/views/pages/main_home/chatbot.dart b/lib/views/pages/main_home/chatbot.dart index 4876267..ec507bb 100644 --- a/lib/views/pages/main_home/chatbot.dart +++ b/lib/views/pages/main_home/chatbot.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; -import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; 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 ffe191b..48a025c 100644 --- a/lib/views/pages/main_home/home_pages/home_screen.dart +++ b/lib/views/pages/main_home/home_pages/home_screen.dart @@ -70,13 +70,19 @@ class _HomeScreenState extends State { HomeCardConst( title: _text.donate, col: const Color.fromARGB(255, 255, 122, 122), - onPressed: () {}, + onPressed: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (ctx) => LocateBloodBanks())); + }, ), HomeCardConst( title: _text.required, col: const Color.fromARGB(255, 167, 165, 252), onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (ctx)=> RequiredScreen())); + Navigator.push( + context, + MaterialPageRoute( + builder: (ctx) => RequiredScreen())); }, ), ], @@ -90,8 +96,7 @@ class _HomeScreenState extends State { Icons.search, size: 23, ), - onPressed: (){}, - + onPressed: () {}, ), HomeCard( title: _text.learn_about_donating, @@ -123,11 +128,13 @@ class _HomeScreenState extends State { ), ), ), - floatingActionButton: FloatingActionButton(onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) => ChatBot())); - }, - child: const Icon(Icons.chat), - ), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.push( + context, MaterialPageRoute(builder: (context) => ChatBot())); + }, + child: const Icon(Icons.chat), + ), ); } } diff --git a/lib/views/pages/profile/profile_screen.dart b/lib/views/pages/profile/profile_screen.dart index da1da51..50b5109 100644 --- a/lib/views/pages/profile/profile_screen.dart +++ b/lib/views/pages/profile/profile_screen.dart @@ -3,6 +3,7 @@ import 'package:donorconnect/cubit/profile/profile_cubit.dart'; import 'package:donorconnect/cubit/profile/profile_state.dart'; import 'package:donorconnect/language/helper/language_extention.dart'; import 'package:donorconnect/views/common_widgets/toggle_button.dart'; +import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -41,7 +42,7 @@ class _ProfileScreenState extends State { actions: [ IconButton( onPressed: () { - + AuthCubit(_auth, _firestore).signOut(context); }, icon: const Icon( Icons.logout, @@ -60,7 +61,7 @@ class _ProfileScreenState extends State { Column( children: [ Text( - "ALICE", + widget.name, style: const TextStyle( fontSize: 24, fontWeight: FontWeight.bold, @@ -179,7 +180,8 @@ class _ProfileScreenState extends State { // theme-toggle button BlocBuilder( builder: (context, themeState) { - final isDarkMode = themeState.themeData.brightness == Brightness.dark; + final isDarkMode = + themeState.themeData.brightness == Brightness.dark; return ThemeToggleButton( switchValue: isDarkMode, );