Skip to content

Commit

Permalink
updated appointment screen, and pharmacist details screen with live data
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelSena19 committed Oct 12, 2023
1 parent a4e022a commit 1496386
Show file tree
Hide file tree
Showing 6 changed files with 269 additions and 211 deletions.
2 changes: 0 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:health_watch/screens/chat_screen.dart';
import 'package:health_watch/screens/edit_profile_screen.dart';
import 'package:health_watch/screens/home_screen.dart';
import 'package:health_watch/screens/login_screen.dart';
import 'package:health_watch/screens/pharmacist_details_screen.dart';
import 'package:health_watch/screens/profile_screen.dart';
import 'package:health_watch/screens/register_screen.dart';
import 'package:health_watch/screens/reset_password_screen.dart';
Expand Down Expand Up @@ -51,7 +50,6 @@ class MyApp extends StatelessWidget {
editProfileRoute: (context) => const EditProfileScreen(),
appointmentRoute: (context) => const AppointmentScreen(),
calendarRoute: (context) => const CalendarScreen(),
detailsRoute: (context) => const PharmacistDetailsScreen(),
successRoute: (context) => const AppointmentBooked(),
chatRoute: (context) => const ChatScreen(),
settingsRoute: (context) => const SettingsScreen(),
Expand Down
57 changes: 48 additions & 9 deletions lib/screens/apppointment_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:health_watch/utilities/appbar_widget.dart';
import 'package:health_watch/utilities/appointment_card.dart';
Expand All @@ -22,24 +23,62 @@ class _AppointmentScreenState extends State<AppointmentScreen> {
child: ListView(
scrollDirection: Axis.vertical,
children: [
const SizedBox(height: 10,),
const SizedBox(
height: 10,
),
const Text(
"Today",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20,),
const SizedBox(
height: 20,
),
const AppointmentCard(),
const SizedBox(height: 40,),
const SizedBox(
height: 40,
),
const Text(
"Top Pharmacists",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20,),
Column(
children: List.generate(10, (index){
return const DoctorCard();
}),
)
const SizedBox(
height: 20,
),
SizedBox(
height: 2000,
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('pharmacists')
.orderBy('rating', descending: true)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else if (snapshot.connectionState ==
ConnectionState.waiting) {
return const Center(
child: SizedBox(
height: 10,
width: 10,
child: CircularProgressIndicator(),
),
);
} else {
final pharmacists = snapshot.data!.docs;
return Column(
children: List.generate(5, (index) {
final pharmacist = pharmacists[index];
return DoctorCard(
name: pharmacist['name'] ?? '',
pharmacy: pharmacist['pharmacy'] ?? '',
rating: pharmacist['rating'] ?? 0.0,
);
}),
);
}
},
),
),
],
),
),
Expand Down
Loading

0 comments on commit 1496386

Please sign in to comment.