Commit dd0eb34d authored by Uditha Prabhasha 's avatar Uditha Prabhasha

Update parentHome.dart

parent 45a7ed22
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mobile_application_kids/classroomview.dart';
import 'package:mobile_application_kids/addclassroom.dart'; import 'package:mobile_application_kids/addclassroom.dart';
import 'package:mobile_application_kids/childrenProfile.dart';
import 'package:mobile_application_kids/classroomview.dart';
import 'package:mobile_application_kids/teacherchat.dart'; import 'package:mobile_application_kids/teacherchat.dart';
import 'ChatScreen.dart'; import 'ChatScreen.dart';
import 'TeacherProfile.dart'; import 'TeacherProfile.dart';
import 'childrenProfile.dart';
class ParentHomePage extends StatelessWidget { class ParentHomePage extends StatelessWidget {
late User? user; late User? user;
late final Stream<QuerySnapshot> _usersStream; late final Stream<QuerySnapshot> _usersStream;
late String phoneNo; late String phoneNo;
late String role; late String role;
ParentHomePage(param0, role) { ParentHomePage(param0, role) {
this.role = role; this.role = role;
this.phoneNo = param0; this.phoneNo = param0;
...@@ -28,7 +29,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -28,7 +29,6 @@ class ParentHomePage extends StatelessWidget {
.snapshots(); .snapshots();
} }
// Define a TextStyle with the Poppins font
final TextStyle poppinsTextStyle = TextStyle( final TextStyle poppinsTextStyle = TextStyle(
fontFamily: 'Poppins', fontFamily: 'Poppins',
); );
...@@ -37,24 +37,14 @@ class ParentHomePage extends StatelessWidget { ...@@ -37,24 +37,14 @@ class ParentHomePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
onWillPop: () async { onWillPop: () async {
// Disable the back button press
return false; return false;
}, },
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
// leading: Flexible(
// child: Image.asset(
// 'lib/assets/logo.png',
// fit: BoxFit.contain,
// height: 150, // Adjust the height to make the logo bigger
// ),
// ),
actions: [ actions: [
IconButton( IconButton(
icon: Icon(Icons.notifications), icon: Icon(Icons.notifications),
onPressed: () { onPressed: () {},
// Handle notification icon press
},
), ),
], ],
), ),
...@@ -67,7 +57,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -67,7 +57,6 @@ class ParentHomePage extends StatelessWidget {
Text( Text(
'Explore, learn, and play in our magical world of wonder!', 'Explore, learn, and play in our magical world of wonder!',
style: poppinsTextStyle.copyWith( style: poppinsTextStyle.copyWith(
// fontWeight: FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
), ),
...@@ -84,11 +73,9 @@ class ParentHomePage extends StatelessWidget { ...@@ -84,11 +73,9 @@ class ParentHomePage extends StatelessWidget {
children: [ children: [
TextButton( TextButton(
onPressed: () { onPressed: () {
// Navigate to the AddClassroomPage
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => AddClassroomPage()),
builder: (context) => AddClassroomPage()),
); );
}, },
child: Row( child: Row(
...@@ -111,7 +98,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -111,7 +98,6 @@ class ParentHomePage extends StatelessWidget {
child: StreamBuilder<QuerySnapshot>( child: StreamBuilder<QuerySnapshot>(
stream: _usersStream, stream: _usersStream,
builder: (context, snapshot) { builder: (context, snapshot) {
print("--------------------------------------");
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator(); return CircularProgressIndicator();
} }
...@@ -119,7 +105,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -119,7 +105,6 @@ class ParentHomePage extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
} }
var itemcount = snapshot.data!.docs.length;
return ListView.builder( return ListView.builder(
itemCount: snapshot.data!.docs.length, itemCount: snapshot.data!.docs.length,
...@@ -127,16 +112,13 @@ class ParentHomePage extends StatelessWidget { ...@@ -127,16 +112,13 @@ class ParentHomePage extends StatelessWidget {
var document = snapshot.data!.docs[index]; var document = snapshot.data!.docs[index];
var className = document['className']; var className = document['className'];
var name = document['Firstname']; var name = document['Firstname'];
print(document);
return Padding( return Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 8.0),
bottom: 8.0), // Adjust the spacing as needed
child: ListTile( child: ListTile(
leading: CircleAvatar( leading: CircleAvatar(
radius: 27.0, radius: 27.0,
backgroundImage: backgroundImage: AssetImage('lib/assets/classlogo.png'),
AssetImage('lib/assets/classlogo.png'),
), ),
title: Column( title: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -170,8 +152,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -170,8 +152,6 @@ class ParentHomePage extends StatelessWidget {
), ),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
print(document);
// Handle view class button press
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
...@@ -209,7 +189,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -209,7 +189,6 @@ class ParentHomePage extends StatelessWidget {
icon: Icon(Icons.chat), icon: Icon(Icons.chat),
label: 'Chat', label: 'Chat',
), ),
// New BottomNavigationBarItem for the game
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.games), icon: Icon(Icons.games),
label: 'Games', label: 'Games',
...@@ -221,12 +200,10 @@ class ParentHomePage extends StatelessWidget { ...@@ -221,12 +200,10 @@ class ParentHomePage extends StatelessWidget {
], ],
selectedItemColor: Colors.blue, selectedItemColor: Colors.blue,
onTap: (index) { onTap: (index) {
// Handle bottom navigation item tap
switch (index) { switch (index) {
case 0: case 0:
break; break;
case 1: case 1:
// Navigate to Chat
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => ChatScreen()), MaterialPageRoute(builder: (context) => ChatScreen()),
...@@ -236,7 +213,6 @@ class ParentHomePage extends StatelessWidget { ...@@ -236,7 +213,6 @@ class ParentHomePage extends StatelessWidget {
// Handle Game // Handle Game
break; break;
case 3: case 3:
// Navigate to Profile
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment